X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=test4%2FPsychlopsMain.cs;h=71d18a5ba3691e5f1c437f93ed47919f48d9cadd;hb=9f8568031d705f64bd1401dd20f24c282c48ea18;hp=f5df20f5ae8f495158ec670704cfbdcbe95205d5;hpb=9f47dcd91507b95984913358b5b313f1e304a091;p=psychlops%2Fsilverlight.git diff --git a/test4/PsychlopsMain.cs b/test4/PsychlopsMain.cs index f5df20f..71d18a5 100644 --- a/test4/PsychlopsMain.cs +++ b/test4/PsychlopsMain.cs @@ -1,409 +1,105 @@  using Psychlops; -namespace PsychlopsSilverlight4test +namespace PsychlopsSilverlightApp { public class PsychlopsMain { - Psychlops.Widgets.Slider rect_size; - Psychlops.Widgets.Slider rect_lum; - Psychlops.Widgets.Slider bg_lum; - - - void RectLuminance() - { - Canvas display = new Canvas(Canvas.window); - Interval rng = new Interval(); - rect_size = new Psychlops.Widgets.Slider("Rect Size", 1 < rng < 500, 10.0); - rect_lum = new Psychlops.Widgets.Slider("Rect Luminance", 0.0 <= rng <= 1.0, 0.1); - bg_lum = new Psychlops.Widgets.Slider("BG Luminance", 0.0 <= rng <= 1.0, 0.1); - Ellipse drawee = new Ellipse(100, 100); - display.showFPS(); - display.watchFPS(); - - Rectangle rect = new Rectangle(rect_size, rect_size); - rect.centering(); - - - Clock before = new Clock(), after = new Clock(); - while (!Keyboard.esc.pushed()) - { - Display.clear(bg_lum); - rect.resize(rect_size, rect_size).draw(rect_lum); - after.update(); - display.var((after - before).at_msec(), 100, 100, Color.green); - display.var((after - before).at_msec(), 100, 200, Color.green); - drawee.centering().shift(Math.random(100), 0); - drawee.draw(Color.black); - Display.flip(); - } - - } - - - public void psychlops_main() - { - RectLuminance(); - } - - - } - -} - - - - - - - - - - - -/* - using Psychlops; - -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() { - cnvs = new Canvas(500, 500); - - Psychlops.Solver.BinomialLikelihood.showWindow(Math.cumulativeNormalDistibution); - - - 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); + Psychlops.ColorSpaces.CIERGB rgb = new Psychlops.ColorSpaces.CIERGB { R = 1, G = 1, B = 1 }; + var xyz = rgb.convertToCIEXYZ(); - //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); - } + Canvas window = new Canvas(300,300); - //Initialize positions of targets - for(int i=0; i<10; i++)Target[i].set(TargetSize, TargetSize); + Rectangle figure = new Rectangle(); + figure.set(100, 100); + figure.fill = new Color(1, 1, 1); + figure.centering().shift(0, 0); - double COS, SIN; - //DotNumber = 200; - //Main stimulus loop - while(true){ - //Clear the main window - cnvs.clear(); + int frame = 0; + int looming_direction = 1, motion_dir = 1; - 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