From 144bdaee8c52f3ba4934b64b94e05676d96b8939 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Fri, 8 Mar 2024 21:39:31 +0100 Subject: Removed SDL2_gfx dependency Since the upgrade to SDL2 it was only used for framerate limiting, which I've replicated in a small helper class. Also reduced the framerate limit while minimized from 100 to 10 FPS. --- src/client.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/client.h') diff --git a/src/client.h b/src/client.h index 5b88dd5a..be591979 100644 --- a/src/client.h +++ b/src/client.h @@ -30,7 +30,6 @@ #include #include -#include #include @@ -117,6 +116,16 @@ enum State { STATE_FORCE_QUIT }; +class FpsManager +{ + int mFpsLimit = 0; + uint32_t mFrameCount = 0; + uint32_t mBaseTicks = 0; + +public: + void limitFps(int fpsLimit); +}; + /** * The core part of the client. This class initializes all subsystems, runs * the event loop, and shuts everything down again. @@ -249,8 +258,8 @@ private: SDL_TimerID mLogicCounterId = 0; SDL_TimerID mSecondsCounterId = 0; - bool mLimitFps = false; - FPSmanager mFpsManager; + int mFpsLimit = 0; + FpsManager mFpsManager; }; #endif // CLIENT_H -- cgit v1.2.3-70-g09d2