feat: Implement ASCII theme cycling and add quadrant theme support
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -125,9 +125,36 @@ class CliGameLoop {
|
||||
return;
|
||||
}
|
||||
|
||||
if (bytes.contains(116) || bytes.contains(84)) {
|
||||
_cycleAsciiTheme();
|
||||
return;
|
||||
}
|
||||
|
||||
input.handleKey(bytes);
|
||||
}
|
||||
|
||||
void _cycleAsciiTheme() {
|
||||
final List<AsciiRenderer> asciiRenderers = <AsciiRenderer>[
|
||||
if (primaryRenderer is AsciiRenderer) primaryRenderer as AsciiRenderer,
|
||||
if (secondaryRenderer is AsciiRenderer)
|
||||
secondaryRenderer as AsciiRenderer,
|
||||
];
|
||||
if (asciiRenderers.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
||||
final AsciiTheme nextTheme = AsciiThemes.nextOf(
|
||||
asciiRenderers.first.activeTheme,
|
||||
);
|
||||
for (final renderer in asciiRenderers) {
|
||||
renderer.activeTheme = nextTheme;
|
||||
}
|
||||
|
||||
if (stdout.hasTerminal) {
|
||||
stdout.write('\x1b[2J\x1b[H');
|
||||
}
|
||||
}
|
||||
|
||||
void _tick(Timer timer) {
|
||||
if (!_isRunning) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user