LPCGame
A Simple 2d Game Engine
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
State Class Reference

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< EntityManagerManager ()
 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< EntityManagermManager
 
std::shared_ptr< CameramCamera
 
std::string mName
 
bool mExit
 
std::string mExitCode
 
LuaScript mScript
 The state's script.
 

Detailed Description

Base class for states.

The base class for our state machine, provides functions for initializing state, running the state and memory clean-up

Member Function Documentation

void State::Init ( )
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.

void State::Load ( Json::Value  val)
virtual

Load the state from a Json::Value

Parameters
valThe Json::Value to load from

Reimplemented in EditorState, GameState, and MenuState.

void State::LogicUpdate ( )
protectedvirtual

Is this good? I don't know. Call the script's LogicUpdate function

std::string State::Run ( )
virtual

Run the state, this function becomes the main Input thread after starting up the physics and rendering threads

Returns
The next state to run, returning quit exits program

Reimplemented in EditorState, GameState, and MenuState.

Json::Value State::Save ( )
virtual

Save the state data so that it can be loaded later

Returns
Json::Value containing the state data

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

Parameters
valThe exit code to return from Run
See Also
Run
void State::SetName ( std::string  name)

Set the state's name

Parameters
nameThe name to set

The documentation for this class was generated from the following files: