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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
size_t i;
OFEnumerator OF_GENERIC(OFColor *) *reverseEnumerator;
[of_stdout writeFormat: @"%dx%d\n", of_stdout.columns, of_stdout.rows];
i = 0;
for (OFColor *color in colors) {
of_stdout.foregroundColor = color;
[of_stdout writeFormat: @"%zx", i++];
}
[of_stdout reset];
[of_stdout writeLine: @"R"];
i = 0;
for (OFColor *color in colors) {
of_stdout.backgroundColor = color;
[of_stdout writeFormat: @"%zx", i++];
}
[of_stdout reset];
[of_stdout writeLine: @"R"];
i = 0;
reverseEnumerator = [colors.reversedArray objectEnumerator];
for (OFColor *color in colors) {
of_stdout.foregroundColor = color;
of_stdout.backgroundColor = [reverseEnumerator nextObject];
[of_stdout writeFormat: @"%zx", i++];
}
[of_stdout reset];
[of_stdout writeLine: @"R"];
for (i = 0; i < colors.count * 2; i++) {
if (i % 2)
of_stdout.backgroundColor = [colors objectAtIndex:
((i / 2) + 2) % colors.count];
else
of_stdout.foregroundColor =
[colors objectAtIndex: i / 2];
[of_stdout writeFormat: @"%zx", i / 2];
}
[of_stdout reset];
[of_stdout writeLine: @"R"];
[of_stdout writeLine: @"Press return"];
[of_stdin readLine];
of_stdout.backgroundColor = [OFColor green];
[of_stdout writeString: @"Hello!"];
[OFThread sleepForTimeInterval: 2];
[of_stdout eraseLine];
[of_stdout writeString: @"World!"];
[OFThread sleepForTimeInterval: 2];
[of_stdout clear];
[OFThread sleepForTimeInterval: 2];
of_stdout.cursorPosition = of_point(5, 3);
[of_stdout writeString: @"Text at (5, 3)"];
[OFThread sleepForTimeInterval: 2];
[of_stdout setRelativeCursorPosition: of_point(-2, 0)];
[OFThread sleepForTimeInterval: 2];
[of_stdout setRelativeCursorPosition: of_point(2, 0)];
[OFThread sleepForTimeInterval: 2];
[of_stdout setRelativeCursorPosition: of_point(0, -2)];
[OFThread sleepForTimeInterval: 2];
[of_stdout setRelativeCursorPosition: of_point(0, 2)];
[OFThread sleepForTimeInterval: 2];
[of_stdout setRelativeCursorPosition: of_point(1, 1)];
[OFThread sleepForTimeInterval: 2];
[of_stdout setRelativeCursorPosition: of_point(-1, -1)];
[OFThread sleepForTimeInterval: 2];
of_stdout.cursorColumn = 2;
[OFThread sleepForTimeInterval: 2];
[of_stdout reset];
[OFApplication terminate];
}
@end
|
|
|
|
|
|
|
|
|
|
|
|
|
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
size_t i;
OFEnumerator OF_GENERIC(OFColor *) *reverseEnumerator;
[of_stdout writeFormat: @"%dx%d\n", of_stdout.columns, of_stdout.rows];
i = 0;
for (OFColor *color in colors) {
[of_stdout setForegroundColor: color];
[of_stdout writeFormat: @"%zx", i++];
}
[of_stdout reset];
[of_stdout writeLine: @"R"];
i = 0;
for (OFColor *color in colors) {
[of_stdout setBackgroundColor: color];
[of_stdout writeFormat: @"%zx", i++];
}
[of_stdout reset];
[of_stdout writeLine: @"R"];
i = 0;
reverseEnumerator = [colors.reversedArray objectEnumerator];
for (OFColor *color in colors) {
[of_stdout setForegroundColor: color];
[of_stdout setBackgroundColor: [reverseEnumerator nextObject]];
[of_stdout writeFormat: @"%zx", i++];
}
[of_stdout reset];
[of_stdout writeLine: @"R"];
for (i = 0; i < colors.count * 2; i++) {
if (i % 2)
[of_stdout setBackgroundColor: [colors objectAtIndex:
((i / 2) + 2) % colors.count]];
else
[of_stdout setForegroundColor:
[colors objectAtIndex: i / 2]];
[of_stdout writeFormat: @"%zx", i / 2];
}
[of_stdout reset];
[of_stdout writeLine: @"R"];
[of_stdout writeLine: @"Press return"];
[of_stdin readLine];
[of_stdout setBackgroundColor: [OFColor green]];
[of_stdout writeString: @"Hello!"];
[OFThread sleepForTimeInterval: 2];
[of_stdout eraseLine];
[of_stdout writeString: @"World!"];
[OFThread sleepForTimeInterval: 2];
[of_stdout clear];
[OFThread sleepForTimeInterval: 2];
[of_stdout setCursorPosition: of_point(5, 3)];
[of_stdout writeString: @"Text at (5, 3)"];
[OFThread sleepForTimeInterval: 2];
[of_stdout setRelativeCursorPosition: of_point(-2, 0)];
[OFThread sleepForTimeInterval: 2];
[of_stdout setRelativeCursorPosition: of_point(2, 0)];
[OFThread sleepForTimeInterval: 2];
[of_stdout setRelativeCursorPosition: of_point(0, -2)];
[OFThread sleepForTimeInterval: 2];
[of_stdout setRelativeCursorPosition: of_point(0, 2)];
[OFThread sleepForTimeInterval: 2];
[of_stdout setRelativeCursorPosition: of_point(1, 1)];
[OFThread sleepForTimeInterval: 2];
[of_stdout setRelativeCursorPosition: of_point(-1, -1)];
[OFThread sleepForTimeInterval: 2];
[of_stdout setCursorColumn: 2];
[OFThread sleepForTimeInterval: 2];
[of_stdout reset];
[OFApplication terminate];
}
@end
|