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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user