basic movement

This commit is contained in:
2026-03-14 22:27:54 +01:00
parent b19f595daf
commit 2983b919cd
24 changed files with 368 additions and 57 deletions

View File

@@ -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;
};