-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetGlobals.m
More file actions
55 lines (40 loc) · 1.42 KB
/
setGlobals.m
File metadata and controls
55 lines (40 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
function [globals] = setGlobals(globals)
% Set the unit length of each IO pulse
globals.portUnitLength = 8/1000;
% Keyboard settings
KbName('UnifyKeyNames');
globals.escapeKey = KbName('ESCAPE');
globals.scrollKey = KbName('b');
globals.acceptKey = KbName('y');
globals.sKey = KbName('s');
%% Set monoschrome values
[globals.white, globals.black] = setMonochromes();
%% Open the PsychToolbox window
[globals.window, windowRect] = PsychImaging('OpenWindow', 0, globals.black);
%% Load the textures
globals.textures = setTextures(globals.window, globals.SubjectId);
globals.symbImg = setSymTextures(globals.window);
%% Set the xy co-ords
% Get the size of the on screen window
[nX, nY] = Screen('WindowSize', globals.window);
% Get the centre coordinates of the window
[x,y] = RectCenter(windowRect);
globals.xyCentreScrn = [x;y];
globals.xyEdgesScrn = Screen('Rect', globals.window);
% Cues
cueImgWidth = 830;
globals.xyEdgesCues = CenterRectOnPoint(...
[0 0 cueImgWidth cueImgWidth],...
globals.xyCentreScrn(1), globals.xyCentreScrn(2));
% Resp
[globals.xyEdgesResp, globals.xyCentreResp] = setRespCoords(nX, nY);
%% Set the fixation cross
globals.cross = setCross();
%% Miscellaneous setting
% Set the inter-frame interval
globals.ifi = Screen('GetFlipInterval', globals.window);
% Pen width for drawing the frames
globals.penWidthPixels = 6;
% Get an initial screen flip for timing
globals.t = Screen('Flip', globals.window);
return