12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- % Clear the workspace and the screen
- sca;
- close all;
- clearvars;
- % Here we call some default settings for setting up Psychtoolbox
- % PsychDefaultSetup(2);
- backgroundColor = 20;
- Screen('Preference', 'SkipSyncTests', 1) %%% IMPORTANT!! REMOVE THIS LINE WHEN RUNNING THE TASK
- % Get the screen numbers
- screens = Screen('Screens');
- % Draw to the external screen if avaliable
- screenNumber = max(screens);
- % Define black and white
- white = WhiteIndex(screenNumber);
- black = BlackIndex(screenNumber);
- % Open an on screen window
- [window, rect] = Screen('OpenWindow', screenNumber,backgroundColor,[],[],2);
-
- % Get the size of the on screen window
- [screenXpixels, screenYpixels] = Screen('WindowSize', window);
- W=rect(RectRight); % screen width
- H=rect(RectBottom); % screen height
-
- % Get the centre coordinate of the window
- [xCenter, yCenter] = RectCenter(rect);
- % Make a base Rect
- baseRect1 = [0 0 W/2 W/2];
- baseRect2 = [0 0 W/2.5 W/2.5];
- baseRect3 = [0 0 W/3.5 W/3.5];
- baseRect4 = [0 0 W/6 W/6];
- baseRect5 = [0 0 W/15 W/15];
-
- % For Ovals we set a miximum diameter up to which it is perfect for
- maxDiameter1 = max(baseRect1) * 1.01;
- maxDiameter2 = max(baseRect2) * 1.01;
- maxDiameter3 = max(baseRect3) * 1.01;
- maxDiameter4 = max(baseRect4) * 1.01;
- maxDiameter5 = max(baseRect5) * 1.01;
- % Center the rectangle on the centre of the screen
- centeredRect1 = CenterRectOnPointd(baseRect1, xCenter, yCenter);
- centeredRect2 = CenterRectOnPointd(baseRect2, xCenter, yCenter);
- centeredRect3 = CenterRectOnPointd(baseRect3, xCenter, yCenter);
- centeredRect4 = CenterRectOnPointd(baseRect4, xCenter, yCenter);
- centeredRect5 = CenterRectOnPointd(baseRect5, xCenter, yCenter);
- % Set the color for obbball pings
- rectColor_odd{1} = [250 0 0];
- rectColor_odd{2} = [245 245 245];
- rectColor_odd{3} = [250 0 0];
- rectColor_odd{4} = [245 245 245];
- rectColor_odd{5} = [250 0 0];
- % Set the color for pings
- rectColor{1} = [140 140 140];
- rectColor{2} = [245 245 245];
- rectColor{3} = [140 140 140];
- rectColor{4} = [245 245 245];
- rectColor{5} = [140 140 140];
- % Draw the rect to the screen
- Screen('FillOval', window, rectColor_s{1}, centeredRect1, maxDiameter1);
- Screen('FillOval', window, rectColor_s{2}, centeredRect2, maxDiameter2);
- Screen('FillOval', window, rectColor_s{3}, centeredRect3, maxDiameter3);
- Screen('FillOval', window, rectColor_s{4}, centeredRect4, maxDiameter4);
- Screen('FillOval', window, rectColor_s{5}, centeredRect5, maxDiameter5);
- % Flip to the screen
- Screen('Flip', window);
- % Wait for a key press
- KbStrokeWait;
- % Clear the screen
- sca;
|