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

Event that animates selected tiles of board and blocks. More...

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

Classes

struct  Init
 
struct  LocalInit
 

Public Types

enum  { LISTENER_GROUP_TILEANI_CHANGED = 10 }
 
- 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

 TileAnimatorEvent (Init &&oInit) noexcept
 Constructor. More...
 
void trigger (int32_t nMsg, int32_t nValue, Event *p0TriggeringEvent) noexcept override
 The trigger function. More...
 
void boabloPreFreeze (LevelBlock &oBlock) noexcept override
 Pre freeze callback. More...
 
void boabloPostFreeze (const Coords &oCoords) noexcept override
 Post freeze callback. More...
 
void boabloPreUnfreeze (const Coords &oCoords) noexcept override
 Pre unfreeze callback. More...
 
void boabloPostUnfreeze (LevelBlock &oBlock) noexcept override
 Post unfreeze callback. 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...
 
void boardPreInsert (Direction::VALUE eDir, NRect oArea, const shared_ptr< TileRect > &refTiles) noexcept override
 Pre insert callback. More...
 
void boardPostInsert (Direction::VALUE eDir, NRect oArea) noexcept override
 Post insert callback. More...
 
void boardPreDestroy (const Coords &oCoords) noexcept override
 Pre destroy callback. More...
 
void boardPostDestroy (const Coords &oCoords) noexcept override
 Post destroy callback. More...
 
void boardPreModify (const TileCoords &oTileCoords) noexcept override
 Pre modify callback. More...
 
void boardPostModify (const Coords &oCoords) noexcept override
 Post modify callback. More...
 
void blockPreAdd (const LevelBlock &oBlock) noexcept override
 Pre block added callback. More...
 
void blockPostAdd (LevelBlock &oBlock) noexcept override
 Post block added callback. More...
 
void blockPreRemove (LevelBlock &oBlock) noexcept override
 Pre block removed callback. More...
 
void blockPostRemove (const LevelBlock &oBlock) noexcept override
 Post block removed callback. More...
 
void blockPreDestroy (LevelBlock &oBlock) noexcept override
 Pre block destroyed callback. More...
 
void blockPostDestroy (const LevelBlock &oBlock) noexcept override
 Post block destroyed callback. More...
 
void blockPreFuse (LevelBlock &oFusedToBlock, LevelBlock &oFusedBlock) noexcept override
 Pre block fusion callback. More...
 
void blockPostFuse (LevelBlock &oResBlock, const LevelBlock &oFusedBlock, const std::unordered_map< int32_t, int32_t > &oFusedToBrickIds, const std::unordered_map< int32_t, int32_t > &oFusedBrickIds) noexcept override
 Post block fusion callback. More...
 
void blockPreModify (LevelBlock &oBlock, const std::vector< int32_t > &aDeleteBrickId, const std::vector< int32_t > &aModifyPosBrickId, const std::vector< int32_t > &aModifyTileBrickId, bool bAddsBricks) noexcept override
 Pre block modification callback. More...
 
void blockPostModify (LevelBlock &oBlock, const std::vector< int32_t > &aDeletedBrickId, const std::vector< int32_t > &aModifiedPosBrickId, const std::vector< int32_t > &aModifiedTileBrickId, const std::vector< int32_t > &aAddedBrickId) noexcept override
 Post block modification 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
 
- Public Member Functions inherited from stmg::BoaBloListener
virtual ~BoaBloListener () noexcept=default
 

Protected Member Functions

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

Event that animates selected tiles of board and blocks.

One animation cycle has a duration in ticks and/or milliseconds (see LocalInit::m_oDuration). At each game tick (and view tick) the progress value of the animation is brought from 0.0 to 1.0 (see TileAnimator::getElapsed01). So it is up to the theme to choose how to use the number to display the tile. For example a tile could be progressively faded: it is shown opaque at value 0.0 and becomes more and more invisible as it gets to value 1.0. Another possibility would be for the theme to show the tile at full scale at 0.0, progressively decrease the size, reaching half size at 0.5 and from there increase the size again to reach full scale at 1.0, creating a pulse effect.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
LISTENER_GROUP_TILEANI_CHANGED 

The number of animated tiles changed.

nValue contains the new number.

Constructor & Destructor Documentation

◆ TileAnimatorEvent()

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

Constructor.

All the ranges must have m_nFrom <= m_nTo. The values are chosen randomly from the ranges. The duration is always at least one tick.

Parameters
oInitThe initialization data.

Member Function Documentation

◆ blockPostAdd()

void stmg::TileAnimatorEvent::blockPostAdd ( LevelBlock oBlock)
overridevirtualnoexcept

Post block added callback.

Called by Level::blockAdd().

Parameters
oBlockThe level block

Implements stmg::BlocksListener.

◆ blockPostDestroy()

void stmg::TileAnimatorEvent::blockPostDestroy ( const LevelBlock oBlock)
overridevirtualnoexcept

Post block destroyed callback.

Called by LevelBlock::destroy().

Parameters
oBlockThe level block

Implements stmg::BlocksListener.

◆ blockPostFuse()

void stmg::TileAnimatorEvent::blockPostFuse ( LevelBlock oResBlock,
const LevelBlock oFusedBlock,
const std::unordered_map< int32_t, int32_t > &  oFusedToBrickIds,
const std::unordered_map< int32_t, int32_t > &  oFusedBrickIds 
)
overridevirtualnoexcept

Post block fusion callback.

Called by LevelBlock::fuseTo().

The TileAnimator references of oResBlock are reset. The TileAnimator references of oFusedBlock are reset.

Parameters
oResBlockis the result of the fusion (what was oFusedToBlock in blockPreFuse).
oFusedBlockis what was added to oResBlock and removed from the level.
oFusedToBrickIdsis a map of the brickIds of the original oFusedToBlock to those in oResBlock.
oFusedBrickIdsis a map of the brickIds of oFusedBlock to those in oResBlock.

Implements stmg::BlocksListener.

◆ blockPostModify()

void stmg::TileAnimatorEvent::blockPostModify ( LevelBlock oBlock,
const std::vector< int32_t > &  aDeletedBrickId,
const std::vector< int32_t > &  aModifiedPosBrickId,
const std::vector< int32_t > &  aModifiedTileBrickId,
const std::vector< int32_t > &  aAddedBrickId 
)
overridevirtualnoexcept

Post block modification callback.

Called by LevelBlock::blockModify().

When the visibility of a brick is changed its id is in aModifyPosBrickId.

Note that the implementation might pass all the bricks of a rotated block to aModifyPosBrickId without really checking whether the bricks have really changed position or their visibility. So don't rely on it.

Parameters
oBlockThe modified block.
aDeletedBrickIdThe removed bricks.
aModifiedPosBrickIdThe bricks with modified position.
aModifiedTileBrickIdThe bricks with modified tile.
aAddedBrickIdThe bricks added.

Implements stmg::BlocksBricksIdListener.

◆ blockPostRemove()

void stmg::TileAnimatorEvent::blockPostRemove ( const LevelBlock oBlock)
overridevirtualnoexcept

Post block removed callback.

Called by LevelBlock::remove().

Parameters
oBlockThe level block

Implements stmg::BlocksListener.

◆ blockPreAdd()

void stmg::TileAnimatorEvent::blockPreAdd ( const LevelBlock oBlock)
overridevirtualnoexcept

Pre block added callback.

Called by Level::blockAdd().

Parameters
oBlockThe level block

Implements stmg::BlocksListener.

◆ blockPreDestroy()

void stmg::TileAnimatorEvent::blockPreDestroy ( LevelBlock oBlock)
overridevirtualnoexcept

Pre block destroyed callback.

Called by LevelBlock::destroy().

Parameters
oBlockThe level block

Implements stmg::BlocksListener.

◆ blockPreFuse()

void stmg::TileAnimatorEvent::blockPreFuse ( LevelBlock oFusedToBlock,
LevelBlock oFusedBlock 
)
overridevirtualnoexcept

Pre block fusion callback.

Called by LevelBlock::fuseTo().

Parameters
oFusedToBlockThe block to which oFusedBlock will be attached.
oFusedBlockThe block that will be removed.

Implements stmg::BlocksListener.

◆ blockPreModify()

void stmg::TileAnimatorEvent::blockPreModify ( LevelBlock oBlock,
const std::vector< int32_t > &  aDeleteBrickId,
const std::vector< int32_t > &  aModifyPosBrickId,
const std::vector< int32_t > &  aModifyTileBrickId,
bool  bAddsBricks 
)
overridevirtualnoexcept

Pre block modification callback.

Called by LevelBlock::blockModify().

When the visibility of a brick is changed its id is in aModifyPosBrickId.

Note that the implementation might pass all the bricks of a rotated block to aModifyPosBrickId without really checking whether the bricks have really changed position or their visibility. So don't rely on it.

Parameters
oBlockThe block that will be modified.
aDeleteBrickIdThe to be removed bricks.
aModifyPosBrickIdThe bricks the position of which will be modified.
aModifyTileBrickIdThe bricks the tile of which will be modified.
bAddsBricksWhether bricks will be added.

Implements stmg::BlocksBricksIdListener.

◆ blockPreRemove()

void stmg::TileAnimatorEvent::blockPreRemove ( LevelBlock oBlock)
overridevirtualnoexcept

Pre block removed callback.

Called by LevelBlock::remove().

Parameters
oBlockThe level block

Implements stmg::BlocksListener.

◆ boabloPostFreeze()

void stmg::TileAnimatorEvent::boabloPostFreeze ( const Coords oCoords)
overridevirtualnoexcept

Post freeze callback.

The block has been removed and the board modified. Called by LevelBlock::freeze().

Parameters
oCoordsThe coords of the modified cells.

Implements stmg::BoaBloListener.

◆ boabloPostUnfreeze()

void stmg::TileAnimatorEvent::boabloPostUnfreeze ( LevelBlock oBlock)
overridevirtualnoexcept

Post unfreeze callback.

The block has been created and the board cells emptied. Called by Level::boabloUnfreeze().

Parameters
oBlock

Implements stmg::BoaBloListener.

◆ boabloPreFreeze()

void stmg::TileAnimatorEvent::boabloPreFreeze ( LevelBlock oBlock)
overridevirtualnoexcept

Pre freeze callback.

Called by LevelBlock::freeze().

Parameters
oBlockThe block that will freeze on the board.

Implements stmg::BoaBloListener.

◆ boabloPreUnfreeze()

void stmg::TileAnimatorEvent::boabloPreUnfreeze ( const Coords oCoords)
overridevirtualnoexcept

Pre unfreeze callback.

Called by Level::boabloUnfreeze().

Parameters
oCoordsThe coords of the cells that will be used for the block. Is not empty.

Implements stmg::BoaBloListener.

◆ boardPostDestroy()

void stmg::TileAnimatorEvent::boardPostDestroy ( const Coords oCoords)
overridevirtualnoexcept

Post destroy callback.

Called by Level::boardDestroy().

Parameters
oCoordsThe destroyed tiles (now empty) positions.

Implements stmg::BoardListener.

◆ boardPostInsert()

void stmg::TileAnimatorEvent::boardPostInsert ( Direction::VALUE  eDir,
NRect  oArea 
)
overridevirtualnoexcept

Post insert callback.

Called by Level::boardInsert().

Parameters
eDirThe direction.
oAreaThe modified area.

Implements stmg::BoardListener.

◆ boardPostModify()

void stmg::TileAnimatorEvent::boardPostModify ( const Coords oCoords)
overridevirtualnoexcept

Post modify callback.

Called by Level::boardModify().

Parameters
oCoordsThe positions of the modified tiles.

Implements stmg::BoardListener.

◆ boardPostScroll()

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

Post scroll callback.

Called by Level::boardScroll().

Parameters
eDirThe direction of the scroll.

Implements stmg::BoardScrollListener.

◆ boardPreDestroy()

void stmg::TileAnimatorEvent::boardPreDestroy ( const Coords oCoords)
overridevirtualnoexcept

Pre destroy callback.

Called by Level::boardDestroy().

Parameters
oCoordsThe destroyed tiles' position.

Implements stmg::BoardListener.

◆ boardPreInsert()

void stmg::TileAnimatorEvent::boardPreInsert ( Direction::VALUE  eDir,
NRect  oArea,
const shared_ptr< TileRect > &  refTiles 
)
overridevirtualnoexcept

Pre insert callback.

Called by Level::boardInsert().

Parameters
eDirThe direction.
oAreaThe area. Is within board.
refTilesThe tiles to insert.

Implements stmg::BoardListener.

◆ boardPreModify()

void stmg::TileAnimatorEvent::boardPreModify ( const TileCoords oTileCoords)
overridevirtualnoexcept

Pre modify callback.

Called by Level::boardModify().

Parameters
oTileCoordsThe new tiles and their position.

Implements stmg::BoardListener.

◆ boardPreScroll()

void stmg::TileAnimatorEvent::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::TileAnimatorEvent::reInit ( Init &&  oInit)
protectednoexcept

Reinitialization.

See constructor.

◆ trigger()

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