basic movement
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <game/gamemanager.hpp>
|
||||
#include <audio/audio.hpp>
|
||||
#include <chrono>
|
||||
#include <mutex>
|
||||
|
||||
namespace Game::Window {
|
||||
class Window {
|
||||
@@ -25,18 +26,20 @@ namespace Game::Window {
|
||||
void setTargetFPS(int fps) { mTargetFPS = fps; }
|
||||
int getTargetFPS() { return mTargetFPS; }
|
||||
|
||||
static SDL_Window* getSDLWindowBackend() { return sWindowBackend; }
|
||||
static SDL_Window* getSDLWindowBackend() { std::scoped_lock lock(sMutex); return sWindowBackend; }
|
||||
|
||||
Renderer::Renderer* getRenderer() { return &mRenderer; }
|
||||
Renderer::Renderer* getRenderer() { std::scoped_lock lock(mMutex); return &mRenderer; }
|
||||
|
||||
private:
|
||||
mutable std::mutex mMutex;
|
||||
static std::mutex sMutex;
|
||||
static inline SDL_Window* sWindowBackend = nullptr;
|
||||
SDL_Window* mWindow;
|
||||
Renderer::Renderer mRenderer;
|
||||
Game::GameManager mGameManager;
|
||||
std::jthread mGameThread;
|
||||
bool mRunning;
|
||||
int mTargetFPS = 60;
|
||||
int mTargetFPS = TARGET_FPS;
|
||||
size_t mFrameCount = 0;
|
||||
std::chrono::steady_clock::time_point mLastFPSTime;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user