Browse Source

Remove old state machine code from Game class

master
C. J. Howard 5 years ago
parent
commit
87c0edcbdc
Signed by: cjhoward GPG Key ID: 03E1FABA9C3EC195
2 changed files with 0 additions and 40 deletions
  1. +0
    -27
      src/game.cpp
  2. +0
    -13
      src/game.hpp

+ 0
- 27
src/game.cpp View File

@ -19,8 +19,6 @@
#include "game.hpp" #include "game.hpp"
#include "resources/string-table.hpp" #include "resources/string-table.hpp"
#include "states/game-state.hpp"
#include "states/sandbox-state.hpp"
#include "filesystem.hpp" #include "filesystem.hpp"
#include "timestamp.hpp" #include "timestamp.hpp"
#include "ui/ui.hpp" #include "ui/ui.hpp"
@ -70,7 +68,6 @@
#include "debug/ansi-escape-codes.hpp" #include "debug/ansi-escape-codes.hpp"
Game::Game(int argc, char* argv[]): Game::Game(int argc, char* argv[]):
currentState(nullptr),
window(nullptr) window(nullptr)
{ {
// Determine application name // Determine application name
@ -110,8 +107,6 @@ Game::Game(int argc, char* argv[]):
eventDispatcher.subscribe<ScheduledFunctionEvent>(this); eventDispatcher.subscribe<ScheduledFunctionEvent>(this);
toggleFullscreenDisabled = false; toggleFullscreenDisabled = false;
sandboxState = new SandboxState(this);
float3x3 m1; float3x3 m1;
float3x3 m2; float3x3 m2;
float3x3 m3 = m1 + 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<std::size_t> languageIndex) const std::string Game::getString(const std::string& name, std::optional<std::size_t> languageIndex) const
{ {
std::string value; std::string value;
@ -639,20 +620,12 @@ void Game::setup()
StateMachine::changeState(&splashState); StateMachine::changeState(&splashState);
#endif #endif
} }
//changeState(sandboxState);
} }
void Game::update(float t, float dt) void Game::update(float t, float dt)
{ {
this->time = t; this->time = t;
// Execute current state
if (currentState != nullptr)
{
currentState->execute();
}
// Update systems // Update systems
systemManager->update(t, dt); systemManager->update(t, dt);

+ 0
- 13
src/game.hpp View File

@ -34,9 +34,6 @@ using namespace Emergent;
#include <vector> #include <vector>
#include <fstream> #include <fstream>
class GameState;
class SplashState;
class SandboxState;
class UIContainer; class UIContainer;
class UIBatcher; class UIBatcher;
class UIImage; class UIImage;
@ -130,13 +127,6 @@ public:
void disableNonSystemControls(); void disableNonSystemControls();
/**
* Changes the game state.
*
* @param state New game state.
*/
void changeState(GameState* state);
const EventDispatcher* getEventDispatcher() const; const EventDispatcher* getEventDispatcher() const;
EventDispatcher* getEventDispatcher(); EventDispatcher* getEventDispatcher();
@ -248,9 +238,6 @@ public:
StateMachine::State titleState; StateMachine::State titleState;
StateMachine::State playState; StateMachine::State playState;
GameState* currentState;
SandboxState* sandboxState;
// Paths // Paths
std::string dataPath; std::string dataPath;
std::string configPath; std::string configPath;

Loading…
Cancel
Save