-
Notifications
You must be signed in to change notification settings - Fork 2
/
FractControllerAcuityC.j
77 lines (60 loc) · 2.6 KB
/
FractControllerAcuityC.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
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
This file is part of FrACT10, a vision test battery.
Copyright © 2021 Michael Bach, [email protected], <https://michaelbach.de>
FractControllerAcuityC.j
Created by Bach on 18.07.2017.
*/
@import "FractControllerAcuity.j"
@implementation FractControllerAcuityC: FractControllerAcuity {
}
- (void) modifyThresholderStimulus {
if ([Settings acuityEasyTrials]) [self modifyThresholderStimulusWithBonus];
}
- (void) modifyDeviceStimulus {[self acuityModifyDeviceStimulusDIN01_02_04_08];}
- (float) stimDeviceunitsFromThresholderunits: (float) tPest {return [self acuityStimDeviceunitsFromThresholderunits: tPest];}
- (float) stimThresholderunitsFromDeviceunits: (float) d {return [self acuityStimThresholderunitsFromDeviceunits: d];}
- (float) resultValue4Export {return [self acuityResultValue4Export];}
- (CPString) composeExportString {return [self acuityComposeExportString];}
- (void) drawStimulusInRect: (CGRect) dirtyRect forView: (FractView) fractView { //console.info("FractControllerAcuityC>drawStimulusInRect");
trialInfoString = [self acuityComposeTrialInfoString];
[self prepareDrawing];
switch(state) {
case kStateDrawBack: break;
case kStateDrawFore: //console.info("kStateDrawFore");
if (([Settings nAlternatives] == 4) && ([Settings obliqueOnly])) {
[alternativesGenerator setCurrentAlternative: [alternativesGenerator currentAlternative] + 1];
}
[optotypes drawLandoltWithStrokeInPx: stimStrengthInDeviceunits landoltDirection: [alternativesGenerator currentAlternative]];
break;
default: break;
}
[self embedInNoise];
[self drawTouchControls];
CGContextRestoreGState(cgc);
[super drawStimulusInRect: dirtyRect];
}
- (void) runStart { //console.info("FractControllerAcuityLetters>runStart");
nAlternatives = [Settings nAlternatives]; nTrials = [Settings nTrials];
[self setCurrentTestResultUnit: "LogMAR"];
[super runStart];
}
// 0–8: valid; -1: ignore; -2: invalid
- (int) responseNumberFromChar: (CPString) keyChar { //console.info("FractControllerAcuityC>responseNumberFromChar: ", keyChar);
switch (keyChar) {
case CPLeftArrowFunctionKey: return 4;
case CPRightArrowFunctionKey: return 0;
case CPUpArrowFunctionKey: return 2;
case CPDownArrowFunctionKey: return 6;
case "6": return 0;
case "9": return 1;
case "8": return 2;
case "7": return 3;
case "4": return 4;
case "1": return 5;
case "2": return 6;
case "3": return 7;
case "5": return -1;
}
return -2;
}
@end