OSDN Git Service

123
[psychlops/silverlight.git] / test3 / PsychlopsMain.cs
index 1991b9d..bbaf192 100644 (file)
@@ -1,5 +1,30 @@
 using Psychlops;\r
 \r
+namespace Psychlops\r
+{\r
+\r
+       public class RandomDots\r
+       {\r
+               Rectangle dot;\r
+               public Point[] cood;\r
+               public RandomDots()\r
+               {\r
+                       cood = new Point[100];\r
+                       dot = new Rectangle(5, 5);\r
+               }\r
+               public void draw()\r
+               {\r
+                       dot.fill = Color.white;\r
+                       foreach (Point p in cood)\r
+                       {\r
+                               dot.centering(p).draw();\r
+                       }\r
+               }\r
+       }\r
+\r
+}\r
+\r
+\r
 namespace PsychlopsSilverlight3test\r
 {\r
 \r
@@ -13,6 +38,7 @@ namespace PsychlopsSilverlight3test
                int isize = 100;\r
                double tfreq = 1;\r
                int frames;\r
+               RandomDots dots;\r
 \r
                public void psychlops_main()\r
                {\r
@@ -20,8 +46,8 @@ namespace PsychlopsSilverlight3test
                        img = new Image(isize * 2, isize * 2);\r
                        fixation = new Rectangle(10, 10);\r
                        fixation.fill = Color.red;\r
-                       var poly = new Rectangle(100, 100);\r
-                       //var poly = new Letters("日本語");\r
+                       //var poly = new Rectangle(100, 100);\r
+                       var poly = new Letters("日本語");\r
                        //var poly = new Polygon(); poly.append(0, 100); poly.append(-100, 0); poly.append(0, -100); poly.append(100, 0);\r
                        //var poly = new Ellipse(100, 100);\r
                        //var poly = new Line(0,0,100, 0);\r
@@ -29,6 +55,11 @@ namespace PsychlopsSilverlight3test
                        poly.stroke = new Stroke { color = Color.yellow, thick = 1 };\r
                        shape = poly;\r
 \r
+                       var rng = new Interval();\r
+                       var slider = new Psychlops.Widgets.Slider("tesrt", 0 <= rng <= 5);\r
+\r
+                       dots = new RandomDots();\r
+\r
 \r
                        while(true) {\r
                                frames++;\r
@@ -41,7 +72,7 @@ namespace PsychlopsSilverlight3test
 \r
                                //Figures.drawGabor(ref img, 20, 100, 1, 0, frames * 2.0 * Math.PI / tfreq / 60);\r
                                //Figures.drawGaussian(ref img, 20, 1);\r
-                               Figures.drawGrating(ref img, 100, 100, 20, 1, 2, frames * 2.0 * Math.PI / tfreq / 60);\r
+                               Figures.drawGrating(ref img, 30, 30, 20, 1, 2, frames * 2.0 * Math.PI / tfreq / 60);\r
                                img.centering(Mouse.position);\r
                                img.draw();\r
 \r
@@ -49,11 +80,17 @@ namespace PsychlopsSilverlight3test
                                shape.draw();\r
                                if (Keyboard.spc.pressed()) cnvs.var(Mouse.x, 100, 100);\r
 \r
-                               cnvs.var(frames, 10, 20);\r
+                               cnvs.var(frames, 20, 20);\r
+                               slider.value = frames/100.0;\r
 \r
                                fixation.shift(100,100);\r
                                fixation.draw(new Stroke(Color.blue, 3));\r
-                               AppState.statusBar = "dhdyr";\r
+\r
+                               for (int i=0; i<dots.cood.Length; i++)\r
+                               {\r
+                                       dots.cood[i].set(Math.random(500), Math.random(500));\r
+                               }\r
+                               dots.draw();\r
 \r
                                cnvs.flip();\r
                        }\r