Skip to content

Instantly share code, notes, and snippets.

// orthographicSizeはカメラの高さの半分のサイズ
var h = _camera.orthographicSize;
var screenRatio = (float) Screen.width / (float) Screen.height;
var w = screenRatio * h;
// 2048*2048pxの画像をドラッグする
var imageSize = 2048;
// X,Yそれぞれの最大ドラッグできる距離
var distanceX = (float)imageSize/(100f * 2f) - w;
// ポテンショメータを使ってLEDを点滅スピードを変更するサンプル
int sensorPin = A0;
int ledPin = 13;
int sensorValue = 0;
void setup()
{
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
// [wip] 1digit 7segment module sample
// 手持ちの配線が足らなかったので一旦
void setup()
{
// 0は使用できない
// pinMode(0, OUTPUT);
pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
#include <SPI.h>
#include <CubettoLibrary.h>
#include <AccelStepper.h>
#include <aci.h>
#include <KickstarterBackers.h>
Cubetto CubettoRobot;
/** ************************************************************************************************************************************
* @function
* @brief
#include "stdafx.h"
#include <iostream>
typedef struct
{
int id;
float value;
}StructData;
DllExport void TestStruct(StructData* output, StructData* input);
[DllImport("TestDll.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void TestIntArray(System.IntPtr array, int length);
static void Main()
{
// 配列要素数
const int Length = 5;
var array = new int[Length] { 0, 1, 2, 3, 4 };
// アンマネージド配列のメモリ確保
#pragma once
#include "targetver.h"
// Windows ヘッダーからほとんど使用されていない部分を除外する
#define WIN32_LEAN_AND_MEAN
// Windows ヘッダー ファイル
#include <windows.h>
#include "stdafx.h"
#include <iostream>
// C#から配列と要素数を渡す関数を定義
DllExport void TestIntArray(int* array, int length);
void TestIntArray(int* array, int length)
{
for (int i = 0; i < length; i++)
{
#include "stdafx.h"
#include <iostream>
// C#からたたかれる関数定義
DllExport void TestInt(const int value) {
std::cout << value << std::endl;
}
void TestInt(const int value)
{
[DllImport("TestDll.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void Test(string str);
static void Main()
{
// DLLのTestを呼ぶ
Test("hogehoge");
}