clc;
clear all;
close all;
rng('shuffle');
ListenChar(2);
HideCursor();

% open a drawing window
Screen('Preference', 'SkipSyncTests', 1); 
[window, window_size] = Screen('OpenWindow', 0, [0 0 0], [],32,2);

% game loop
while 1
    
    % check the keyboard and break out if space is pressed
    [keyIsDown, secs, keyCode] = KbCheck;
    if keyCode(KbName('space')) == 1
        break;
    end
    
    [x y buttons] = GetMouse;
    
    % draw a green circle wherever the cursor is
    Screen('FillOval', window , [0 255 0], [x-5 y-5 x+5 y+5]);
    Screen('Flip', window);
    
end

Screen('CloseAll');
ListenChar(0);
ShowCursor();