1 #include <psychlops.h>
\r
2 using namespace Psychlops; // Initially developed with Psychlops Win32 1.5.3 / 20110311
\r
5 std::string error_message;
\r
7 void loadGLSL(std::stringstream &buf, const std::string path)
\r
11 is.open(path.c_str(), std::ifstream::in);
\r
13 Widgets::Dialog::alert(L"File was not found, or failed to read for some reasons.");
\r
24 os.open("GLSLTesterErrorLog.txt");
\r
26 Widgets::Dialog::alert(L"File was not found, or failed to read for some reasons.");
\r
29 os << error_message;
\r
32 const char *default_field_glsl =
\r
35 "pix(red,0.0,0.0,1.0); }";
\r
37 Figures::ShaderField field;
\r
38 char *source_field = (char*)default_field_glsl;
\r
39 void cacheShaderField(const std::string path)
\r
41 std::stringstream buf;
\r
42 loadGLSL(buf, path);
\r
45 field.setFunction(buf.str().c_str());
\r
46 field.cache(*Display::the_canvas);
\r
47 error_message.clear();
\r
48 } catch (Exception e) {
\r
49 error_message = e.getErrorString();
\r
51 } catch (Exception *e) {
\r
52 error_message = e->getErrorString();
\r
57 const char *default_image_glsl =
\r
58 "in float dr, dg, db, da;"
\r
60 "vec4 d = vec4(dr, dg, db, da);"
\r
61 "pix(getPix()+d);}";
\r
62 Figures::ShaderImage2 image;
\r
63 char *source_image = (char*)default_image_glsl;
\r
64 Image shadered_image, dummy_image;
\r
65 void cacheShaderImage(const std::string path)
\r
67 std::stringstream buf;
\r
68 loadGLSL(buf, path);
\r
70 image.setFunction(buf.str().c_str());
\r
71 image.cache(*Display::the_canvas);
\r
72 error_message.clear();
\r
73 } catch (Exception e) {
\r
74 error_message = e.getErrorString();
\r
76 } catch (Exception *e) {
\r
77 error_message = e->getErrorString();
\r
94 pages = new Image[100];
\r
105 const int SHADER_ARG_MAX = 16;
\r
109 void psychlops_main() {
\r
111 Canvas cnvs(1024, 768, Canvas::window);
\r
114 Widgets::StackPanel buttons;
\r
115 Widgets::Button loader[3];
\r
116 loader[0].set(L"Load GLSL/field", 18);
\r
117 buttons.append(&loader[0]);
\r
118 loader[1].set(L"Load GLSL/image", 18);
\r
119 buttons.append(&loader[1]);
\r
120 loader[2].set(L"Load PNG image", 18);
\r
121 buttons.append(&loader[2]);
\r
122 buttons.setWidth(150);
\r
123 buttons.alignLeft(cnvs.getWidth() - 152).alignTop(cnvs.getHeight() - 18*4);
\r
124 Drawable::billboard.append(buttons);
\r
126 std::string path[3];
\r
127 Letters pathname[3];
\r
131 double Z[SHADER_ARG_MAX];
\r
132 for(int i=0; i<SHADER_ARG_MAX; i++) Z[i] = 0.0;
\r
135 Widgets::Slider slider;
\r
136 slider.set("test", Interval(0,10), 1, 0.1);
\r
138 Font::default_font.family[0] = L"meiryo";
\r
140 let.font.size = 30;
\r
141 let.fill = Color::green;
\r
142 let.setString("
\93ú
\96{
\8cê ");
\r
146 path[1] = File::decodePath("%APP%shader_sample/pallet.txt");//Widgets::Dialog::getOpenFileName();
\r
147 cacheShaderImage(path[1]);
\r
148 path[1].append(" OK ");
\r
149 pathname[1].fill = Color::yellow;
\r
152 for(int i=0; i<image.orig_args.size(); i++) {
\r
153 //tmps.assign(image.orig_args[i]).append(" ");
\r
154 //sliders[i].slide.label.setString(tmps.c_str());
\r
155 //sliders[i].active = true;
\r
157 for(int i=image.orig_args.size(); i<SHADER_ARG_MAX; i++) {
\r
158 //sliders[i].active = false;
\r
160 } catch(Exception e) {
\r
161 path[1] = e.to_s();
\r
162 pathname[1].fill = Color::red;
\r
165 pathname[1].setString(path[1].c_str());
\r
168 path[2] = File::decodePath("%APP%flower_png24.png");//Widgets::Dialog::getOpenFileName();
\r
169 dummy_image.load(path[2]);
\r
170 shadered_image.load(path[2]);
\r
171 shadered_image.convert(Image::RGBA);
\r
172 shadered_image.rect(Psychlops::Rectangle(100,300),Color::white);
\r
173 shadered_image.cache();
\r
174 path[2].append(" OK ");
\r
175 pathname[2].fill = Color::yellow;
\r
177 } catch(Exception e) {
\r
178 path[2] = e.to_s();
\r
179 pathname[2].fill = Color::red;
\r
182 pathname[2].setString(path[2].c_str());
\r
184 image.params.set(16,16);
\r
185 image.params.clear(Color::blue);
\r
186 image.params.cache();
\r
190 while(!Input::get(Keyboard::esc)) {
\r
193 if(Keyboard::one.pushed()) l = 0;
\r
194 if(Keyboard::two.pushed()) l = 0.2;
\r
195 if(Keyboard::three.pushed()) l = 0.4;
\r
196 if(Keyboard::four.pushed()) l = 0.6;
\r
197 if(Keyboard::five.pushed()) l = 0.8;
\r
198 if(Keyboard::six.pushed()) l = 1;
\r
201 shadered_image.rect(Psychlops::Rectangle(100,300),Color(l));
\r
202 shadered_image.cache();
\r
203 shadered_image.centering();
\r
204 image.draw(shadered_image, Z, 3, *Display::the_canvas);
\r
206 for(int i=0; i<3; i++) {
\r
207 pathname[i].font.size = 15;
\r
208 pathname[i].locate(loader[i].area.getLeft() - 20, loader[i].area.getBottom()-2).align = Letters::TEXT_ALIGN_RIGHT;
\r
209 pathname[i].draw();
\r
211 if(!error_message.empty()) cnvs.msg(error_message, 200,20,Color::yellow);
\r
213 slider.centering().shift(-200,-300).draw();
\r
214 let.centering().shift(-300,-300).draw();
\r
216 if(AppState::shouldBeClose) return;
\r
225 / Shape from Shading
\r
226 // Ramachandran, V.S. (1988) Perception of shape from shading Nature 331, 163-166.
\r
228 //// Include Psychlops Package
\r
229 #include <psychlops.h>
\r
230 #include <platform/win32/psychlops_app_tweak_Win32.h>
\r
231 using namespace Psychlops; // Initially developed with Psychlops Win32 1.5.3 / 20110311
\r
237 ///+ Stimulus drawing function
\r
238 //// A function for stimulus drawing (main body)
\r
239 void ShapeFromShading()
\r
241 Canvas display(Canvas::window); //Prepare drawing window
\r
243 HWND d = Psychlops::DebugTweakTool::getRawWindowHandle(display);
\r
246 //// Declare and initi
\r
247 Widgets::SelectBox dummy(100);
\r
248 Widgets::SelectBox chr[2];
\r
249 char alphabet[4] = { ' ', ' ', '\0', '\0' };
\r
250 for(int i=0; i<2; i++) {
\r
252 for(int c=0; c<26; c++) {
\r
253 alphabet[0] = c+65+i*32;
\r
254 chr[i].append(alphabet);
\r
256 chr[i].centering().shift(i*100,0);
\r
257 chr[i].setSelected(0);
\r
262 Widgets::Dial slider;
\r
263 //slider.link(lim, rng, 0.1);
\r
264 //slider.set("luminance", 0<=rng<=1, 0.125);
\r
265 //slider.centring();
\r
267 char initial[4] = { ' ', ' ', '\0', '\0' };
\r
271 //// Displaying stimuli
\r
272 while(!Input::get(Keyboard::esc)) {
\r
274 display.clear(Color(slider));
\r
275 for(int i=0; i<2; i++) chr[i].draw();
\r
277 initial[0] = chr[0].getSelected()+65;
\r
278 initial[1] = chr[1].getSelected()+97;
\r
279 display.msg(initial, 300,300);
\r
286 ///- Stimulus drawing function
\r
289 ///+ Main function for demo circumstances
\r
290 void psychlops_main() {
\r
291 ///+ Demo circumstances
\r
292 //// Spells for run demonstration circumstances
\r
294 p.setDesign(Procedure::DEMO); //Designate that this is a demo.
\r
295 p.setProcedure(ShapeFromShading); //The argument name is a name of drawing function.
\r
297 ///- Demo circumstances
\r
299 ///- Main function for demo circumstances
\r
304 #include <psychlops.h>
\r
305 using namespace Psychlops;
\r
308 void loadImageSequence(Image *target, int number, const std::string &base_path, const std::string &prefix, const std::string &postfix)
\r
310 std::stringstream filename;
\r
311 for(int i=0; i<number; i++) {
\r
313 filename << base_path << "/" << prefix << i << postfix;
\r
314 target[i].load(filename.str());
\r
318 void psychlops_main() {
\r
319 Canvas window(Canvas::window, Display::secondary);
\r
320 //Canvas window(Canvas::fullscreen, Display::secondary);
\r
321 //Canvas window(1024,768,32,60.0, Display::secondary);
\r
325 // Trigger trigger(new Devices::AnalogInput_NIDAQmx);
\r
327 Psychlops::Rectangle rect;
\r
328 rect.set(200,100).shift(60,100);
\r
329 rect.stroke = Stroke(Color::red, 1, Stroke::SOLID);
\r
331 Widgets::Button text(L"test");
\r
332 text.centering(100,100);
\r
333 //window.eventroot.append(text);
\r
336 double v = 0, w = 100;
\r
338 Independent << v | "dfdsfdsv" | 0<=rng<=4 | 1;
\r
339 Independent.append(w).set("another", 0<=rng<=200, 2);
\r
340 Widgets::Slider slider(Independent["dfdsfdsv"]), slider2(Independent[1]);
\r
341 slider.centering();
\r
342 slider2.centering().shift(100,100);
\r
345 loadImageSequence(img, 5, "D:\\Users\\hskwk\\Documents\\Develop\\Psychlops\\cpp\\trunk\\win32gl\\test\\", "D1_low", ".png");
\r
349 Psychlops::Rectangle rect22(100,1000);
\r
350 rect22.fill = Color::green;
\r
351 rect22.centering();
\r
353 Psychlops::Ellipse ell(200, 300);
\r
354 ell.shift(300,200);
\r
355 ell.resize(100,50);
\r
357 Widgets::SelectBox box;
\r
358 box.append(L"ABCDEFG");
\r
360 box.centering().shift(200,200);
\r
362 while(!Keyboard::esc.pushed()){
\r
363 window.clear(Color::black);
\r
364 img[(int)v].centering().draw();
\r
367 //Events::Focus fo;
\r
372 Display::ellipse(rect22, Color::green);
\r
375 window.var(Mouse::uniX,200,200);
\r
376 window.var(Mouse::uniY,200,240);
\r
380 //rect22.centering(Mouse::position).draw();
\r
381 //rect22.centering(Mouse::position).draw();
\r
382 //rect22.centering(window.mouse()).draw();
\r
385 int n = 60; //
\90ü
\82Ì
\96{
\90\94\r
386 int r = 100; //
\8aO
\90Ú
\89~
\82Ì
\94¼
\8ca
\r
387 double angle1, angle2;
\r
388 Psychlops::Point center = window.getCenter(); //
\91½
\8ap
\8c`
\82Ì
\92\86\90S
\r
389 for(int i=0; i<n; i++)
\r
391 angle1 = ( (double)i /n) *2*PI; //
\92¸
\93_
\82Ì
\8ap
\93x
\82ð
\8cv
\8eZ
\r
392 window.line( center.x + r*cos(angle1), center.y + r*sin(angle1),
\r
393 center.x, center.y,
\r
395 //
\91½
\8ap
\8c`
\82Ì
\92\86\90S
\82©
\82ç
\92¸
\93_
\82Ö
\82Ì
\91\8a\91Î
\93I
\82È
\88Ê
\92u
\82ð
\8ew
\92è
\82µ
\81A
\90ü
\82ð
\95`
\82
\r
407 #include <psychlops.h>
\r
408 using namespace Psychlops;
\r
410 const int StimKind=3;// Stimuluskind:: 1:MDC 2:TDC 3:LDC
\r
412 #define StimulusWidth 160
\r
413 #define StimulusHeight 160
\r
415 #define BlankBeforeStimulus 10
\r
416 #define StimulusDuration 10
\r
417 #define r_duration 30
\r
419 #define LineNumber 200
\r
420 #define LineWidth 2
\r
423 #define DotNumber 300
\r
426 const int SIZE_=100;
\r
428 const int ATT = 2, LAG=2, ITERATION_PER_A_CONDITION= 10;
\r
429 const int trial_max = ATT * LAG* ITERATION_PER_A_CONDITION;
\r
430 int Attribute[ATT]={0, 1};
\r
431 int SATlag[LAG] = {60,120};//{5, 10, 15, 20, 25, 30, 40, 50, 100, 150};
\r
433 unsigned int condition[trial_max];
\r
434 int result[trial_max], resultRT[trial_max];
\r
436 int condition_att[trial_max], condition_lag[trial_max],number[trial_max];
\r
437 Psychlops::Rectangle fixation,fixation2,fication3;
\r
440 Matrix StimulusFieldA(StimulusWidth, StimulusHeight), StimulusFieldB(StimulusWidth, StimulusHeight), StimulusField(StimulusWidth, StimulusHeight);
\r
441 Matrix Dot(DotNumber,3);
\r
443 const int WIDTH=1024, HEIGHT=768;
\r
444 const int StimLU=WIDTH*0.5-StimulusWidth*0.5, StimRB=HEIGHT*0.5-StimulusHeight*0.5;
\r
451 int SAT_frag = 0, SAT_counter = 0;
\r
452 int miss_trial[trial_max];
\r
456 void StimulusDraw();
\r
458 void DrawLDC(int trial_now, int attribute);
\r
459 void DrawODC(int trial_now, int attribute);
\r
460 void DrawMDC(int trial_now, int attribute);
\r
462 void Response(int trial_now);
\r
467 void psychlops_main()
\r
469 //Canvas display(Canvas::fullscreen);
\r
470 Canvas display(Canvas::window);
\r
472 display.setGammaValue(2.26459,2.29437,2.12506);//CRT_21gs_090920
\r
477 Psychlops::Rectangle blank;
\r
478 blank.set(WIDTH,HEIGHT).centering().setColor(Color::black);
\r
480 for (int i=0; i<trial_max; i++){condition[ i ] = i;}
\r
481 Math::shuffle(condition, trial_max);
\r
484 for(int i=0; i<trial_max; i++) {
\r
486 condition_att[ i ] = Attribute[ condition[ i ] %ATT];
\r
487 condition_lag[ i ] = SATlag[ (condition[ i ]/ATT) %LAG];
\r
492 //for(int i=0; i<trial_max; i++) {std::cout<<condition_att[ i ]<<" "<<condition_lag[ i ]<<std::endl;}
\r
494 while(!Keyboard::spc.pushed()) {
\r
496 Display::message("push space key to start",400,380,Color::white);
\r
502 void StimulusDraw(){
\r
503 // Stimuluskind:: 1: MDC 2: ODC 3:LDC
\r
505 fixation.set(5,5).centering().setColor(Color::yellow);
\r
506 fixation2.set(10,10).centering().setColor(Color::yellow);
\r
508 if (SAT_frag ==0){maximum = trial_max;}
\r
510 maximum = SAT_counter;
\r
511 while (!Keyboard::spc.pushed()) {
\r
512 Display::clear(0.0);
\r
513 Display::message(" Please push spc key to restart",400,380,Color::white);
\r
514 fixation.display();Display::flip();
\r
519 std::cout<<"trials = "<<maximum<<std::endl;
\r
521 for(int trial_now=0; trial_now<maximum; trial_now++){
\r
523 if (Keyboard::esc.pushed()){EXPabort();}
\r
526 for(int i=0; i<BlankBeforeStimulus; i++) {
\r
528 //Keyboard::pad1.pushed(); Keyboard::pad3.pushed();
\r
529 Display::clear(0.0);fixation.display();Display::flip();
\r
535 case 1: DrawMDC(trial_now, condition_att[trial_now]); break;
\r
536 case 2: DrawODC(trial_now, condition_att[trial_now]); break;
\r
537 case 3: DrawLDC(trial_now, condition_att[trial_now]); break;
\r
539 for(int i=0; i<condition_lag[trial_now]; i++) {
\r
540 //Keyboard::pad1.pushed(); Keyboard::pad3.pushed();
\r
541 Display::clear(0.0);fixation.display();Display::flip();
\r
546 case 1: DrawMDC(trial_now, condition_att[ miss_trial[trial_now] ]); break;
\r
547 case 2: DrawODC(trial_now, condition_att[ miss_trial[trial_now] ]); break;
\r
548 case 3: DrawLDC(trial_now, condition_att[ miss_trial[trial_now] ]); break;
\r
550 for(int i=0; i<condition_lag[ miss_trial[trial_now] ]; i++) {
\r
551 //Keyboard::pad1.pushed(); Keyboard::pad3.pushed();
\r
552 Display::clear(0.0);fixation.display();Display::flip();
\r
556 Response(trial_now);
\r
559 //
\83f
\81[
\83^
\82©
\82ç
\8e¸
\94s
\8e\8e\8ds
\82ð
\8c\9f\8dõ
\r
560 for(int trial_now=0; trial_now<trial_max; trial_now++){
\r
562 std::cout<<result[trial_now]<<std::endl;
\r
563 if (result[trial_now] == -1){SAT_frag =1;break;}
\r
566 std::cout<<"SAT_frag = "<<SAT_frag<<std::endl;
\r
567 if (SAT_frag == 0){Data_save();}
\r
568 else {Keyboard::pad5.pushed();Recondtion();}
\r
571 void Response(int trial_now){
\r
573 //Keyboard::pad1.pushed(); Keyboard::pad3.pushed();
\r
577 for(int i=0; i<r_duration; i++) {
\r
578 Display::clear(0.0);fixation2.display();Display::flip();
\r
580 if (Keyboard::esc.pushed()){EXPabort();}
\r
583 if( Keyboard::pad1.pushed()) {result[trial_now]= (1-condition_att[trial_now]); break;}// white or Leftup response
\r
584 if( Keyboard::pad3.pushed()) {result[trial_now]= (condition_att[trial_now]);break;}// black or Rightup response
\r
587 result[ miss_trial[trial_now] ] = -1;
\r
588 if( Keyboard::pad1.pushed()) {result[ miss_trial[trial_now] ]= (1-condition_att[ miss_trial[trial_now] ]); break;}// white or Leftup response
\r
589 if( Keyboard::pad3.pushed()) {result[ miss_trial[trial_now] ]= (condition_att[ miss_trial[trial_now] ]);break;}// black or Rightup response
\r
593 if (SAT_frag ==0){std::cout<<trial_now<<" condition = "<<condition_att[trial_now]<<" result = "<<result[trial_now]<<std::endl;}
\r
594 if (SAT_frag ==1){std::cout<<miss_trial[trial_now]<<" condition = "<<condition_att[miss_trial[trial_now]]<<" result = "<<result[miss_trial[trial_now]]<<std::endl;}
\r
596 if( result[trial_now] == -1 && SAT_frag ==0){
\r
597 miss_trial[SAT_counter] =trial_now;SAT_counter+=1;
\r
599 if( result[ miss_trial[trial_now] ] == -1 && SAT_frag ==1){
\r
600 miss_trial[SAT_counter] =miss_trial[trial_now];SAT_counter+=1;
\r
603 std::cout<<"SAT_counter = "<<SAT_counter<<std::endl;
\r
607 const int tmp_n= SAT_counter;
\r
608 int recondition[tmp_n];
\r
610 for (int i=0; i<SAT_counter; i++){recondition[ i ] = miss_trial[ i ];}
\r
611 if(SAT_counter >0){Math::shuffle(recondition, SAT_counter);}
\r
613 for (int i=0; i<SAT_counter; i++){miss_trial[ i ]= recondition[ i ];}
\r
622 case 1: Data::savearray("MDCline_att_%TIME_.txt", "Num\tDirection\tLag\tjudge", trial_max, number, condition_att, condition_lag,result);break;
\r
623 case 2: Data::savearray("ODCline_att_%TIME_.txt", "Num\tOrientation\tLag\tjudge", trial_max, number, condition_att, condition_lag, result);break;
\r
624 case 3: Data::savearray("LDCline_att_%TIME_.txt", "Num\tLuminance\tLag\tjudge", trial_max, number, condition_att, condition_lag,result);break;
\r
627 while(!Keyboard::spc.pushed()) {
\r
629 Display::message("thanks",500,380,Color::white);
\r
635 void DrawLDC(int trial_now, int attribute){
\r
636 int XS, YS, XE, YE;
\r
639 StimulusField=StimulusFieldA;
\r
642 for (i=1; i<LineNumber+1; i++){
\r
643 Dot(i,1)=1+rand()%(StimulusWidth-LineWidth);
\r
644 Dot(i,2)=1+rand()%(StimulusHeight-LineWidth);
\r
650 Direction=(rand()%2)*2-1;
\r
652 for(i=0; i<StimulusDuration; i++){
\r
654 //fixation.display();
\r
656 for (j=1; j<LineNumber+1; j++){
\r
657 XS=Dot(j,1)-1; // Convert to Origin (0,0)
\r
658 YS=Dot(j,2)-1; // Convert to Origin (0,0)
\r
662 if(StimulusField(XS+1, YS+1)==condition_att[trial_now]){
\r
663 if (hv==1){ XE=XS+LineWidth; YE=YS;}
\r
664 else {XS=XS-LineWidth; YS=YS-LineWidth; XE=XS; YE=YS-LineWidth;}
\r
665 Display::line(XS+StimLU, YS+StimRB, XE+StimLU, YE+StimRB, 0.9);
\r
668 if (hv==1){XS=XS-LineWidth; YS=YS-LineWidth; XE=XS+LineWidth; YE=YS;}
\r
669 else {XE=XS; YE=YS-LineWidth;}
\r
670 Display::line(XS+StimLU, YS+StimRB, XE+StimLU, YE+StimRB, 0.1);
\r
676 Dot(j,1)=1+rand()%(StimulusWidth-LineWidth);
\r
677 Dot(j,2)=1+rand()%(StimulusHeight-LineWidth);
\r
689 void DrawODC(int trial_now, int attribute){
\r
690 int XS, YS, XE, YE;
\r
694 for (i=1; i<LineNumber+1; i++){
\r
695 Dot(i,1)=1+rand()%(StimulusWidth-LineWidth);
\r
696 Dot(i,2)=1+rand()%(StimulusHeight-LineWidth);
\r
702 Direction=(rand()%2)*2-1;
\r
704 for(i=0; i<StimulusDuration; i++){
\r
706 //fixation.display();
\r
708 for (j=1; j<LineNumber+1; j++){
\r
709 XS=Dot(j,1)-1; // Convert to Origin (0,0)
\r
710 YS=Dot(j,2)-1; // Convert to Origin (0,0)
\r
712 if(StimulusField(XS+1, YS+1)==condition_att[trial_now]){
\r
713 XE=XS+Direction*LineWidth; YE=YS+Direction*LineWidth;
\r
716 XE=XS+Direction*LineWidth; YE=YS-Direction*LineWidth;
\r
719 Display::line(XS+StimLU, YS+StimRB, XE+StimLU, YE+StimRB, 1.0);
\r
724 Dot(j,1)=1+rand()%(StimulusWidth-LineWidth);
\r
725 Dot(j,2)=1+rand()%(StimulusHeight-LineWidth);
\r
735 void DrawMDC(int trial_now, int attribute){
\r
738 //Set StimulusField
\r
742 for (i=1; i<DotNumber+1; i++){
\r
743 Dot(i,1)=1+rand()%(StimulusWidth);
\r
744 Dot(i,2)=1+rand()%(StimulusHeight);
\r
750 int orientation =1;
\r
753 for(i=0; i<StimulusDuration; i++){
\r
757 for (j=1; j<DotNumber+1; j++){
\r
758 X=Dot(j,1)-1; // Convert to Origin (0,0)
\r
759 Y=Dot(j,2)-1; // Convert to Origin (0,0)
\r
761 Display::pix(X+StimLU, Y+StimRB,1.0);
\r
762 //Display::pix(X+StimLU, Y+StimRB,1.0);
\r
766 switch(condition_att[trial_now]){
\r
767 case 0 : Dot(j,1)-=DotSpeed; Dot(j,2)-=DotSpeed;break;
\r
768 case 1 : Dot(j,1)+=DotSpeed; Dot(j,2)+=DotSpeed;break;
\r
771 //* Validation of Stimulus area
\r
772 if(Dot(j,1)>StimulusWidth){
\r
773 //if(orientation==1){Dot(j,1)-=StimulusWidth*0.5;}
\r
774 if(orientation==1){Dot(j,1)-=StimulusWidth*0.5;}
\r
775 else{Dot(j,1)-=StimulusWidth;}
\r
778 if(orientation==1){Dot(j,1)+=StimulusWidth*0.5;}
\r
779 else{Dot(j,1)+=StimulusWidth;}
\r
781 if(Dot(j,2)>StimulusWidth){
\r
782 if(orientation==1){Dot(j,2)-=StimulusHeight;}
\r
783 else{Dot(j,2)-=StimulusHeight*0.5;}
\r
786 if(orientation==1){Dot(j,2)+=StimulusHeight;}
\r
787 else{Dot(j,2)+=StimulusHeight*0.5;}
\r
793 Dot(j,1)=1+rand()%(StimulusWidth);
\r
794 Dot(j,2)=1+rand()%(StimulusHeight);//Math::random(StimHeight);
\r
802 while(!Keyboard::pad5.pushed()){
\r
804 Display::message("Experiment is terminated. push 5 key to quit",500,380,Color::white);
\r