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

A state for running a game level. More...

#include <gamestate.h>

Inherits State.

Public Member Functions

std::string Run ()
 
Json::Value Save ()
 
void Load (Json::Value val)
 
- Public Member Functions inherited from State
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.
 

Protected Member Functions

void Init ()
 Initialize state memory.
 
void Free ()
 Free state memory.
 
- Protected Member Functions inherited from State
virtual void LogicUpdate ()
 
virtual void RenderUpdate ()
 Call the script's RenderUpdate function.
 

Additional Inherited Members

- Protected Attributes inherited from State
std::shared_ptr< EntityManagermManager
 
std::shared_ptr< CameramCamera
 
std::string mName
 
bool mExit
 
std::string mExitCode
 
LuaScript mScript
 The state's script.
 

Detailed Description

A state for running a game level.

A simple game state that can run a level of the game

Member Function Documentation

void GameState::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 from State.

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

Load the state data from a json value

See Also
State::Load for loading inherited members, besides the manager as it must be loaded differently for each state type
Parameters
valThe Json::Value containing the data to load

Reimplemented from State.

std::string GameState::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 from State.

Json::Value GameState::Save ( )
virtual

Write the state data to a Json Value and return it so that it can be saved and loaded later

See Also
State::Save for saving inherited members
Returns
Json::Value containing the state's save data

Reimplemented from State.


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