Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Game::SpriteMovementMotor Struct Reference

#include <sprite_movement.h>

Classes

class  FaceDownReactor
 
class  FaceLeftReactor
 
class  FaceRightReactor
 
class  FaceUpReactor
 
class  MoveDownReactor
 
class  MoveLeftReactor
 
class  MoveRightReactor
 
class  MoveUpReactor
 
struct  SpriteData
 Sprite data to be exposed for FSM mutation. More...
 

Public Types

enum  SpriteState : unsigned int {
  MOVE_UP, FACE_UP, MOVE_DOWN, FACE_DOWN,
  MOVE_LEFT, FACE_LEFT, MOVE_RIGHT, FACE_RIGHT
}
 Sprite state enum. More...
 
enum  SpriteInput : unsigned int {
  LEFT, RIGHT, UP, DOWN,
  NONE
}
 Sprite input enum. More...
 
using SpriteFSM = Events::FSM::FSM< SpriteData, SpriteState, SpriteInput, MoveUpReactor, FaceUpReactor, MoveDownReactor, FaceDownReactor, MoveLeftReactor, FaceLeftReactor, MoveRightReactor, FaceRightReactor >
 

Static Public Member Functions

static std::shared_ptr
< SpriteData
defaultSpriteData ()
 Create a default SpriteData POD. More...
 
static bool updateSprite (const std::shared_ptr< SpriteData > data, const SpriteState current_state, const double delta)
 General sprite update for each reactor. More...
 

Member Typedef Documentation

Member Enumeration Documentation

Sprite input enum.

Enumerator
LEFT 
RIGHT 
UP 
DOWN 
NONE 

Sprite state enum.

Enumerator
MOVE_UP 
FACE_UP 
MOVE_DOWN 
FACE_DOWN 
MOVE_LEFT 
FACE_LEFT 
MOVE_RIGHT 
FACE_RIGHT 

Member Function Documentation

static std::shared_ptr<SpriteData> Game::SpriteMovementMotor::defaultSpriteData ( )
inlinestatic

Create a default SpriteData POD.

Returns
Default SpriteData
static bool Game::SpriteMovementMotor::updateSprite ( const std::shared_ptr< SpriteData data,
const SpriteState  current_state,
const double  delta 
)
inlinestatic

General sprite update for each reactor.

Parameters
[in]dataSprite data
[in]current_stateThe current sprite state
[in]deltaThe update delta
Returns
true if sprite is still moving, false otherwise

References MOVE_DOWN, MOVE_LEFT, MOVE_RIGHT, and MOVE_UP.

Referenced by Game::SpriteMovementMotor::MoveUpReactor::updateState(), Game::SpriteMovementMotor::MoveDownReactor::updateState(), Game::SpriteMovementMotor::MoveLeftReactor::updateState(), and Game::SpriteMovementMotor::MoveRightReactor::updateState().


The documentation for this struct was generated from the following file: