feat: Add FPS toggle shortcut and corresponding input handling in CLI
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -12,6 +12,9 @@ class CliInput extends Wolf3dInput {
|
||||
/// Keyboard shortcut used by the CLI host to cycle ASCII themes.
|
||||
String asciiThemeCycleKey = 't';
|
||||
|
||||
/// Keyboard shortcut used by the CLI host to toggle the FPS counter.
|
||||
String fpsToggleKey = '`';
|
||||
|
||||
/// Human-friendly label for [rendererToggleKey] shown in CLI hints.
|
||||
String get rendererToggleKeyLabel => _formatShortcutLabel(rendererToggleKey);
|
||||
|
||||
@@ -19,6 +22,9 @@ class CliInput extends Wolf3dInput {
|
||||
String get asciiThemeCycleKeyLabel =>
|
||||
_formatShortcutLabel(asciiThemeCycleKey);
|
||||
|
||||
/// Human-friendly label for [fpsToggleKey] shown in CLI hints.
|
||||
String get fpsToggleKeyLabel => _formatShortcutLabel(fpsToggleKey);
|
||||
|
||||
/// Returns true when [bytes] triggers the renderer-toggle shortcut.
|
||||
bool matchesRendererToggleShortcut(List<int> bytes) =>
|
||||
_matchesShortcut(bytes, rendererToggleKey);
|
||||
@@ -27,6 +33,10 @@ class CliInput extends Wolf3dInput {
|
||||
bool matchesAsciiThemeCycleShortcut(List<int> bytes) =>
|
||||
_matchesShortcut(bytes, asciiThemeCycleKey);
|
||||
|
||||
/// Returns true when [bytes] triggers the FPS-toggle shortcut.
|
||||
bool matchesFpsToggleShortcut(List<int> bytes) =>
|
||||
_matchesShortcut(bytes, fpsToggleKey);
|
||||
|
||||
String _formatShortcutLabel(String key) {
|
||||
final String trimmed = key.trim();
|
||||
if (trimmed.isEmpty) {
|
||||
|
||||
Reference in New Issue
Block a user