-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstimFixationPt.m
96 lines (60 loc) · 2.67 KB
/
stimFixationPt.m
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
classdef stimFixationPt
%STIMFIXATIONPT Summary of this function goes here
%
% obj = stimFixationPt(size_px, penWidth_px, location_pt, color_wd)
%
properties
size_px;
penWidth_px;
location_pt;
color_wd;
end % properties
methods
function obj = stimFixationPt(varargin)
switch(nargin)
case 0
obj.size_px = 10;
obj.penWidth_px = 5;
obj.location_pt = [400, 300];
obj.color_wd = 'black';
case 1
obj = stimFixationPt();
obj.location_pt = varargin{1};
case 4
obj.size_px = varargin{1};
obj.penWidth_px = varargin{2};
obj.location_pt = varargin{3};
obj.color_wd = varargin{4};
otherwise
error('Wrong number of input arguments');
end % switch
end % constructor method
function draw(obj, winPtr)
X=1; % array index for x-coordinate
Y=2; % array index for y-coordinate
top = obj.location_pt(Y) - obj.size_px;
btm = obj.location_pt(Y) + obj.size_px;
left = obj.location_pt(X) - obj.size_px;
right = obj.location_pt(X) + obj.size_px;
color_rgb = seColor2RGB(obj.color_wd);
Screen('DrawLine', winPtr, color_rgb, left, obj.location_pt(Y), right, obj.location_pt(Y), obj.penWidth_px);
Screen('DrawLine', winPtr, color_rgb, obj.location_pt(X), top, obj.location_pt(X), btm, obj.penWidth_px);
end
function show(obj)
try
[winPtr, winRect, centerPt] = setupScreen(color2RGB('white')); %#ok<ASGLU>
Priority(MaxPriority(winPtr));
obj.location_pt = centerPt; % set location to be center of screen
obj.draw(winPtr);
Screen('Flip', winPtr); % flip/draw buffer to display monitor
KbWait;
Screen('CloseAll'); % close psychtoolbox screen
Priority(0);
catch matlab_err
ShowCursor;
Screen('CloseAll'); % close psychtoolbox screen
display(getReport(matlab_err));
end % try-catch
end % method
end % methods
end % classdef