This short program is supposed to show a green full-screen background and
a red square of 400 x 400 px in the center. However, the red square is at the top-lef corner [0, 0, 400, 400]
instead of centered.
try
screens = Screen('Screens'); % check for number of screens (currently '0' because only one screen is connected)
whichscreen = max(screens);
[myscreen,rect]=Screen('OpenWindow', whichscreen, [0, 255,0]);
screen_rect = [0, 0, 1366, 768];
square_size = [0, 0, 400, 400];
square_rect = CenterRect(square_size, screen_rect);
Screen('FillRect', myscreen, [255, 0, 0], square_size);
Screen('Flip', myscreen);
KbWait;
Screen('CloseAll');
catch
Screen('CloseAll');
end
Also, the program doesn't close down on pressing a button on the keyboard.
Any idea what the issue is?
Thanks & best, J