import processing.opengl.*; //OpenGLのライブラリを読み込みます。
Wiimote wiimote; //Wiimote型変数であるwiimoteの宣言
void setup() {
size(640, 480, OPENGL); //OpenGLを使用すする場合、size(幅, 高さ, OPENGL)~ noStroke(); //線は描きません。~ fill(204); //モノクロの204の色で塗ります。~ wiimote = new Wiimote(this); //初期化してwiimote用のメモリを確保します。~
}
void draw() {
wiimote.update(); //ここで、WiiRemoteから、WiiFlash経由でデータを取得します。~
noStroke();~
background(0); //background(r, g, b, alpha)or background(黒~白)~
//↓もしwiimoteのaボタンが押されたら、draw関数から抜け出す。~
if (!wiimote.a.pressed) {~
return;~
}~
directionalLight(204, 204, 204, wiimote.x, wiimote.y, -1); //光の方向を指定 directionalLight(r, g, b, 方向x, y, z)~
translate(width/2 - 100, height/2, 0); //Objectの座標を動かす translate(x, y, z)~
sphere(80); //球体を描画できる。 sphere(サイズ)~
translate(200, 0, 0); //二回目以降のtranslateは、前回の数値に+されていくので、実際のx座標はwidth/2-100+200である。~
sphere(80);~
}