X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=test4%2FPsychlopsMain.cs;h=b93f0d8b06e82b56e46a84f33c40c21960c40ff7;hb=a4fbd5c94992b9e0e3e57d550706ba6b05bfd6a6;hp=b9b3d5762b451a8a8522472d579bf5ef886628ad;hpb=c07b32733b2c41afbef57da474b9c7a9e5c0e048;p=psychlops%2Fsilverlight.git diff --git a/test4/PsychlopsMain.cs b/test4/PsychlopsMain.cs index b9b3d57..b93f0d8 100644 --- a/test4/PsychlopsMain.cs +++ b/test4/PsychlopsMain.cs @@ -2,22 +2,170 @@ namespace PsychlopsSilverlight4test { + public class PsychlopsMain { + + Psychlops.Canvas cnvs; + int i; + double x, y, z, t, p, temp, xx, yy; + + //Set Target Initial Value + double TargetEcce = 100.0, TargetSize = 5.0, TargetNumber = 5, Rotate = 0.0; + + //Set Background Initial Value + double Axis = 0.0, BGRadii = 150, BGSize = 5.0; + Psychlops.Widgets.Slider thetaSpeed, DotNumber; + Image img; + + + public void psychlops_main() { - var elem = Psychlops.Widgets.Browser.Element.byID("TheInput"); + cnvs = new Canvas(500, 500); + + + img = new Image("Resources/logo.png"); + + Interval rng = new Interval(); + thetaSpeed = new Psychlops.Widgets.Slider("Label", -10 <= rng <= 10, 3.0); + DotNumber = new Psychlops.Widgets.Slider("DotNum", 0 <= rng <= 100, 50.0); + + //Declare background dots and target + Rectangle[] BGDot = new Rectangle[2048]; + for(int i=0; i<2048; i++){ + BGDot[i]=new Rectangle(); + } + Rectangle[] Target= new Rectangle[10]; + for(int i=0; i<10; i++){ + Target[i]=new Rectangle(); + } + + + //Declare Matrix to keep back ground dots' coordinate value + double[] DotX=new double[2048]; + double[] DotY = new double[2048]; + + + //Set Independent variables to manipulate + + + //Initialize positions of background dots + for(int i=0; i<2048; i++){ + t=2.0*Math.PI*Math.random(1.0); + p=2.0*Math.PI*Math.random(1.0); + DotX[i]=t; + DotY[i]=p; + + x=BGRadii*Math.cos(t)*Math.cos(p); + y=BGRadii*Math.sin(t)*Math.cos(p); + BGDot[i].set(BGSize, BGSize); + BGDot[i].centering().shift(x,y); + } + + //Initialize positions of targets + for(int i=0; i<10; i++)Target[i].set(TargetSize, TargetSize); - Canvas window = new Canvas(500,500); + double COS, SIN; + //DotNumber = 200; + //Main stimulus loop + while(true){ + //Clear the main window + cnvs.clear(); - var figure = new Rectangle(); - figure.set( 100, 100 ); - figure.fill = new Color(1.0, 0.0, 0.0); + + temp=Axis/360*2*Math.PI; + COS=Math.cos(temp); + SIN=Math.sin(temp); + + //Calculate positions of background dots and set them + for(int i=0; i