Nazaj na multithreadanje - fonti
This commit is contained in:
25
include/game/gamemanager.hpp
Normal file
25
include/game/gamemanager.hpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include <state/gamestate.hpp>
|
||||
#include <object/entity.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
|
||||
namespace Game {
|
||||
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 = 60;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user