Resizing a window in a dual screen display

1 view (last 30 days)
Joseph
Joseph on 17 Jul 2014
I am running a gaze contingent eyetracking script that utilizes psychtoolbox on a dual display computer. However, each window that opens fills up screen 0 and spills almost halfway onto screen one. I am wondering how to resize the windows that open. Here is some relevant code.
%**************************************************************************
%
% Present the stimuli and collect eye tracking data
%
%**************************************************************************
%
% INSTRUCTIONS
%
textSize = 15;
%Screen('FillRect',wPtr,black);
Screen('TextSize', wPtr , textSize);
Screen('DrawText', wPtr, 'Press any key to begin', winWidth/2-100, winHeight/2, white);
vbl = Screen(wPtr, 'Flip');
while 1 %Wait until a key is pressed
pause (0.1);
[keyIsDown, secs, keyCode] = KbCheck;
if keyIsDown
break;% Begin with the experiment
end
end
As well as this section
%Data collection parameters
dataCollectionDuration = 0.05; %Collect data for 50ms
pauseTimeInSeconds = 0.01;
%Gaze contingency parameters
hitStart = 0; %Time the gaze has hit the AOI
waitForFixation_sec = 2;%Time in seconds the gaze has to hit continously the AOI
DX = winWidth / 2;
DY = winHeight / 2;
%Define AOI coordinates according to the size of AOI in degrees
%Distance to screen
distance_mm = 650; %Approximate distance of the participant to the screen
AOIsize_degree = 2; %4 degrees in total
AOIsize_mm = distance_mm*tand(AOIsize_degree);
winWidth_mm = 510;
AOIsize_px = round(AOIsize_mm*winWidth/winWidth_mm);
AOICoor = [ DX - AOIsize_px DY-AOIsize_px DX+AOIsize_px DY+AOIsize_px];
%Show the fixation cross
% textSize = 24;
% Screen('FillRect',wPtr,black);
% Screen('TextSize', wPtr , textSize);
% Screen('DrawText', wPtr, 'Look Here', winWidth/2-12, winHeight/2-12, white);
% vbl = Screen(wPtr, 'Flip');
%Screen('FillRect',wPtr,white);
texture=Screen('MakeTexture', wPtr, stimulus1); %Load image 1
Screen('DrawTexture', wPtr, texture);
while 1
lastSample = length(timeStampAll);
%Collect data for 50 ms
[leftEyeAll, rightEyeAll, timeStampAll, remoteToLocalTimeAll,trigSignalAll]=DataCollect(dataCollectionDuration, pauseTimeInSeconds, leftEyeAll,rightEyeAll, timeStampAll, remoteToLocalTimeAll ,trigSignalAll);
%state = 1 --> all the ET samples hit the AOI ; state = 0 --> none or some of the ET samples didn't hit the AOI
if lastSample < length(timeStampAll) %if new samples have been collected
validityLeft = leftEyeAll(lastSample+1:end,13);
validityRight = rightEyeAll(lastSample+1:end,13);
GazePointLeftX = leftEyeAll(lastSample+1:end,7)*2*DX;
GazePointRightX = rightEyeAll(lastSample+1:end,7)*2*DX;
GazePointLeftY = leftEyeAll(lastSample+1:end,8)*2*DY;
GazePointRightY = rightEyeAll(lastSample+1:end,8)*2*DY;
state = HitAOI (AOICoor, validityLeft, validityRight, GazePointLeftX, GazePointRightX,GazePointLeftY, GazePointRightY);
if state %if the gaze was inside the AOI:
if hitStart == 0 %if it wasn't before, start counting
hitStart = tic;
elseif toc(hitStart) >= waitForFixation_sec %if it was for at least the time predefined, exit the loop and present stimulus
break;
end
else
hitStart = 0; %Restart count
end
%Redraw to update the frame status
% textSize = 24;
% Screen('FillRect',wPtr,black);
% Screen('TextSize', wPtr , textSize);
% Screen('DrawText', wPtr, '+', winWidth/2-12, winHeight/2-12, white);
Screen('FillRect',wPtr,white);
texture=Screen('MakeTexture', wPtr, stimulus2); %Load image 1
Screen('DrawTexture', wPtr, texture);
if hitStart > 0
Screen('FrameRect',wPtr,[0 255 0], AOICoor);
end
vbl = Screen(wPtr, 'Flip'); %Flip
end
end
%
% STIMULUS 1 - IMAGE 1
%
timeStimulus1sec = 3; %Time the stimulus 1 will be shown
frames1 = round(timeStimulus1sec / ifi);
%"BACK" SCREEN - Prepare stimulus 1
Screen('FillRect',wPtr,white);
texture=Screen('MakeTexture', wPtr, stimulus1); %Load image 1
Screen('DrawTexture', wPtr, texture);
%FLIP BACK <--> FRONT screen
vbl =Screen(wPtr, 'Flip');
stimulusOnset(1) = vbl;
%Collect data - Less than the total time - we don't want to miss the next "flip"
[leftEyeAll, rightEyeAll, timeStampAll,
remoteToLocalTimeAll,trigSignalAll]=DataCollect(timeStimulus1sec-0.3, pauseTimeInSeconds, leftEyeAll,rightEyeAll, timeStampAll, remoteToLocalTimeAll ,trigSignalAll);
Thank you

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!