summaryrefslogtreecommitdiff
path: root/src/client.h
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-08 21:39:31 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-08 21:39:34 +0100
commit144bdaee8c52f3ba4934b64b94e05676d96b8939 (patch)
treeec9f29983c8b2955e5da762fea4208817a41435b /src/client.h
parentb119923b4bb90d9ed3bb3a7550401b274d3ef0ad (diff)
downloadMana-144bdaee8c52f3ba4934b64b94e05676d96b8939.tar.gz
Mana-144bdaee8c52f3ba4934b64b94e05676d96b8939.tar.bz2
Mana-144bdaee8c52f3ba4934b64b94e05676d96b8939.tar.xz
Mana-144bdaee8c52f3ba4934b64b94e05676d96b8939.zip
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.
Diffstat (limited to 'src/client.h')
-rw-r--r--src/client.h15
1 files changed, 12 insertions, 3 deletions
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 <guichan/actionlistener.hpp>
#include <SDL.h>
-#include <SDL2_framerate.h>
#include <string>
@@ -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