///+ Prefix
//// Psychlops 環境を呼び出すための宣言です.
#include <psychlops.h>
using namespace Psychlops;
///- Prefix
///+ Main Routine
//// Psychlops のプログラムは psychlops_main() の最初から始まります.
void psychlops_main() {
///+ 1
//// 刺激を描画するためのウィンドウを作成します
Canvas window(Canvas::window); //ウィンドウを作成します.ここでは,ウィンドウの大きさはプリセットのウィンドウモードになります.
// ここで"Canvas window(Canvas::fullscreen); " と書くことでフルスクリーンモードになります.
// "Canvas window(1024, 768, 32, 60.0); " と書くと 1024 x 768, 32bit color, 60 Hzにティスプレイモードを変更します.
///- 1
///+ 2
//// 図形の大きさ,位置,色を決めます.
Psychlops::Rectangle/*ID:FIGURE selector Rectangle Ellipse*/ figure; // 四角形または楕円形を表すオブジェクトを定義します.
figure.set( 100/*ID:SIZE_X 1 200 10*/, 100/*ID:SIZE_Y 1 200 10*/ ); // 図形の大きさを設定します.
figure.centering(); // 図形をウィンドウの中心にセンタリングします.
figure.shift( 10/*ID:SHIFT_X -100 100 10*/, 10/*ID:SHIFT_Y -100 100 10*/ ); // 図形を指定のベクトル方向に移動します
figure.draw( Color( 1.0/*ID:COLOR_R 0 1.0 0.1*/, 0.0/*ID:COLOR_G 0.0 1.0 0.1*/, 0.0/*ID:COLOR_B 0 1.0 0.1*/) ); // 図形を指定の色で描画します.
window.flip(); // フレームバッファをフリップして描画結果を画面に反映させます.
// この命令を実行するまでは描画された図形は画面に提示されません.
///- 2
///+ 3
//// キーボード入力を受け付けます.
while(!Keyboard::esc.pushed()) {} //ESCキーが押されたらプログラムを終了します.
///- 3
}
///- Main Routine
///+ Prefix
//// Lines for set up Psychlops environment
#include <psychlops.h>
using namespace Psychlops;
///- Prefix
///+ Main Routine
//// Psychlops runs at the first line of this function psychlops_main().
void psychlops_main() {
///+ 1
//// Set a window for drawing stimulus
Canvas window(Canvas::window); //Create a window. Here, window variables are preset mode.
// You can write this statement as" Canvas window(Canvas::fullscreen); " for fullscreen mode
// or as " Canvas window(1024, 768, 32, 60.0); " This statement changes screenmode to 1024 x 768, 32bit color, 60 Hz refresh.
///- 1
///+ 2
//// Set a figure size, position and color.
Psychlops::Rectangle/*ID:FIGURE selector Rectangle Ellipse*/ figure; //Create a figure (Rectangle or Ellipse) variable.
figure.set( 100/*ID:SIZE_X 1 200 10*/, 100/*ID:SIZE_Y 1 200 10*/ ); // Set the size of figure.
figure.centering(); // Centering the figure in the window
figure.shift( 10/*ID:SHIFT_X -100 100 10*/, 10/*ID:SHIFT_Y -100 100 10*/ ); // Displacing the figure by designated vector.
figure.draw( Color( 1.0/*ID:COLOR_R 0 1.0 0.1*/, 0.0/*ID:COLOR_G 0.0 1.0 0.1*/, 0.0/*ID:COLOR_B 0 1.0 0.1*/) ); // Drawing the rectangle with a designated color.
window.flip(); // Reflect the drawing for the display by flipping frame buffers.
// Till this point, you will not see drawn figures.
///- 2
///+ 3
//// Detect a Keyboard input
while(!Keyboard::esc.pushed()) {} //exit a program when the escape key is pressed down.
///- 3
}
///- Main Routine
./BasicCode1.xap