feat: Refactor renderer key event handling and disable FPS counter by default

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-03-19 19:33:49 +01:00
parent 3e091c3d5d
commit bb1d04563a
6 changed files with 36 additions and 23 deletions

View File

@@ -10,9 +10,13 @@ abstract class BaseWolfRenderer extends StatefulWidget {
/// Engine instance that owns world state and the shared framebuffer.
final WolfEngine engine;
/// Optional key handler invoked by the focused renderer shell.
final void Function(KeyEvent event)? onKeyEvent;
/// Creates a renderer bound to [engine].
const BaseWolfRenderer({
required this.engine,
this.onKeyEvent,
super.key,
});
}
@@ -75,7 +79,9 @@ abstract class BaseWolfRendererState<T extends BaseWolfRenderer>
body: KeyboardListener(
focusNode: focusNode,
autofocus: true,
onKeyEvent: (_) {},
onKeyEvent: (event) {
widget.onKeyEvent?.call(event);
},
child: Center(
child: buildViewport(context),
),