@@ -30,6 +30,8 @@ class _WolfAsciiRendererState extends State<WolfAsciiRenderer>
|
||||
late Ticker _gameLoop;
|
||||
final FocusNode _focusNode = FocusNode();
|
||||
|
||||
Duration _lastTick = Duration.zero;
|
||||
|
||||
// Changed from String to List<List<ColoredChar>>
|
||||
List<List<ColoredChar>> _asciiFrame = [];
|
||||
final AsciiRasterizer _asciiRasterizer = AsciiRasterizer();
|
||||
@@ -57,8 +59,11 @@ class _WolfAsciiRendererState extends State<WolfAsciiRenderer>
|
||||
void _tick(Duration elapsed) {
|
||||
if (!engine.isInitialized) return;
|
||||
|
||||
Duration delta = elapsed - _lastTick;
|
||||
_lastTick = elapsed;
|
||||
|
||||
inputManager.update();
|
||||
engine.tick(elapsed, inputManager.currentInput);
|
||||
engine.tick(delta, inputManager.currentInput);
|
||||
|
||||
// Calculate frame synchronously and trigger UI rebuild
|
||||
setState(() {
|
||||
|
||||
@@ -32,6 +32,8 @@ class _WolfFlutterRendererState extends State<WolfFlutterRenderer>
|
||||
late Ticker _gameLoop;
|
||||
final FocusNode _focusNode = FocusNode();
|
||||
|
||||
Duration _lastTick = Duration.zero;
|
||||
|
||||
// --- NEW RASTERIZER STATE ---
|
||||
// Lock the internal rendering resolution to the classic 320x200
|
||||
final FrameBuffer _frameBuffer = FrameBuffer(320, 200);
|
||||
@@ -63,8 +65,11 @@ class _WolfFlutterRendererState extends State<WolfFlutterRenderer>
|
||||
void _tick(Duration elapsed) {
|
||||
if (!engine.isInitialized) return;
|
||||
|
||||
Duration delta = elapsed - _lastTick;
|
||||
_lastTick = elapsed;
|
||||
|
||||
inputManager.update();
|
||||
engine.tick(elapsed, inputManager.currentInput);
|
||||
engine.tick(delta, inputManager.currentInput);
|
||||
|
||||
// Only start rendering a new frame if the previous one is finished.
|
||||
// This prevents memory leaks and stuttering on lower-end hardware!
|
||||
|
||||
Reference in New Issue
Block a user