From 5e3a2492c7bb73daa4e27398daaf490d09980ff3 Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Wed, 22 Jun 2022 17:41:59 -0400 Subject: Base system viewer with data loaded from csv files --- include/game.hpp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 include/game.hpp (limited to 'include/game.hpp') diff --git a/include/game.hpp b/include/game.hpp new file mode 100644 index 0000000..9454318 --- /dev/null +++ b/include/game.hpp @@ -0,0 +1,52 @@ +#ifndef GAME_HPP +#define GAME_HPP 1 + +#include "window.hpp" +#include "camera.hpp" +#include "ecs.hpp" +#include "system.hpp" +#include "timeman.hpp" +#include "input.hpp" + +#include + +#define WINCTX_GAME "Game" + +class Game +{ +public: + enum class State { + STOPPED, RUNNING, RUNNING_INPUT, PAUSED, PAUSED_INPUT + }; + + static void setup(unsigned w, unsigned h); + static void cleanup(); + + static void turn(); + static void setState(State state) { m_state = state; } + static void setContext(const std::string &id) { m_currentContext = id; } + + static bool running() { return m_state != State::STOPPED; } + static bool paused() { return m_state == State::PAUSED || m_state == State::PAUSED_INPUT; } + static bool inputMode() { return m_state == State::RUNNING_INPUT || m_state == State::PAUSED_INPUT; } + + struct WindowContexts { + WindowContext &operator[](const std::string &id) { return Game::m_contexts.at(id); } + WindowContext &operator()() { return Game::m_contexts.at(Game::m_currentContext); } + }; + static WindowContexts contexts; +private: + static std::unordered_map m_contexts; + static std::string m_currentContext; + + static std::unique_ptr m_camera; + static std::unique_ptr m_system; + static SystemView m_systemView; + + static input::Context m_inputContext; + + static double m_delta; + static State m_state; +}; + +#endif -- cgit v1.2.1