OSDN Git Service

Merge branch 'master' of git.sourceforge.jp:/gitroot/psychlops/silverlight
authorunknown <hskwk@PSYT-PAUSE.(none)>
Thu, 5 Aug 2010 04:22:46 +0000 (13:22 +0900)
committerunknown <hskwk@PSYT-PAUSE.(none)>
Thu, 5 Aug 2010 04:22:46 +0000 (13:22 +0900)
1  2 
test4/PsychlopsMain.cs

diff --combined test4/PsychlopsMain.cs
@@@ -1,10 -1,7 +1,10 @@@
 -using Psychlops;\r
 +\r
 +/*\r
 +using Psychlops;\r
  \r
  namespace PsychlopsSilverlight4test\r
  {\r
 +      \r
  \r
        public class PsychlopsMain\r
        {\r
  \r
                public void psychlops_main()\r
                {\r
-                       throw new System.Exception("Speed");\r
                        //DotNumberS = new Psychlops.Widgets.Slider("test", new Interval(10, 500));\r
                        //Independent ind = new Independent();\r
  \r
                        cnvs = new Canvas(500, 500);\r
  \r
-                       //Image img = new Image(20, 20);\r
-                       //img.field(delegate(int x, int y) { return new Color(Math.sin(x + y)); });\r
+                       Image img = new Image(100, 100);\r
+                       img.field(delegate(int x, int y) { return new Color(0.5 + 0.5 * Math.sin(x + y)); });\r
+                       Image img2 = new Image(100, 100);\r
+                       img2.field(delegate(int x, int y) { return new Color(0.5 + 0.5 * Math.sin(x + y)); });\r
                        /*\r
                        for (int x = 0; x < 20; x++)\r
                        {\r
  //                                    img.pix(x, y, new Color(Math.sin(x + y)));\r
                                }\r
                        }\r
 -                       * */\r
  \r
  \r
                        //Declare background dots and target\r
                        Rectangle[] BGDot = new Rectangle[2048];\r
                        for(int i=0; i<2048; i++){\r
-                       BGDot[i]=new Rectangle();\r
+                               BGDot[i]=new Rectangle();\r
                        }\r
                        Rectangle[] Target= new Rectangle[10];\r
                        for(int i=0; i<10; i++){\r
-                       Target[i]=new Rectangle();\r
+                               Target[i]=new Rectangle();\r
                        }\r
  \r
  \r
  \r
                        //Initialize positions of background dots\r
                        for(int i=0; i<2048; i++){\r
-                       t=2.0*Math.PI*Math.random(1.0);\r
-                       p=2.0*Math.PI*Math.random(1.0);\r
-                       DotX[i]=t;\r
-                       DotY[i]=p;\r
\r
-                       x=BGRadii*Math.cos(t)*Math.cos(p);\r
-                       y=BGRadii*Math.sin(t)*Math.cos(p);\r
-                       BGDot[i].set(BGSize, BGSize);\r
-                       BGDot[i].centering().shift(x,y);\r
+                               t=2.0*Math.PI*Math.random(1.0);\r
+                               p=2.0*Math.PI*Math.random(1.0);\r
+                               DotX[i]=t;\r
+                               DotY[i]=p;\r
\r
+                               x=BGRadii*Math.cos(t)*Math.cos(p);\r
+                               y=BGRadii*Math.sin(t)*Math.cos(p);\r
+                               BGDot[i].set(BGSize, BGSize);\r
+                               BGDot[i].centering().shift(x,y);\r
                        }\r
  \r
                        //Initialize positions of targets\r
                        for(int i=0; i<10; i++)Target[i].set(TargetSize, TargetSize);\r
  \r
                        double COS, SIN;\r
\r
+                       DotNumber = 100;\r
                        //Main stimulus loop\r
                        while(true){\r
-                       //Clear the main window\r
-                       cnvs.clear(Color.black);\r
\r
\r
-                       temp=Axis/360*2*Math.PI;\r
-                       COS=Math.cos(temp);\r
-                       SIN=Math.sin(temp);\r
\r
-                       //Calculate positions of background dots and set them\r
-                       for(int i=0; i<DotNumber; i++){\r
-                       //Calculate in polar coordinate\r
-                       t=DotX[i]+2.0*Math.PI*thetaSpeed/360.0;\r
-                       p=DotY[i];\r
\r
-                       //Save current position\r
-                       DotX[i]=t;\r
\r
-                       //Convert to Decartes coordinate\r
-                       x=BGRadii*Math.cos(t)*Math.cos(p);\r
-                       y=BGRadii*Math.sin(t)*Math.cos(p);\r
-                       z=BGRadii*Math.sin(p);\r
-                       xx=x;\r
-                       yy=SIN*y+COS*z;\r
\r
-                       //Set Dotsize and Draw them\r
-                       BGDot[i].set(BGSize, BGSize);\r
-                       BGDot[i].centering().shift(xx,yy);\r
-                       BGDot[i].draw( Color.blue);\r
-                       }\r
\r
-                       //Calculate positions of targets and set them\r
-                       temp=Rotate*2*Math.PI/360.0;\r
-                       cnvs.msg(TargetNumber.ToString(), 0, 30);\r
-                       for (int i = 0; i < 5; i++)\r
-                       {\r
-                               cnvs.msg(i.ToString(), 50+50*i, 30);\r
-                               t = 2.0 * Math.PI/TargetNumber;\r
-                               x = 10.0 * i;//TargetEcce*Math.cos(i*t+temp);\r
-                               y = 10.0 * i;//TargetEcce*Math.sin(i*t+temp);\r
-                               Target[i].centering().shift(x,y);\r
-                               Target[i].fill = Color.yellow;\r
-                               Target[i].draw();\r
-                       }\r
\r
-                       //img.centering().draw();\r
-                       //Reflect drawing at the next frame;\r
-                       cnvs.flip();\r
-               }\r
\r
+                               //Clear the main window\r
+                               cnvs.clear(Color.green);\r
\r
\r
+                               temp=Axis/360*2*Math.PI;\r
+                               COS=Math.cos(temp);\r
+                               SIN=Math.sin(temp);\r
\r
+                               //Calculate positions of background dots and set them\r
+                               for(int i=0; i<DotNumber; i++){\r
+                                       //Calculate in polar coordinate\r
+                                       t=DotX[i]+2.0*Math.PI*thetaSpeed/360.0;\r
+                                       p=DotY[i];\r
\r
+                                       //Save current position\r
+                                       DotX[i]=t;\r
\r
+                                       //Convert to Decartes coordinate\r
+                                       x=BGRadii*Math.cos(t)*Math.cos(p);\r
+                                       y=BGRadii*Math.sin(t)*Math.cos(p);\r
+                                       z=BGRadii*Math.sin(p);\r
+                                       xx=x;\r
+                                       yy=SIN*y+COS*z;\r
\r
+                                       //Set Dotsize and Draw them\r
+                                       BGDot[i].set(BGSize, BGSize);\r
+                                       BGDot[i].centering().shift(xx,yy);\r
+                                       BGDot[i].draw( Color.blue);\r
+                               }\r
  \r
+                               //Calculate positions of targets and set them\r
+                               temp=Rotate*2*Math.PI/360.0;\r
+                               cnvs.msg(TargetNumber.ToString(), 0, 30);\r
+                               for (int i = 0; i < 5; i++)\r
+                               {\r
+                                       cnvs.msg(i.ToString(), 50+50*i, 30);\r
+                                       t = 2.0 * Math.PI/TargetNumber;\r
+                                       x = 10.0 * i;//TargetEcce*Math.cos(i*t+temp);\r
+                                       y = 10.0 * i;//TargetEcce*Math.sin(i*t+temp);\r
+                                       Target[i].centering().shift(x,y);\r
+                                       Target[i].fill = Color.yellow;\r
+                                       Target[i].draw();\r
+                               }\r
  \r
+                               img.centering().draw();\r
+                               img2.centering().draw();\r
+                               //Reflect drawing at the next frame;\r
+                               cnvs.flip();\r
+                       }\r
                }\r
        }\r
  \r
@@@ -184,9 -181,9 +183,9 @@@ namespace PsychlopsSilverlight4tes
  \r
  }\r
  \r
 -*/\r
  \r
 -/*\r
 + * \r
 + * */\r
  \r
  \r
  using Psychlops;\r
@@@ -217,7 -214,6 +216,7 @@@ namespace Psychlop
  \r
  \r
  \r
 +\r
  namespace PsychlopsSilverlight4test\r
  {\r
  \r
        }\r
  \r
  }\r
 - * \r
 - * */\r
 -\r
 -\r