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
|
[OFStdOut clear];
for (;;) {
[OFStdOut setCursorPosition: OFMakePoint(0, 0)];
for (OFGameController *controller in controllers) {
OFArray *buttons =
controller.buttons.allObjects.sortedArray;
size_t i = 0;
[OFStdOut setForegroundColor: [OFColor green]];
[OFStdOut writeLine: controller.name];
for (OFString *button in buttons) {
bool pressed = [controller.pressedButtons
containsObject: button];
[OFStdOut setForegroundColor: (pressed
? [OFColor yellow] : [OFColor gray])];
[OFStdOut writeFormat: @"[%@]", button];
if (++i == 5) {
[OFStdOut writeString: @"\n"];
i = 0;
} else
|
|
|
|
|
>
|
>
>
>
|
>
>
>
>
>
>
|
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
|
[OFStdOut clear];
for (;;) {
[OFStdOut setCursorPosition: OFMakePoint(0, 0)];
for (OFGameController *controller in controllers) {
OFArray OF_GENERIC(OFGameControllerButton) *buttons =
controller.buttons.allObjects.sortedArray;
size_t i = 0;
[OFStdOut setForegroundColor: [OFColor green]];
[OFStdOut writeLine: controller.name];
for (OFGameControllerButton button in buttons) {
float pressure =
[controller pressureForButton: button];
if (pressure == 1)
[OFStdOut setForegroundColor:
[OFColor red]];
else if (pressure > 0.5)
[OFStdOut setForegroundColor:
[OFColor yellow]];
else if (pressure > 0)
[OFStdOut setForegroundColor:
[OFColor green]];
else
[OFStdOut setForegroundColor:
[OFColor gray]];
[OFStdOut writeFormat: @"[%@]", button];
if (++i == 5) {
[OFStdOut writeString: @"\n"];
i = 0;
} else
|