A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
Field::StateManager Class Reference

#include <StateManager.hh>

Description

Base class that represents different "states" for an object.

Some objects inherit from this class in order to define unique behavior depending on what the current "state" of the object is. For example, FireSnakes may be falling from the sun, resting, or jumping. Each state has an "enter" and a "calc" function. The object that inherits this class is responsible for defining how many states there are and must specify the enter and calc functions for each of those states. The object is also responsible for defining the transition points (i.e. the criteria to move from one state to another).

Definition at line 29 of file StateManager.hh.

Inheritance diagram for Field::StateManager:

Protected Member Functions

 StateManager (void *obj, const std::span< const StateManagerEntry > &entries)
 
void calc ()
 

Protected Attributes

u16 m_currentStateId
 
s32 m_nextStateId
 
u32 m_currentFrame
 
std::span< u16m_entryIds
 
std::span< const StateManagerEntrym_entries
 
void * m_obj
 

Constructor & Destructor Documentation

◆ StateManager()

Field::StateManager::StateManager ( void * obj,
const std::span< const StateManagerEntry > & entries )
inlineprotected

Definition at line 31 of file StateManager.hh.

◆ ~StateManager()

virtual Field::StateManager::~StateManager ( )
inlineprotectedvirtual

Definition at line 46 of file StateManager.hh.

Member Function Documentation

◆ calc()

void Field::StateManager::calc ( )
inlineprotected

Definition at line 50 of file StateManager.hh.

Member Data Documentation

◆ m_currentFrame

u32 Field::StateManager::m_currentFrame
protected

Definition at line 68 of file StateManager.hh.

◆ m_currentStateId

u16 Field::StateManager::m_currentStateId
protected

Definition at line 66 of file StateManager.hh.

◆ m_entries

std::span<const StateManagerEntry> Field::StateManager::m_entries
protected

Definition at line 70 of file StateManager.hh.

◆ m_entryIds

std::span<u16> Field::StateManager::m_entryIds
protected

Definition at line 69 of file StateManager.hh.

◆ m_nextStateId

s32 Field::StateManager::m_nextStateId
protected

Definition at line 67 of file StateManager.hh.

◆ m_obj

void* Field::StateManager::m_obj
protected

Definition at line 71 of file StateManager.hh.