-
Notifications
You must be signed in to change notification settings - Fork 2
/
FractControllerContrastLett.j
64 lines (51 loc) · 1.89 KB
/
FractControllerContrastLett.j
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
/*
This file is part of FrACT10, a vision test battery.
Copyright © 2021 Michael Bach, [email protected], <https://michaelbach.de>
FractControllerContrastLett.j
Created by Bach on 2020-08-17
*/
@import "FractControllerContrast.j"
@implementation FractControllerContrastLett: FractControllerContrast {
}
- (void) drawStimulusInRect: (CGRect) dirtyRect forView: (FractView) fractView { //console.info("FractControllerContrastLett>drawStimulusInRect");
[self calculateForeBackColors];
[self prepareDrawing];
switch(state) {
case kStateDrawBack: break;
case kStateDrawFore:
[self drawFixMark];
break;
case kStateDrawFore2:
[optotypes drawLetterWithStriokeInPx: strokeSizeInPix letterNumber: [alternativesGenerator currentAlternative]];
[self drawFixMark3];
stimStrengthInDeviceunits = [self getCurrentContrastLogCSWeber];
trialInfoString = [self contrastComposeTrialInfoString]; // compose here after colors are set
break;
default: break;
}
[self embedInNoise];
[self drawTouchControls];
CGContextRestoreGState(cgc);
[super drawStimulusInRect: dirtyRect];
}
- (void) runStart { //console.info("FractControllerContrastLett>runStart");
nAlternatives = 10; nTrials = [Settings nTrials08];
[super runStart];
}
- (int) responseNumberFromChar: (CPString) keyChar { //console.info("FractControllerAcuityLetters>responseNumberFromChar: ", keyChar);
switch ([keyChar uppercaseString]) { // "CDHKNORSVZ"
case "C": return 0;
case "D": return 1;
case "H": return 2;
case "K": return 3;
case "N": return 4;
case "O": return 5;
case "R": return 6;
case "S": return 7;
case "V": return 8;
case "Z": return 9;
case "5": return -1;
}
return -2;// -1: ignore; -2: invalid
}
@end