Robot Devastation
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
rd::GameState Class Reference

Game State. More...

#include <GameState.hpp>

Inheritance diagram for rd::GameState:
rd::State rd::ManagerHub rd::InputEventListener rd::ImageEventListener

Public Member Functions

 GameState (NetworkManager *networkManager, ImageManager *imageManager, InputManager *inputManager, MentalMap *mentalMap, asrob::IRobotManager *robotManager, AudioManager *audioManager, ScreenManager *screenManager)
 
virtual bool setup ()
 Function executed just before the loop function, when the state is enabled. More...
 
virtual bool loop ()
 Function executed periodically when the state is active. More...
 
virtual bool cleanup ()
 Function excuted when this state is going to be stopped (due to an error or a transition) More...
 
virtual int evaluateConditions ()
 This function is called after each call to loop() in order to know the transition to make. More...
 
virtual bool onKeyDown (const Key &k)
 This function will be called whenever a key is pressed on the keyboard. More...
 
virtual bool onKeyUp (const Key &k)
 This function will be called whenever a key is released on the keyboard. More...
 
virtual bool onWindowEvent (const WindowEvent &event)
 This function will be called whenever a window event is raised. More...
 
virtual bool onImageArrived (ImageManager *manager)
 This function will be called whenever a image arrives to the ImageManager. More...
 
- Public Member Functions inherited from rd::State
const std::string & getStateId () const
 Returns the string that identifies the state.
 
- Public Member Functions inherited from rd::ManagerHub
 ManagerHub (NetworkManager *networkManager, ImageManager *imageManager, InputManager *inputManager, MentalMap *mentalMap, asrob::IRobotManager *robotManager, AudioManager *audioManager, ScreenManager *screenManager)
 
bool setNetworkManager (NetworkManager *networkManager)
 
bool setImageManager (ImageManager *imageManager)
 
bool setInputManager (InputManager *inputManager)
 
bool setMentalMap (MentalMap *mentalMap)
 
bool setRobotManager (asrob::IRobotManager *robotManager)
 
bool setAudioManager (AudioManager *audioManager)
 
bool setScreenManager (ScreenManager *screenManager)
 

Static Public Attributes

static const int KILLED = 1
 
static const int EXIT_REQUESTED = 2
 
static const Key KEY_EXIT = rd::Key::KEY_ESCAPE
 
static const Key KEY_SHOOT = rd::Key::KEY_SPACE
 
static const Key KEY_RELOAD = 'r'
 
static const Key KEY_MOVE_FWD = 'w'
 
static const Key KEY_MOVE_BACK = 's'
 
static const Key KEY_TURN_LEFT = 'a'
 
static const Key KEY_TURN_RIGHT = 'd'
 
static const Key KEY_PAN_LEFT = rd::Key::KEY_ARROW_LEFT
 
static const Key KEY_PAN_RIGHT = rd::Key::KEY_ARROW_RIGHT
 
static const Key KEY_TILT_UP = rd::Key::KEY_ARROW_UP
 
static const Key KEY_TILT_DOWN = rd::Key::KEY_ARROW_DOWN
 

Protected Attributes

GameScreen screen
 
bool received_exit
 
ProcessorImageEventListener processorImageEventListener
 
Image last_camera_frame
 
- Protected Attributes inherited from rd::State
std::string state_id
 Name of the current state.
 
- Protected Attributes inherited from rd::ManagerHub
NetworkManagernetworkManager
 
ImageManagerimageManager
 
InputManagerinputManager
 
MentalMapmentalMap
 
asrob::IRobotManager * robotManager
 
AudioManageraudioManager
 
ScreenManagerscreenManager
 

Additional Inherited Members

- Static Public Member Functions inherited from rd::State
static StategetEndState ()
 

Detailed Description

Behavior:

Member Function Documentation

◆ cleanup()

bool rd::GameState::cleanup ( )
virtual
Returns
False if some problem ocurred

Implements rd::State.

◆ evaluateConditions()

int rd::GameState::evaluateConditions ( )
virtual

An integer value is assigned to each possible transition to identify them.

Returns
Transition selected depending on the conditions of the state

Implements rd::State.

◆ loop()

bool rd::GameState::loop ( )
virtual
Returns
False if some problem ocurred

Implements rd::State.

◆ onImageArrived()

bool rd::GameState::onImageArrived ( ImageManager manager)
virtual
Parameters
managerA reference to the ImageManager that triggered the event

Implements rd::ImageEventListener.

◆ onKeyDown()

bool rd::GameState::onKeyDown ( const Key k)
virtual
Parameters
kKey that triggered the event

Implements rd::InputEventListener.

◆ onKeyUp()

bool rd::GameState::onKeyUp ( const Key k)
virtual
Parameters
kKey that triggered the event

Implements rd::InputEventListener.

◆ onWindowEvent()

bool rd::GameState::onWindowEvent ( const WindowEvent event)
virtual
Parameters
eventWindowEvent object that wraps the window event

Implements rd::InputEventListener.

◆ setup()

bool rd::GameState::setup ( )
virtual
Returns
False if some problem ocurred

Implements rd::State.


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