X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=test4%2FPsychlopsMain.cs;h=f5df20f5ae8f495158ec670704cfbdcbe95205d5;hb=9f47dcd91507b95984913358b5b313f1e304a091;hp=d33eb149eaadea2591768e58401599d13073bbfe;hpb=8d02b5d184f6209f65920c2e63bba907e2221f75;p=psychlops%2Fsilverlight.git diff --git a/test4/PsychlopsMain.cs b/test4/PsychlopsMain.cs index d33eb14..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(); } @@ -108,9 +192,10 @@ namespace PsychlopsSilverlight4test } } +*/ -/* -using Psychlops; + +/*using Psychlops; namespace PsychlopsSilverlight4test { @@ -156,7 +241,7 @@ namespace PsychlopsSilverlight4test } -*/ + /* @@ -195,19 +280,24 @@ namespace PsychlopsSilverlight4test { Canvas cnvs; Image img; - Rectangle fixation; + Ellipse fixation; Shape shape; Color col; int isize = 100; double tfreq = 1; int frames; RandomDots dots; + Group g; public void psychlops_main() { cnvs = new Canvas(500, 500); + g = new Group(); img = new Image(isize * 2, isize * 2); - fixation = new Rectangle(10, 10); + Figures.drawGrating(ref img, 200, 200, 20, 1, 2, frames * 2.0 * Math.PI / tfreq / 60); + g.append(img); + g.rotation = 50; + fixation = new Ellipse(10, 10); fixation.fill = Color.red; //var poly = new Rectangle(100, 100); var poly = new Letters("日本語"); @@ -219,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(); @@ -228,38 +318,92 @@ namespace PsychlopsSilverlight4test { frames++; + cnvs.clear(new Color(Mouse.left.pressed() ? 0.75 : 0.5)); col.set(Math.random(1.0)); - fixation.centering(); + /*if (frames % 2 == 0) + { + fixation.centering().shift(100, 100); + fixation.draw(new Stroke(Color.blue, 3)); + }* / + + fixation.centering().shift(slider, 0); fixation.draw(Color.red); //Figures.drawGabor(ref img, 20, 100, 1, 0, frames * 2.0 * Math.PI / tfreq / 60); //Figures.drawGaussian(ref img, 20, 1); - Figures.drawGrating(ref img, 200, 200, 20, 1, 2, frames * 2.0 * Math.PI / tfreq / 60); - img.centering(Mouse.position); - img.draw(); + //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; 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; - fixation.shift(100, 100); - fixation.draw(new Stroke(Color.blue, 3)); + /*if (frames % 2 != 0) + { + fixation.shift(100, 100); + fixation.draw(new Stroke(Color.green, 3)); + }* / 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(); } } } +} + +**/ + + +/* + +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