Files
Towards/modules/client/src/app/GameState.cpp
T
Martin Slachta f4174eb0c7 #1 - quicr module
2026-08-01 22:43:09 +02:00

35 lines
916 B
C++

#include "GameState.hpp"
namespace tw::app {
GameState::GameState(GameContext context, std::unique_ptr<tw::net::ServerConnection> connection)
: m_context(context),
m_connection(std::move(connection)),
m_entity_gui(context.world),
m_network_gui(*context.metrics)
{
m_controller = std::make_unique<tw::ClientWorldController>(
m_context.input_manager,
m_context.world,
m_context.physics_world,
m_context.renderer,
m_connection.get(),
m_context.metrics
);
m_context.debug_windows->add(&m_entity_gui);
m_context.debug_windows->add(&m_network_gui);
}
GameState::~GameState() {
m_context.debug_windows->remove(&m_entity_gui);
m_context.debug_windows->remove(&m_network_gui);
}
void GameState::update(double delta_time) {
m_controller->update(delta_time);
m_context.world->step(delta_time);
}
} // namespace tw::app