Skip to content

Commit 47b6cc2

Browse files
committed
allow for drawing non centered fielf of view
1 parent f4804e8 commit 47b6cc2

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/drawFieldOfVIew.m

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,33 @@
11
% (C) Copyright 2020 CPP_PTB developers
22

3-
function drawFieldOfVIew(cfg)
3+
function fov = drawFieldOfVIew(cfg, centerOnScreen)
44
% drawFieldOfVIew(cfg)
55
%
66
% draws a red rectangle on the screen to materialize the field of view of
77
% the participant. This can be used during debugging to help design the
88
% stimuli if you know the FOV of the participant will be obstructed by
99
% something
10+
11+
if nargin < 2
12+
centerOnScreen = true;
13+
end
14+
15+
fov = [];
1016

1117
if isfield(cfg.screen, 'effectiveFieldOfView') && ...
12-
numel(cfg.screen.effectiveFieldOfView) == 2
18+
numel(cfg.screen.effectiveFieldOfView) == 4
1319

1420
RED = [255 0 0];
1521
penWidth = 2;
1622

1723
fov = cfg.screen.effectiveFieldOfView;
18-
19-
fov = CenterRect( ...
20-
[0, 0, fov(1), fov(2)], ...
21-
cfg.screen.winRect);
24+
25+
if centerOnScreen
26+
fov = CenterRect( ...
27+
fov, ...
28+
cfg.screen.winRect);
29+
end
30+
2231

2332
Screen('FrameRect', ...
2433
cfg.screen.win, ...

0 commit comments

Comments
 (0)