stmm-games-doc  0.32.0
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
stmg::BackgroundEvent Class Reference
Inheritance diagram for stmg::BackgroundEvent:
Inheritance graph
[legend]

Classes

struct  Init
 
struct  LocalInit
 
struct  PatternImage
 Image data used to fill background animation. More...
 

Public Types

enum  {
  MESSAGE_CONTROL_STOP = 100, MESSAGE_CONTROL_RESTART = 105, MESSAGE_MOVE_PAUSE = 110, MESSAGE_MOVE_RESUME = 115,
  MESSAGE_MOVE_SET_FACTOR = 125, MESSAGE_ADD_POS_X = 140, MESSAGE_ADD_POS_Y = 141, MESSAGE_ADD_POS_X_PERC = 142,
  MESSAGE_ADD_POS_Y_PERC = 142, MESSAGE_IMG_NEXT = 150, MESSAGE_IMG_PREV = 151
}
 
- 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

 BackgroundEvent (Init &&oInit) noexcept
 Constructor. More...
 
void trigger (int32_t nMsg, int32_t nValue, Event *p0TriggeringEvent) noexcept override
 The trigger function. More...
 
void boardPreScroll (Direction::VALUE eDir, const shared_ptr< TileRect > &refTiles) noexcept override
 Pre scroll callback. More...
 
void boardPostScroll (Direction::VALUE eDir) noexcept override
 Post scroll 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::BoardScrollListener
virtual ~BoardScrollListener () noexcept=default
 

Protected Member Functions

void reInit (Init &&oInit) noexcept
 See BackgroundEvent::BackgroundEvent(). 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...
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
MESSAGE_CONTROL_STOP 

Removes the Animation.

MESSAGE_CONTROL_RESTART 

Restarts the (stopped) animation.

MESSAGE_MOVE_PAUSE 

Pauses the animation.

MESSAGE_MOVE_RESUME 

Resumes the paused animation.

MESSAGE_MOVE_SET_FACTOR 

Changes animation size keeping the center.

nValue contains perc: ex. 150 is factor ´1.5´.

MESSAGE_ADD_POS_X 

Adds nValue to the x position of the animation.

MESSAGE_ADD_POS_Y 

Adds nValue to the y position of the animation.

MESSAGE_ADD_POS_X_PERC 

Adds nValue percent (of a tile) to the x position of the animation.

MESSAGE_ADD_POS_Y_PERC 

Adds nValue percent (of a tile) to the y position of the animation.

MESSAGE_IMG_NEXT 

Uses the next pattern to fill the background.

MESSAGE_IMG_PREV 

Uses the previous pattern to fill the background.

Constructor & Destructor Documentation

◆ BackgroundEvent()

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

Constructor.

Parameters
oInitThe parameters.

Member Function Documentation

◆ boardPostScroll()

void stmg::BackgroundEvent::boardPostScroll ( Direction::VALUE  eDir)
overridevirtualnoexcept

Post scroll callback.

Called by Level::boardScroll().

Parameters
eDirThe direction of the scroll.

Implements stmg::BoardScrollListener.

◆ boardPreScroll()

void stmg::BackgroundEvent::boardPreScroll ( Direction::VALUE  eDir,
const shared_ptr< TileRect > &  refTiles 
)
overridevirtualnoexcept

Pre scroll callback.

Called by Level::boardScroll().

Parameters
eDirThe direction of the scroll.
refTilesThe tiles that will be placed on the freed cells. If null all empty tiles.

Implements stmg::BoardScrollListener.

◆ reInit()

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

See BackgroundEvent::BackgroundEvent().

◆ trigger()

void stmg::BackgroundEvent::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.