OSDN Git Service

64db8ce5767f63f1379f0882208fbae0cb0f5fe0
[psychlops/silverlight.git] / test3 / PsychlopsMain.cs
1 using Psychlops;\r
2 \r
3 namespace PsychlopsSilverlight3test\r
4 {\r
5         public class PsychlopsMain\r
6         {\r
7                 Canvas cnvs;\r
8                 Image img;\r
9                 Rectangle fixation;\r
10                 Shape shape;\r
11                 Color col;\r
12                 int isize = 100;\r
13                 double tfreq = 1;\r
14 \r
15                 public void initialize()\r
16                 {\r
17                         cnvs = new Canvas(500, 500);\r
18                         img = new Image(isize * 2, isize * 2);\r
19                         fixation = new Rectangle(10, 10);\r
20                         var poly = new Letters("日本語");\r
21                         shape = poly;\r
22                         cnvs.clear(Color.gray);\r
23                 }\r
24 \r
25                 public void each_frames()\r
26                 {\r
27                         cnvs.clear(new Color(Mouse.left.pressed() ? 0.75 : 0.25));\r
28                         col.set(Math.random(1.0));\r
29 \r
30                         fixation.centering();\r
31                         fixation.draw(Color.red);\r
32 \r
33                         Figures.drawGabor(ref img, 20, 10, 1, 0, cnvs.frame * 2.0 * Math.PI / tfreq / 60);\r
34                         //Figures.drawGaussian(ref img, 20, 1);\r
35                         //Figures.drawGrating(10, 1, 2, cnvs.frame * 2.0 * Math.PI / tfreq / 60);\r
36                         img.centering(Mouse.position);\r
37                         img.draw();\r
38 \r
39                         shape.centering(Mouse.position);\r
40                         shape.draw(Color.red);\r
41                         if (Keyboard.spc.pressed()) cnvs.var(Mouse.x, 100, 100);\r
42 \r
43                         cnvs.flip();\r
44                 }\r
45         }\r
46 }\r