From 87c0edcbdc480e1d778902420ddfbefd5c46c4e8 Mon Sep 17 00:00:00 2001 From: "C. J. Howard" Date: Wed, 17 Apr 2019 23:20:36 +0800 Subject: [PATCH] Remove old state machine code from Game class --- src/game.cpp | 27 --------------------------- src/game.hpp | 13 ------------- 2 files changed, 40 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index e5bddd9..1e518d8 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -19,8 +19,6 @@ #include "game.hpp" #include "resources/string-table.hpp" -#include "states/game-state.hpp" -#include "states/sandbox-state.hpp" #include "filesystem.hpp" #include "timestamp.hpp" #include "ui/ui.hpp" @@ -70,7 +68,6 @@ #include "debug/ansi-escape-codes.hpp" Game::Game(int argc, char* argv[]): - currentState(nullptr), window(nullptr) { // Determine application name @@ -110,8 +107,6 @@ Game::Game(int argc, char* argv[]): eventDispatcher.subscribe(this); toggleFullscreenDisabled = false; - sandboxState = new SandboxState(this); - float3x3 m1; float3x3 m2; float3x3 m3 = m1 + m2; @@ -129,20 +124,6 @@ Game::~Game() } } -void Game::changeState(GameState* state) -{ - if (currentState != nullptr) - { - currentState->exit(); - } - - currentState = state; - if (currentState != nullptr) - { - currentState->enter(); - } -} - std::string Game::getString(const std::string& name, std::optional languageIndex) const { std::string value; @@ -639,20 +620,12 @@ void Game::setup() StateMachine::changeState(&splashState); #endif } - - //changeState(sandboxState); } void Game::update(float t, float dt) { this->time = t; - // Execute current state - if (currentState != nullptr) - { - currentState->execute(); - } - // Update systems systemManager->update(t, dt); diff --git a/src/game.hpp b/src/game.hpp index cadf5c7..6c27c65 100644 --- a/src/game.hpp +++ b/src/game.hpp @@ -34,9 +34,6 @@ using namespace Emergent; #include #include -class GameState; -class SplashState; -class SandboxState; class UIContainer; class UIBatcher; class UIImage; @@ -130,13 +127,6 @@ public: void disableNonSystemControls(); - /** - * Changes the game state. - * - * @param state New game state. - */ - void changeState(GameState* state); - const EventDispatcher* getEventDispatcher() const; EventDispatcher* getEventDispatcher(); @@ -248,9 +238,6 @@ public: StateMachine::State titleState; StateMachine::State playState; - GameState* currentState; - SandboxState* sandboxState; - // Paths std::string dataPath; std::string configPath;