Add display.max_fps CVar.

Applies when vsync is not enabled.

Had to shuffle stuff around to GameController since it involves the game loop.

The implementation isn't great and undershoots the target FPS value (because the OS overshoots the desired sleep value). I tried using SDL_DelayPrecise too but this causes significantly increased CPU usage probably because it spinwaits and all that nonsense, so I decided against it.

I don't know why I bothered to do this. I just got the idea in my head. Kinda feels like a waste of time, but there's no point not committing it at this point.
This commit is contained in:
PJB3005
2025-09-02 22:03:44 +02:00
parent f02cd0083a
commit 38d3b83818
11 changed files with 92 additions and 5 deletions

View File

@@ -1103,6 +1103,7 @@ namespace Robust.UnitTesting
public bool SingleStep { get; set; }
public bool Running { get; set; }
public int MaxQueuedTicks { get; set; }
public TimeSpan LimitMinFrameTime { get; set; }
public SleepMode SleepMode { get; set; }
public IntegrationGameLoop(IGameTiming gameTiming, ChannelWriter<object> channelWriter,