-
Notifications
You must be signed in to change notification settings - Fork 2
/
patentTaskInstructions.m
93 lines (73 loc) · 3.03 KB
/
patentTaskInstructions.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
function patentTaskInstructions(window, windowRect, enabledKeys, cfg, player1maxbid);
% enabledKeys;
% [screenXpixels, screenYpixels] = Screen('WindowSize', window);
%% Screen 0: Instructions
% Select specific text font, style and size:
screenXpixels=cfg.screenSize.x;
Screen('TextFont', window, 'Courier New');
Screen('TextSize', window, cfg.fontSize);
Screen('TextStyle', window);
Screen('TextColor', window, cfg.textColor);
% if player1maxbid == 5;
% % addpath(matlabroot,'instructions/strong');
% % txtInstr = fileread('patentRace-strong.txt');
% type = 'strong';
% elseif player1maxbid == 4;
% % addpath(matlabroot,'instructions/weak');
% % txtInstr = fileread('patentRace-weak.txt');
% type = 'weak';
% else
% disp('Player 1 max bid needs to be fixed')
% end
%% Instruction screens
keyName=''; % empty initial value
instructions = 1;
instFilename = ['instructions/patentRace_instructions' num2str(instructions) '.png'];
imdata=imread(instFilename);
tex=Screen('MakeTexture', window, imdata);
Screen('DrawTexture', window, tex);
Screen('Flip', window);
% show first instruction page
% instFilename = ['instructions/patentRace_instructions' num2str(instructions) '-' type 'AI.png'];
% imdata=imread(instFilename);
% tex=Screen('MakeTexture', window, imdata);
% % Draw texture image to backbuffer. It will be automatically
% % centered in the middle of the display if you don't specify a
% % different destination:
% Screen('DrawTexture', window, tex);
%
% Screen('Flip', window);
while ~strcmp(keyName,'space')
% while ~strcmp(num2str(instructions), '5')
if instructions == 1;
RestrictKeysForKbCheck(cfg.limitedKeys); % left, right arrows; doesn't allow "space" on first instruction screen
else
RestrictKeysForKbCheck(cfg.enabledSelectKeys); % space, left, right arrows
end
[keyTime, keyCode]=KbWait([],2);
keyName=KbName(keyCode);
switch keyName
case 'LeftArrow'
instructions = instructions - 1;
if instructions < 1
instructions = 1;
end
case 'RightArrow'
instructions = instructions + 1;
if instructions > 2
instructions = 2;
end
end
% update selection to last button press
instFilename = ['instructions/patentRace_instructions' num2str(instructions) '.png'];
imdata=imread(instFilename);
tex=Screen('MakeTexture', window, imdata);
% Draw texture image to backbuffer. It will be automatically
% centered in the middle of the display if you don't specify a
% different destination:
Screen('DrawTexture', window, tex);
Screen('Flip', window);
% end
end
keyName=[];
end