feat: Add GLSL renderer and implement FPS overlay across rendering backends

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-03-19 19:12:39 +01:00
parent c62ea013ba
commit c8cd2cb144
9 changed files with 344 additions and 8 deletions

View File

@@ -74,6 +74,12 @@ class WolfEngine {
/// Elapsed engine lifetime in milliseconds.
int get timeAliveMs => _timeAliveMs;
/// Exponential moving average of rendered frames per second.
double _smoothedFps = 0.0;
/// Current smoothed FPS, suitable for lightweight on-screen diagnostics.
double get fps => _smoothedFps;
/// The episode index where the game session begins.
final int? startingEpisode;
@@ -203,6 +209,14 @@ class WolfEngine {
// Trust the incoming delta time natively
_timeAliveMs += delta.inMilliseconds;
if (delta.inMicroseconds > 0) {
final double instantaneousFps = 1000000.0 / delta.inMicroseconds;
if (_smoothedFps <= 0.0) {
_smoothedFps = instantaneousFps;
} else {
_smoothedFps = (_smoothedFps * 0.88) + (instantaneousFps * 0.12);
}
}
// 1. Process User Input
input.update();