3 //// Lines for set up Psychlops environment
\r
6 namespace PsychlopsSilverlightApp
\r
9 public class PsychlopsMain
\r
13 //// Psychlops runs at the first line of this function psychlops_main().
\r
14 public void psychlops_main()
\r
17 //// Set a window for drawing stimulus
\r
18 Canvas window = new Canvas(300, 300); //Create a window. Here, window variables are preset mode.
\r
19 // You can write this statement as" Canvas window = new Canvas(Canvas.fullscreen); " for fullscreen mode
\r
20 // or as " Canvas window = new Canvas(1024, 768, 32, 60.0); " This statement changes screenmode to 1024 x 768, 32bit color, 60 Hz refresh.
\r
23 var FIGURE = Psychlops.Widgets.Browser.Element.byID("FIGURE");
\r
24 var SIZE_X = Psychlops.Widgets.Browser.Element.byID("SIZE_X");
\r
25 var SIZE_Y = Psychlops.Widgets.Browser.Element.byID("SIZE_Y");
\r
26 var SHIFT_X = Psychlops.Widgets.Browser.Element.byID("SHIFT_X");
\r
27 var SHIFT_Y = Psychlops.Widgets.Browser.Element.byID("SHIFT_Y");
\r
28 var COLOR_R = Psychlops.Widgets.Browser.Element.byID("COLOR_R");
\r
29 var COLOR_G = Psychlops.Widgets.Browser.Element.byID("COLOR_G");
\r
30 var COLOR_B = Psychlops.Widgets.Browser.Element.byID("COLOR_B");
\r
34 //// Set a figure size, position and color.
\r
35 Rectangle figure = new Rectangle();
\r
36 Ellipse figure2 = new Ellipse();
\r
38 window.flip(); // Reflect the drawing for the display by flipping frame buffers.
\r
39 // Till this point, you will not see drawn figures.
\r
43 //// Detect a Keyboard input
\r
44 while (!Keyboard.esc.pushed())
\r
49 if ("Rectangle".Equals(FIGURE))
\r
51 figure.set(SIZE_X, SIZE_Y); // Set the size of figure.
\r
52 figure.centering(); // Centering the figure in the window
\r
53 figure.shift(SHIFT_X, SHIFT_Y); // Displacing the figure by designated vector.
\r
54 figure.draw(new Color(COLOR_R, COLOR_G, COLOR_B)); // Drawing the rectangle with a designated color.
\r
58 figure2.set(SIZE_X, SIZE_Y); // Set the size of figure.
\r
59 figure2.centering(); // Centering the figure in the window
\r
60 figure2.shift(SHIFT_X, SHIFT_Y); // Displacing the figure by designated vector.
\r
61 figure2.draw(new Color(COLOR_R, COLOR_G, COLOR_B)); // Drawing the rectangle with a designated color.
\r
66 } //exit a program when the escape key is pressed down.
\r