Files
letnik3koncni-prap/include/game/gamemanager.hpp
2026-03-14 22:27:54 +01:00

29 lines
916 B
C++

#pragma once
#include <state/gamestate.hpp>
#include <object/entity.hpp>
#include <utils.hpp>
#include <thread>
#include <mutex>
#include <chrono>
#include <functional>
#include <object/camera.hpp>
namespace Game {
using clock = std::chrono::steady_clock;
class GameManager {
public:
GameManager() { LOG("Created GameManager"); };
DISABLE_COPY_AND_MOVE(GameManager);
~GameManager() = default;
// Start the game logic slave thread, which will update the gamestate and entities; Run as jthread
void run(std::stop_token stopToken);
void setTargetUpdatesPerSecond(int target) { mTargetUpdatesPerSecond = target; }
int getTargetUpdatesPerSecond() { return mTargetUpdatesPerSecond; }
private:
int mTargetUpdatesPerSecond = TARGET_UPDATE_RATE;
clock::time_point mLastUpdate;
};
}