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

Fake LevelView for testing. More...

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

Classes

struct  AnimationCreate
 
struct  AnimationRemove
 
struct  BlockPostAdd
 
struct  BlockPostDestroy
 
struct  BlockPostFuse
 
struct  BlockPostRemove
 
struct  BlockPreAdd
 
struct  BlockPreDestroy
 
struct  BlockPreFuse
 
struct  BlockPreRemove
 
struct  BoabloPostFreeze
 
struct  BoabloPostUnfreeze
 
struct  BoabloPreFreeze
 
struct  BoabloPreUnfreeze
 
struct  BoardAnimateTiles
 
struct  BoardPostDestroy
 
struct  BoardPostInsert
 
struct  BoardPostModify
 
struct  BoardPostScroll
 
struct  BoardPreDestroy
 
struct  BoardPreInsert
 
struct  BoardPreModify
 
struct  BoardPreScroll
 
class  Called
 Base class for retaining callback information. More...
 

Public Member Functions

 FakeLevelView (Game *p0Game, Level *p0Level) noexcept
 
void boardAnimateTiles (NRect oArea) noexcept override
 Tells the view that an area of tiles has to be animated. More...
 
void boardAnimateTile (NPoint oXY) noexcept override
 Tells the view that a tile has to be animated. More...
 
bool animationCreate (const shared_ptr< LevelAnimation > &refLevelAnimation) noexcept override
 Creates an animation in the view. More...
 
bool animationRemove (const shared_ptr< LevelAnimation > &refLevelAnimation) noexcept override
 Removes animation from view. 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 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 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...
 
const std::vector< unique_ptr< Called > > & getAllCalled () noexcept
 The Called objects. More...
 
template<typename T >
const std::vector< T * > getCalled () noexcept
 The Called objects with a given template type. More...
 
void clear () noexcept
 Clear all Called data structures. More...
 
- Public Member Functions inherited from stmg::BoaBloListener
virtual ~BoaBloListener () noexcept=default
 
- Public Member Functions inherited from stmg::BoardScrollListener
virtual ~BoardScrollListener () noexcept=default
 

Detailed Description

Fake LevelView for testing.

Lets you collect some of the callbacks from the Level.

Constructor & Destructor Documentation

◆ FakeLevelView()

stmg::FakeLevelView::FakeLevelView ( Game p0Game,
Level p0Level 
)
noexcept

Member Function Documentation

◆ animationCreate()

bool stmg::FakeLevelView::animationCreate ( const shared_ptr< LevelAnimation > &  refLevelAnimation)
overridevirtualnoexcept

Creates an animation in the view.

It might fail because the theme has no factory for the given model or because the animation is already active.

Parameters
refLevelAnimationThe model animation. Cannot be null.
Returns
Returns false if the corresponding ThemeAnimation couldn't be created.

Implements stmg::LevelView.

◆ animationRemove()

bool stmg::FakeLevelView::animationRemove ( const shared_ptr< LevelAnimation > &  refLevelAnimation)
overridevirtualnoexcept

Removes animation from view.

Parameters
refLevelAnimationThe model animation. Cannot be null.
Returns
Returns false if the animation already expired or was never added.

Implements stmg::LevelView.

◆ blockPostAdd()

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

Post block added callback.

Called by Level::blockAdd().

Parameters
oBlockThe level block

Implements stmg::BlocksListener.

◆ blockPostDestroy()

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

Post block destroyed callback.

Called by LevelBlock::destroy().

Parameters
oBlockThe level block

Implements stmg::BlocksListener.

◆ blockPostFuse()

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

◆ blockPostRemove()

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

Post block removed callback.

Called by LevelBlock::remove().

Parameters
oBlockThe level block

Implements stmg::BlocksListener.

◆ blockPreAdd()

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

Pre block added callback.

Called by Level::blockAdd().

Parameters
oBlockThe level block

Implements stmg::BlocksListener.

◆ blockPreDestroy()

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

Pre block destroyed callback.

Called by LevelBlock::destroy().

Parameters
oBlockThe level block

Implements stmg::BlocksListener.

◆ blockPreFuse()

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

◆ blockPreRemove()

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

Pre block removed callback.

Called by LevelBlock::remove().

Parameters
oBlockThe level block

Implements stmg::BlocksListener.

◆ boabloPostFreeze()

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

◆ boardAnimateTile()

void stmg::FakeLevelView::boardAnimateTile ( NPoint  oXY)
overridevirtualnoexcept

Tells the view that a tile has to be animated.

The animation takes place in the view ticks following the game tick in which this function is called.

Parameters
oXYThe tile to animate. Must be within board.

Implements stmg::LevelView.

◆ boardAnimateTiles()

void stmg::FakeLevelView::boardAnimateTiles ( NRect  oArea)
overridevirtualnoexcept

Tells the view that an area of tiles has to be animated.

The animation takes place in the view ticks following the game tick in which this function is called.

Parameters
oAreaThe area to animate. Must be within board and not empty.

Implements stmg::LevelView.

◆ boardPostDestroy()

void stmg::FakeLevelView::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::FakeLevelView::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::FakeLevelView::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::FakeLevelView::boardPostScroll ( Direction::VALUE  eDir)
overridevirtualnoexcept

Post scroll callback.

Called by Level::boardScroll().

Parameters
eDirThe direction of the scroll.

Implements stmg::BoardScrollListener.

◆ boardPreDestroy()

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

Pre destroy callback.

Called by Level::boardDestroy().

Parameters
oCoordsThe destroyed tiles' position.

Implements stmg::BoardListener.

◆ boardPreInsert()

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

◆ clear()

void stmg::FakeLevelView::clear ( )
noexcept

Clear all Called data structures.

◆ getAllCalled()

const std::vector<unique_ptr<Called> >& stmg::FakeLevelView::getAllCalled ( )
noexcept

The Called objects.

Returns
The Called objects in the order they were added.

◆ getCalled()

template<typename T >
const std::vector<T*> stmg::FakeLevelView::getCalled ( )
inlinenoexcept

The Called objects with a given template type.

Example usage: getCalled<BlockPreDestroy>().

Returns
The vector of (non owning) pointers to Called objects in the order they were added.