Nazaj na multithreadanje - fonti

This commit is contained in:
2026-03-12 16:18:51 +01:00
parent 834f0b29c3
commit 74159a6fda
20 changed files with 254 additions and 43 deletions

View File

@@ -1,12 +1,15 @@
#pragma once
#include <object/entity.hpp>
#include <renderer/texture.hpp>
#include <renderer/font.hpp>
namespace Game::AGame {
class Player : public Object::Entity {
using Object::Entity::Entity;
public:
~Player() override = default;
void start() override;
void update() override;
};

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