% ptreddot % % Draws a red dot on gray background % % Thorsten Hansen 2008-05-08 myscreen = 0; % the default screen mycolordepth = Screen(myscreen, 'PixelSizes'); if max(mycolordepth) < 16 error('Sorry, I need a screen that supports 16- or 32-bit pixelSize.'); end myscreensize = [0 0 512 512]; % use smaller screens for development % myscreensize = []; % [] means "full screen" [window, screenRect] = ... Screen('OpenWindow', myscreen, 0, myscreensize, max(mycolordepth)); black = BlackIndex(window); white = WhiteIndex(window); gray = (white + black)/2; HideCursor; % ------------------------------------------------------------------------- % Draw the gray background into the window % ------------------------------------------------------------------------- Screen('FillRect', window, gray); Screen('Flip', window); % ------------------------------------------------------------------------- % Draw a black square % ------------------------------------------------------------------------- sz = 100; % in pixels color = [255 0 0]; % RGB values in [0, 255] frameRect = [0 0 sz sz]; % rectangle the size of the square rect = CenterRect(frameRect, screenRect); % center square on the screen Screen('FillOval', window, color, rect); % ------------------------------------------------------------------------- % just one flip to show the contents of the window on the screen % ------------------------------------------------------------------------- Screen('Flip', window); pause(4) % done Screen('CloseAll'); ShowCursor