这个短程序应该显示一个绿色的全屏背景和一个 400 x 400 像素的红色正方形在中心。但是,红色方块位于左上角[0, 0, 400, 400]
而不是居中。
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
此外,程序不会在按下键盘上的按钮时关闭。
知道问题是什么吗?
谢谢,最好的,J