StateControl::StateLoop Struct Reference

#include <StateControl.h>

Description

Designates execution instructions for a state.

During each state, different logic is disgnated to run to control what happens during this state and when the state should be altered. The StepFunc of the state loop is is meant to hold the bult of the logic, but it also returns what state should be transitioned to. If the state is to be kept the same, the StepFunc should simply return the empty string. The DrawFunc can be used to produce visual effects associated with the state, but may not change the current state.

If the state tag returned by the StepFunc does not refer to a valid state part of StateControl, the execution state of the StateControl halts. After being halted, the state machine will remain idle until the next Execute() is called.

It is possible to have multiple StepFuncs associated with the same state. In such a case, the last added StepFunc will be run first. If any StepFunc requests to move to another state, all remaining StepFuncs that would would have been run are instead dropped. Note that a request to state-change to the same state also drops all the remaining StepFuncs and triggers. its InitFuncs. To continue normally, the empty string should be returned.

Functions

 StateLoop (Component::EventHandler step=nullptr, Component::EventHandler draw=nullptr, Component::EventHandler init=nullptr, void *data_=nullptr)
 

Constructor & Destructor Documentation

StateLoop ( Component::EventHandler  step = nullptr,
Component::EventHandler  draw = nullptr,
Component::EventHandler  init = nullptr,
void *  data_ = nullptr 
)
inline

Creates a new StateLoop.


The documentation for this struct was generated from the following file:
  • /home/jc/git/Dynacoe/DynacoeSrc/includes/Dynacoe/Components/StateControl.h