stmm-games-doc  0.32.0
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
stmg::PositionerEvent Class Reference

The positioner event. More...

Inheritance diagram for stmg::PositionerEvent:
Inheritance graph
[legend]

Classes

struct  Init
 
struct  LocalInit
 

Public Types

enum  { MESSAGE_PAUSE_TRACKING = 100, MESSAGE_RESUME_TRACKING = 101 }
 
- Public Types inherited from stmg::Event
enum  MSG_FILTER_VALUE_OP {
  MSG_FILTER_VALUE_OP_FIRST = 0, MSG_FILTER_VALUE_OP_UNCHANGED = 0, MSG_FILTER_VALUE_OP_SET = 1, MSG_FILTER_VALUE_OP_MULT_ADD = 2,
  MSG_FILTER_VALUE_OP_DIV_ADD = 3, MSG_FILTER_VALUE_OP_PERCENT_ADD = 4, MSG_FILTER_VALUE_OP_PERMILL_ADD = 5, MSG_FILTER_VALUE_OP_MOD_ADD = 6,
  MSG_FILTER_VALUE_OP_MIN_ADD = 7, MSG_FILTER_VALUE_OP_MAX_ADD = 8, MSG_FILTER_VALUE_OP_LAST = 8
}
 Value filter. More...
 
enum  { LISTENER_GROUP_FINISHED = 0 }
 

Public Member Functions

 PositionerEvent (Init &&oInit) noexcept
 Constructor. More...
 
void trigger (int32_t nMsg, int32_t nValue, Event *p0TriggeringEvent) noexcept override
 The trigger function. More...
 
void blockChangedPlayer (LevelBlock &oLevelBlock, int32_t nOldPlayer) noexcept override
 Player change callback. More...
 
- Public Member Functions inherited from stmg::Event
virtual ~Event () noexcept=default
 
virtual void addMsgFilter (int32_t nInFromMsg, int32_t nInToMsg, int32_t nInFromValue, int32_t nInToValue, bool bOutMsgDefined, int32_t nOutMsg, MSG_FILTER_VALUE_OP eOutValueOperator, int32_t nOutValueOperand, int32_t nOutValueAdd) noexcept
 Add a message filter. More...
 
virtual void addListener (int32_t nGroupId, Event *p0ListenerEvent, int32_t nMsg) noexcept
 Adds a listener to the event. More...
 
bool isActive () const noexcept
 Tells whether the event is active. More...
 
int32_t getTriggerTime () const noexcept
 The triggering time. More...
 
int32_t getPriority () const noexcept
 The priority. More...
 
int32_t getDebugTag () const noexcept
 The debug tag. More...
 
- Public Member Functions inherited from stmg::BlocksPlayerChangeListener
virtual ~BlocksPlayerChangeListener () noexcept=default
 

Protected Member Functions

void reInit (Init &&oInit) noexcept
 See constructor. More...
 
- Protected Member Functions inherited from stmg::Event
 Event (Init &&oInit) noexcept
 Constructor. More...
 
void reInit (Init &&oInit) noexcept
 Reinitialization. More...
 
virtual void informListeners (int32_t nGroupId, int32_t nValue) noexcept
 Calls the trigger function of a group of listeners. More...
 
const Levellevel () const noexcept
 The level this event belongs to. More...
 
Levellevel () noexcept
 The level this event belongs to. More...
 

Detailed Description

The positioner event.

This event positions the level's show or player's subshow (depending on the mode) so that the controlled level block(s) are within a tracking rectangle.

In subshow mode it handles the position of each level player!

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
MESSAGE_PAUSE_TRACKING 

Pause tracking if not already paused.

MESSAGE_RESUME_TRACKING 

Resume tracking if paused.

Constructor & Destructor Documentation

◆ PositionerEvent()

stmg::PositionerEvent::PositionerEvent ( Init &&  oInit)
explicitnoexcept

Constructor.

The tracking rectangle is the area in which the level block(s) should be shown. Its position is relative to the (sub)show top left corner. If width and height are defined it must be within the subshow rectangle. If width or height are <= 0 the level block(s) (sort of) "center of mass" is always at the center of the (sub)show.

Parameters
oInitThe parameters.

Member Function Documentation

◆ blockChangedPlayer()

void stmg::PositionerEvent::blockChangedPlayer ( LevelBlock oBlock,
int32_t  nOldPlayer 
)
overridevirtualnoexcept

Player change callback.

The new player can be retrieved by LevelBlock::getPlayer().

Parameters
oBlockThe block that changed controlling player.
nOldPlayerThe old level player.

Implements stmg::BlocksPlayerChangeListener.

◆ reInit()

void stmg::PositionerEvent::reInit ( Init &&  oInit)
protectednoexcept

See constructor.

◆ trigger()

void stmg::PositionerEvent::trigger ( int32_t  nMsg,
int32_t  nValue,
Event p0TriggeringEvent 
)
overridevirtualnoexcept

The trigger function.

This function provides the functionality of the event and can be called in two ways.

It can be called by an event through informListeners() this event was listening to. Note: events can listen to themselves.

It can also be called by the timer if the event was active.

When this function is called the event has already been deactivated by the level (if it was active in the first place).

When this function is called the filters of this event have already been applied.

Parameters
nMsgThe message received.
nValueThe value received.
p0TriggeringEventThe triggering event or null if triggered by timer.

Implements stmg::Event.