Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear all
- HideCursor;
- %%
- %0 for one monitor, 1 for two or more monitors
- WinNum = 0;
- %Determine Monitor Resolution
- ScreenRes = Screen('Resolution', WinNum);
- xCenter = (ScreenRes.width)/2;
- yCenter = (ScreenRes.height)/2;
- Background = [100,100,100]; % Higher numbers are lighter
- BackgroundIndex = 100;
- white = [255 255 255];
- black = [0 0 0];
- Grey_LowC = [139 139 139]; % 25 percent of the distance between white and the background grey, rounded up.
- red = [255 0 0];%For testing purposes and feedback.
- green = [0 255 0];
- InstructionTxtSize = 18;
- StimTextSize = 50;
- w = Screen('OpenWindow',WinNum,Background);
- %%
- %Example 1 Parameters
- InstructionRect = ones(ceil(ScreenRes.width), ceil(ScreenRes.height)).* BackgroundIndex;
- InstructionTexture = Screen('MakeTexture', w, InstructionRect);
- Screen('TextSize', InstructionTexture, StimTextSize);
- Screen('TextFont', InstructionTexture, 'Anonymous Pro');
- LetAdj = 10;%add spaces between letters
- TxtColor1 = red;
- TxtColor2 = white;
- LocLet = 'A';
- %Global X
- [~,~, X_textbounds4] = DrawFormattedText(InstructionTexture, LocLet, 'center', 'center', TxtColor1,[],[],[],[.75] );
- X_Diff = X_textbounds4(3)- X_textbounds4(1) + LetAdj;
- Y_Diff = X_textbounds4(4)- X_textbounds4(2) + LetAdj;
- %Top of X
- [~,~, X_textbounds3L] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds4(1)-(X_Diff*.75), X_textbounds4(2)-Y_Diff, TxtColor2,[],[],[],[.75]);
- [~,~, X_textbounds2L] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds3L(1)-(X_Diff*.75), X_textbounds3L(2)-Y_Diff, TxtColor1,[],[],[],[.75]);
- [~,~, X_textbounds1L] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds2L(1)-(X_Diff*.75), X_textbounds2L(2)-Y_Diff, TxtColor2,[],[],[],[.75]);
- [~,~, X_textbounds3R] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds4(1)+(X_Diff*.75), X_textbounds4(2)-Y_Diff, TxtColor2,[],[],[],[.75] );
- [~,~, X_textbounds2R] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds3R(1)+(X_Diff*.75 ), X_textbounds3R (2)-Y_Diff, TxtColor1,[],[],[],[.75] );
- [~,~, X_textbounds1R] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds2R(1)+(X_Diff*.75 ), X_textbounds2R (2)-Y_Diff, TxtColor2,[],[],[],[.75] );
- %Bottom of X
- [~,~, X_textbounds5L] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds4(1)-(X_Diff*.75), X_textbounds4(2)+Y_Diff, TxtColor2,[],[],[],[.75]);
- [~,~, X_textbounds6L] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds5L(1)-(X_Diff*.75), X_textbounds5L(2)+Y_Diff, TxtColor1,[],[],[],[.75]);
- [~,~, X_textbounds7L] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds6L(1)-(X_Diff*.75), X_textbounds6L(2)+Y_Diff, TxtColor2 ,[],[],[],[.75]);
- [~,~, X_textbounds5R] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds4(1)+(X_Diff*.75), X_textbounds4(2)+Y_Diff, TxtColor2,[],[],[],[.75]);
- [~,~, X_textbounds6R] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds5R(1)+(X_Diff*.75), X_textbounds5R (2)+Y_Diff, TxtColor1 ,[],[],[],[.75] );
- [~,~, X_textbounds7R] = DrawFormattedText(InstructionTexture, LocLet, X_textbounds6R(1)+(X_Diff*.75), X_textbounds6R (2)+Y_Diff, TxtColor2 ,[],[],[],[.75] );
- SourceRect = [X_textbounds1L(1)-(LetAdj*7),X_textbounds1L(2)-(LetAdj*7),X_textbounds7R(3)+(LetAdj*7), X_textbounds7R(4)+ (LetAdj*7)];
- X_Dim = SourceRect(3)-SourceRect(1);
- Y_Dim = SourceRect(4)-SourceRect(2);
- DestinationRect = [xCenter-(X_Dim/2),yCenter-(Y_Dim/2),xCenter+(X_Dim/2),yCenter+(Y_Dim/2)];
- Screen('DrawTexture', w, InstructionTexture, SourceRect, DestinationRect);
- Screen('Flip',w);
- KbWait([], 2);
- Screen('CloseAll');
Add Comment
Please, Sign In to add comment