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

@@ -5,6 +5,7 @@ namespace Game {
void GameManager::run(std::stop_token stopToken) {
using namespace std::chrono_literals;
LOG("GameManager thread started");
Object::Camera::getInstance().setPosition(0.f, 0.f); // Start with camera at (0, 0)
mLastUpdate = clock::now(); // Get the update
@@ -18,11 +19,12 @@ namespace Game {
const auto frameStart = std::chrono::steady_clock::now();
try {
State::GameState::getInstance().withEntitiesLocked([seconds](auto& entities) {
for (auto& entity : entities) {
auto entities = State::GameState::getInstance().getEntitiesSnapshot();
for (auto* entity : entities) {
if (entity) {
entity->update(seconds);
}
});
}
} catch (const std::exception& e) {
ERROR("Exception in GameManager thread: " << e.what());
}