OSDN Git Service

flip ok
[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                 int frames;\r
15 \r
16                 public System.Collections.Generic.IEnumerator<int> psychlops_main()\r
17                 {\r
18                         cnvs = new Canvas(500, 500);\r
19                         img = new Image(isize * 2, isize * 2);\r
20                         fixation = new Rectangle(10, 10);\r
21                         var poly = new Letters("日本語");\r
22                         shape = poly;\r
23                         cnvs.clear(Color.gray);\r
24 \r
25                         while(true) {\r
26                                 frames++;\r
27                                 \r
28                                 cnvs.clear(new Color(Mouse.left.pressed() ? 0.75 : 0.25));\r
29                                 col.set(Math.random(1.0));\r
30 \r
31                                 fixation.centering();\r
32                                 fixation.draw(Color.red);\r
33 \r
34                                 Figures.drawGabor(ref img, 20, 100, 1, 0, frames * 2.0 * Math.PI / tfreq / 60);\r
35                                 //Figures.drawGaussian(ref img, 20, 1);\r
36                                 //Figures.drawGrating(10, 1, 2, cnvs.frame * 2.0 * Math.PI / tfreq / 60);\r
37                                 img.centering(Mouse.position);\r
38                                 img.draw();\r
39 \r
40                                 shape.centering(Mouse.position);\r
41                                 shape.draw(Color.red);\r
42                                 if (Keyboard.spc.pressed()) cnvs.var(Mouse.x, 100, 100);\r
43 \r
44                                 cnvs.var(frames, 10, 20);\r
45 \r
46                                 yield return 3;\r
47                         }\r
48                 }\r
49         }\r
50 \r
51 }\r