Last active
August 29, 2015 14:15
Revisions
-
smithdanielle revised this gist
Feb 12, 2015 . 1 changed file with 15 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,39 +1,39 @@ runNum = input('run number: '); % Load rocket image endRocket.load = imread('rocket2.png'); endRocket.texture = Screen('MakeTexture', windowPtr, endRocket.load); % Get the size of the image [s1, s2, s3] = size(endRocket.load); % Get the aspect ratio of the image. We need this to maintain the aspect % ratio of the image when we draw it different sizes. Otherwise, if we % don't match the aspect ratio the image will appear warped / stretched endRocket.aspectRatio = s2 / s1; endRocket.heightScalers= 0.5; endRocket.imageHeights = screenParams.Res(2) .* endRocket.heightScalers; endRocket.imageWidths = endRocket.imageHeights .* endRocket.aspectRatio; endRocket.theRect = [0 0 endRocket.imageWidths endRocket.imageHeights]; endRocket.dstRects = CenterRectOnPointd(endRocket.theRect, xcen,... ycen+(0.25*endRocket.imageHeights)); endText = ['EXPEDITION ', num2str(runNum), ' OF 4 \n COMPLETE']; % Prepare the end screen % Select left-eye image buffer for drawing: Screen('SelectStereoDrawBuffer', windowPtr, 0); Screen('FillRect', windowPtr, [90 90 90]); Screen('TextFont',windowPtr, 'Arial'); Screen('TextSize',windowPtr, 90); DrawFormattedText(windowPtr, endText,'center',50,white,[],flipHorizontal=1); Screen('DrawTextures', windowPtr, endRocket.texture, [], endRocket.dstRects); % Select right-eye image buffer for drawing: Screen('SelectStereoDrawBuffer', windowPtr, 1); Screen('FillRect', windowPtr, [0 0 0]); Screen('TextFont',windowPtr, 'Arial'); Screen('TextSize',windowPtr, 90); DrawFormattedText(windowPtr, endText,'center',50,white,[],flipHorizontal=1); Screen('DrawTextures', windowPtr, endRocket.texture, [], endRocket.dstRects); % Now show the end screen Screen(windowPtr,'Flip'); -
smithdanielle created this gist
Feb 12, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ runNum = input('run number: '); % Load rocket image rocket.load = imread('rocket2.png'); rocket.texture = Screen('MakeTexture', windowPtr, rocket.load); % Get the size of the image [s1, s2, s3] = size(rocket.load); % Get the aspect ratio of the image. We need this to maintain the aspect % ratio of the image when we draw it different sizes. Otherwise, if we % don't match the aspect ratio the image will appear warped / stretched aspectRatio = s2 / s1; heightScalers= 0.5; imageHeights = screenParams.Res(2) .* heightScalers; imageWidths = imageHeights .* aspectRatio; theRect = [0 0 imageWidths imageHeights]; dstRects = CenterRectOnPointd(theRect, xcen,... ycen+(0.25*imageHeights)); endText = ['EXPEDITION ', num2str(runNum), ' OF 4 \n COMPLETE']; % Prepare the end screen % Select left-eye image buffer for drawing: Screen('SelectStereoDrawBuffer', windowPtr, 0); Screen('FillRect', windowPtr, [0 0 0]); Screen('TextFont',windowPtr, 'Arial'); Screen('TextSize',windowPtr, 90); DrawFormattedText(windowPtr, endText,'center',50,white); Screen('DrawTextures', windowPtr, rocket.texture, [], dstRects); % Select right-eye image buffer for drawing: Screen('SelectStereoDrawBuffer', windowPtr, 1); Screen('FillRect', windowPtr, [0 0 0]); Screen('TextFont',windowPtr, 'Arial'); Screen('TextSize',windowPtr, 90); DrawFormattedText(windowPtr, endText,'center',50,white); Screen('DrawTextures', windowPtr, rocket.texture, [], dstRects); % Now show the end screen Screen(windowPtr,'Flip'); % Wait for response: should be q key keyIsDown = 0; while(~keyIsDown || (~keyCode(q) && ~keyCode(escapeKey))) [keyIsDown,secs,keyCode] = KbCheck(-3); % Returns keyboard status, time, keycode end keyIsDown = 0;