X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=test4%2FPsychlopsMain.cs;h=f5df20f5ae8f495158ec670704cfbdcbe95205d5;hb=9f47dcd91507b95984913358b5b313f1e304a091;hp=c88008552f0a9baed898e53bd5e86732c3d24463;hpb=dd11e3eedbf6f6fa5804842100af871566142d34;p=psychlops%2Fsilverlight.git diff --git a/test4/PsychlopsMain.cs b/test4/PsychlopsMain.cs index c880085..f5df20f 100644 --- a/test4/PsychlopsMain.cs +++ b/test4/PsychlopsMain.cs @@ -1,4 +1,70 @@ -/*using Psychlops; + +using Psychlops; + +namespace PsychlopsSilverlight4test +{ + + 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 { @@ -14,12 +80,25 @@ namespace PsychlopsSilverlight4test double TargetEcce = 100.0, TargetSize = 5.0, TargetNumber = 5, Rotate = 0.0; //Set Background Initial Value - double DotNumber = 50, thetaSpeed = 3.0, Axis = 0.0, BGRadii = 150, BGSize = 5.0; + 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); + //Declare background dots and target Rectangle[] BGDot = new Rectangle[2048]; for(int i=0; i<2048; i++){ @@ -56,11 +135,11 @@ namespace PsychlopsSilverlight4test for(int i=0; i<10; i++)Target[i].set(TargetSize, TargetSize); double COS, SIN; - DotNumber = 200; + //DotNumber = 200; //Main stimulus loop while(true){ //Clear the main window - cnvs.clear(Color.green); + cnvs.clear(); temp=Axis/360*2*Math.PI; @@ -101,6 +180,11 @@ namespace PsychlopsSilverlight4test Target[i].draw(); } + img.centering(Mouse.position).draw(); + + cnvs.var(Mouse.position.x, 100, 100); + cnvs.var(Mouse.position.y, 100, 140); + //Reflect drawing at the next frame; cnvs.flip(); } @@ -110,6 +194,7 @@ namespace PsychlopsSilverlight4test } */ + /*using Psychlops; namespace PsychlopsSilverlight4test @@ -156,10 +241,10 @@ namespace PsychlopsSilverlight4test } -*/ +/* using Psychlops; namespace Psychlops @@ -224,7 +309,7 @@ namespace PsychlopsSilverlight4test shape = poly; var rng = new Interval(); - var slider = new Psychlops.Widgets.Slider("tesrt", 0 <= rng <= 5); + var slider = new Psychlops.Widgets.Slider("tesrt", -100 <= rng <= 100); dots = new RandomDots(); @@ -241,9 +326,9 @@ namespace PsychlopsSilverlight4test { fixation.centering().shift(100, 100); fixation.draw(new Stroke(Color.blue, 3)); - }*/ + }* / - fixation.centering(); + fixation.centering().shift(slider, 0); fixation.draw(Color.red); //Figures.drawGabor(ref img, 20, 100, 1, 0, frames * 2.0 * Math.PI / tfreq / 60); @@ -251,26 +336,27 @@ namespace PsychlopsSilverlight4test //Figures.drawGrating(ref img, 200, 200, 20, 1, 2, frames * 2.0 * Math.PI / tfreq / 60); //img.centering(Mouse.position); //img.draw(); - //g.centering(Mouse.position).draw(); - //g.rotation += 1; + g.centering(Mouse.position).draw(); + g.rotation += 1; shape.centering(Mouse.position).shift(100, 0); shape.draw(); if (Keyboard.spc.pressed()) cnvs.var(Mouse.x, 100, 100); cnvs.var(frames, 0, 20); - slider.value = frames / 100.0; + //slider.value = frames / 100.0; /*if (frames % 2 != 0) { fixation.shift(100, 100); fixation.draw(new Stroke(Color.green, 3)); - }*/ + }* / - for (int i = 0; i < dots.cood.Length/4; i++) + for (int i = 0; i < dots.cood.Length; i++) { dots.cood[i].set(Math.random(500), Math.random(500)); } + cnvs.var((double)slider, 200, 200); dots.draw(); cnvs.flip(); @@ -279,3 +365,45 @@ namespace PsychlopsSilverlight4test } } +**/ + + +/* + +using Psychlops; +namespace PsychlopsSilverlight4test +{ + + public class PsychlopsMain + { + Canvas cnvs; + Rectangle[] rect; + int n; + + public void psychlops_main() + { + n = 1; + cnvs = new Canvas(500, 500); + rect = new Rectangle[n]; + for (int i = 0; i < n; i++) + { + rect[i] = new Rectangle(10, 10); + rect[i].fill = Color.red; + } + Interval rng = new Interval(); + var slider = new Psychlops.Widgets.Slider("Label", -100 <= rng <= 100); + + while (true) + { + cnvs.clear(); + for (int i = 0; i < n; i++) + { + rect[i].centering().shift(slider * i*3, i*3).draw(); + } + cnvs.flip(); + } + } + } +} + +*/ \ No newline at end of file