LPCGame
A Simple 2d Game Engine
|
Base class for states. More...
#include <state.h>
Inherited by EditorState, GameState, and MenuState.
Public Member Functions | |
virtual std::string | Run () |
void | SetExit (std::string val) |
void | UnsetExit () |
Set exit to false. | |
std::shared_ptr< EntityManager > | Manager () |
Get the State's EntityManager. | |
void | SetName (std::string name) |
std::string | Name () |
Get the state's name. | |
virtual Json::Value | Save () |
virtual void | Load (Json::Value val) |
Protected Member Functions | |
virtual void | Init () |
Initialize state memory. | |
virtual void | Free () |
Free the memory used by the state. | |
virtual void | LogicUpdate () |
virtual void | RenderUpdate () |
Call the script's RenderUpdate function. | |
Protected Attributes | |
std::shared_ptr< EntityManager > | mManager |
std::shared_ptr< Camera > | mCamera |
std::string | mName |
bool | mExit |
std::string | mExitCode |
LuaScript | mScript |
The state's script. | |
Base class for states.
The base class for our state machine, provides functions for initializing state, running the state and memory clean-up
|
protectedvirtual |
Initialize state memory.
The state's rendering thread, takes care of drawing all objects and providing framerate limiting condition variable notifications to all other threads NOT USED AT THE MOMENT The state's physics thread, takes care of updating and moving all objects and managing physics between the objects NOT USED AT THE MOMENT
Reimplemented in EditorState, GameState, and MenuState.
|
virtual |
Load the state from a Json::Value
val | The Json::Value to load from |
Reimplemented in EditorState, GameState, and MenuState.
|
protectedvirtual |
Is this good? I don't know. Call the script's LogicUpdate function
|
virtual |
Run the state, this function becomes the main Input thread after starting up the physics and rendering threads
Reimplemented in EditorState, GameState, and MenuState.
|
virtual |
Save the state data so that it can be loaded later
Reimplemented in EditorState, GameState, and MenuState.
void State::SetExit | ( | std::string | val | ) |
Set the exit code to return from Run and set exit to true
val | The exit code to return from Run |
void State::SetName | ( | std::string | name | ) |
Set the state's name
name | The name to set |