Skip to content

Commit 22a00eb

Browse files
committed
translate vars to our language
1 parent 506605f commit 22a00eb

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

devSandbox.m

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
% -------------------------------------------------------------------------
3636

3737
% Define black and white
38-
white = WhiteIndex(cfg.screenNumber);
39-
black = BlackIndex(cfg.screenNumber);
38+
white = WhiteIndex(cfg.screen);
39+
black = BlackIndex(cfg.screen);
4040
grey = white / 2;
4141
inc = white - grey;
4242

@@ -91,7 +91,7 @@
9191
mask(:, :, 2)= grating .* contrast;
9292

9393
% Make our grating mask texture
94-
gratingMaskTex = Screen('MakeTexture', cfg.window, mask);
94+
gratingMaskTex = Screen('MakeTexture', cfg.win, mask);
9595

9696
% Make a black and white noise mask half the size of our grating. This will
9797
% be scaled upon drawing to make a "chunky" noise texture which our grating
@@ -100,12 +100,12 @@
100100
noise = rand(round(visibleSize / 2)) .* white;
101101

102102
% Make our noise texture
103-
noiseTex = Screen('MakeTexture', cfg.window, noise);
103+
noiseTex = Screen('MakeTexture', cfg.win, noise);
104104

105105
% Make a destination rectangle for our textures and center this on the
106106
% screen
107107
dstRect = [0 0 visibleSize visibleSize];
108-
dstRect = CenterRect(dstRect, cfg.windowRect);
108+
dstRect = CenterRect(dstRect, cfg.winRect);
109109

110110
% Calculate the wait duration
111111
waitDuration = waitframes * cfg.ifi;
@@ -119,7 +119,7 @@
119119
shiftPerFrame = cyclesPerSecond * pixPerCycle * waitDuration;
120120

121121
% Sync us to the vertical retrace
122-
vbl = Screen('Flip', cfg.window);
122+
vbl = Screen('Flip', cfg.win);
123123

124124
% Set the frame counter to zero, we need this to 'drift' our grating
125125
frameCounter = 0;
@@ -138,13 +138,13 @@
138138
srcRect = [xoffset 0 xoffset + visibleSize visibleSize];
139139

140140
% Draw noise texture to the screen
141-
Screen('DrawTexture', cfg.window, noiseTex, [], dstRect, []);
141+
Screen('DrawTexture', cfg.win, noiseTex, [], dstRect, []);
142142

143143
% Draw grating mask
144-
Screen('DrawTexture', cfg.window, gratingMaskTex, srcRect, dstRect, []);
144+
Screen('DrawTexture', cfg.win, gratingMaskTex, srcRect, dstRect, []);
145145

146146
% Flip to the screen on the next vertical retrace
147-
vbl = Screen('Flip', cfg.window, vbl + (waitframes - 0.5) * cfg.ifi);
147+
vbl = Screen('Flip', cfg.win, vbl + (waitframes - 0.5) * cfg.ifi);
148148

149149
end
150150

@@ -180,26 +180,23 @@
180180
% Here we call some default settings for setting up Psychtoolbox
181181
PsychDefaultSetup(2);
182182

183-
% Get the screen numbers
184-
cfg.screens = Screen('Screens');
185-
186-
% Draw to the external screen if avaliable
187-
cfg.screenNumber = max(cfg.screens);
183+
% Get the screen numbers and draw to the external screen if avaliable
184+
cfg.screen = max(Screen('Screens'));
188185

189186
% Open an on screen window
190-
[cfg.window, cfg.windowRect] = Screen('OpenWindow', cfg.screenNumber, cfg.backgroundColor);
187+
[cfg.win, cfg.winRect] = Screen('OpenWindow', cfg.screen, cfg.backgroundColor);
191188

192189
% Get the size of the on screen window
193-
[cfg.screenXpixels, cfg.screenYpixels] = Screen('WindowSize', cfg.window);
190+
[cfg.winWidth, cfg.winHeight] = WindowSize(cfg.win);
194191

195192
% Query the frame duration
196-
cfg.ifi = Screen('GetFlipInterval', cfg.window);
193+
cfg.ifi = Screen('GetFlipInterval', cfg.win);
197194

198-
% Get the centre coordinate of the window
199-
[cfg.xCenter, cfg.yCenter] = RectCenter(cfg.windowRect);
195+
% Get the Center of the Screen
196+
cfg.center = [cfg.winRect(3), cfg.winRect(4)]/2;
200197

201198
% Set up alpha-blending for smooth (anti-aliased) lines
202-
Screen('BlendFunction', cfg.window, 'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA');
199+
Screen('BlendFunction', cfg.win, 'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA');
203200

204201
end
205202

0 commit comments

Comments
 (0)