|
13 | 13 | % The dots are drawn on a square with a width equals to the width of the |
14 | 14 | % screen |
15 | 15 | % We then draw an aperture on top to hide the certain dots. |
16 | | - |
| 16 | + |
17 | 17 | %% Get parameters |
18 | | - |
| 18 | + |
19 | 19 | dots = initializeDots(cfg, thisEvent); |
20 | | - |
| 20 | + |
21 | 21 | % Set for how many frames this event will last |
22 | 22 | framesLeft = floor(cfg.eventDuration / cfg.screen.ifi); |
23 | | - |
| 23 | + |
24 | 24 | %% Start the dots presentation |
25 | 25 | vbl = Screen('Flip', cfg.screen.win); |
26 | 26 | onset = vbl; |
27 | | - |
| 27 | + |
28 | 28 | while framesLeft |
29 | | - |
| 29 | + |
30 | 30 | [dots] = updateDots(dots, cfg); |
31 | | - |
| 31 | + |
32 | 32 | %% Center the dots |
33 | 33 | % We assumed that zero is at the top left, but we want it to be |
34 | 34 | % in the center, so shift the dots up and left, which just means |
35 | 35 | % adding half of the screen width in pixel to both the x and y direction. |
36 | 36 | thisEvent.dot.positions = (dots.positions - cfg.screen.winWidth / 2)'; |
37 | | - |
| 37 | + |
38 | 38 | %% make textures |
39 | 39 | dotTexture('make', cfg, thisEvent); |
40 | | - |
| 40 | + |
41 | 41 | apertureTexture('make', cfg, thisEvent); |
42 | | - |
| 42 | + |
43 | 43 | %% draw evetything and flip screen |
44 | | - |
| 44 | + |
45 | 45 | dotTexture('draw', cfg, thisEvent); |
46 | | - |
| 46 | + |
47 | 47 | apertureTexture('draw', cfg, thisEvent); |
48 | | - |
| 48 | + |
49 | 49 | % If this frame shows a target we change the color |
50 | 50 | thisFixation.fixation = cfg.fixation; |
51 | 51 | thisFixation.screen = cfg.screen; |
52 | 52 | if thisEvent.target(1) && GetSecs < (onset + cfg.target.duration) |
53 | 53 | thisFixation.fixation.color = cfg.fixation.colorTarget; |
54 | 54 | end |
55 | 55 | drawFixation(thisFixation); |
56 | | - |
| 56 | + |
57 | 57 | Screen('DrawingFinished', cfg.screen.win); |
58 | | - |
| 58 | + |
59 | 59 | vbl = Screen('Flip', cfg.screen.win, vbl + cfg.screen.ifi); |
60 | | - |
| 60 | + |
61 | 61 | %% Update counters |
62 | | - |
| 62 | + |
63 | 63 | % Check for end of loop |
64 | 64 | framesLeft = framesLeft - 1; |
65 | | - |
| 65 | + |
66 | 66 | end |
67 | | - |
| 67 | + |
68 | 68 | %% Erase last dots |
69 | | - |
| 69 | + |
70 | 70 | drawFixation(cfg); |
71 | | - |
| 71 | + |
72 | 72 | Screen('DrawingFinished', cfg.screen.win); |
73 | | - |
| 73 | + |
74 | 74 | vbl = Screen('Flip', cfg.screen.win, vbl + cfg.screen.ifi); |
75 | | - |
| 75 | + |
76 | 76 | duration = vbl - onset; |
77 | | - |
| 77 | + |
78 | 78 | end |
0 commit comments