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

Container modifier. More...

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

Classes

struct  Init
 
struct  LocalInit
 

Public Member Functions

 ContainerModifier (Init &&oInit) noexcept
 Constructor. More...
 
FLOW_CONTROL drawTile (const Cairo::RefPtr< Cairo::Context > &refCc, StdThemeDrawingContext &oDc, const Tile &oTile, int32_t nPlayer, const std::vector< double > &aAniElapsed) noexcept override
 Draw tile (with player skin). More...
 
void registerTileSize (int32_t nW, int32_t nH) noexcept override
 Register tile size. More...
 
void unregisterTileSize (int32_t nW, int32_t nH) noexcept override
 Unregister tile size. More...
 
virtual void applyToSubModifiers (const std::function< void(StdThemeModifier &)> &oApply) noexcept
 Apply a function to all the submodifiers. More...
 
- Public Member Functions inherited from stmg::StdThemeModifier
virtual ~StdThemeModifier () noexcept=default
 
int32_t getDebugTag () const noexcept
 The debug tag. More...
 

Static Public Member Functions

static FLOW_CONTROL drawTile (const std::vector< unique_ptr< StdThemeModifier > > &aModifiers, const Cairo::RefPtr< Cairo::Context > &refCc, StdThemeDrawingContext &oDc, const Tile &oTile, int32_t nPlayer, const std::vector< double > &aAniElapsed) noexcept
 

Protected Member Functions

FLOW_CONTROL drawContainedToWorkSurface (StdThemeDrawingContext &oDc, const Tile &oTile, int32_t nPlayer, const std::vector< double > &aAniElapsed, Cairo::RefPtr< Cairo::Surface > &refSurface) noexcept
 
- Protected Member Functions inherited from stmg::StdThemeModifier
 StdThemeModifier (Init &&oInit) noexcept
 Constructor. More...
 
StdThemeowner () noexcept
 The theme. More...
 
const StdThemeowner () const noexcept
 The theme. More...
 

Additional Inherited Members

- Public Types inherited from stmg::StdThemeModifier
enum  FLOW_CONTROL { FLOW_CONTROL_CONTINUE = 0, FLOW_CONTROL_STOP = 1 }
 

Detailed Description

Container modifier.

All modifiers with submodifiers must inherit from this class.

Constructor & Destructor Documentation

◆ ContainerModifier()

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

Constructor.

Parameters
oInitThe initialization data.

Member Function Documentation

◆ applyToSubModifiers()

virtual void stmg::ContainerModifier::applyToSubModifiers ( const std::function< void(StdThemeModifier &)> &  oApply)
virtualnoexcept

Apply a function to all the submodifiers.

The base implementation applies it to Init::m_aSubModifiers but subclasses must apply to all their additional submodifiers.

Parameters
oApplyThe function to apply to all submodifiers.

Reimplemented in stmg::SelectAniModifier, stmg::SelectVarModifier, stmg::IfElseModifier, and stmg::SelectCaseModifier.

◆ drawContainedToWorkSurface()

FLOW_CONTROL stmg::ContainerModifier::drawContainedToWorkSurface ( StdThemeDrawingContext oDc,
const Tile oTile,
int32_t  nPlayer,
const std::vector< double > &  aAniElapsed,
Cairo::RefPtr< Cairo::Surface > &  refSurface 
)
protectednoexcept

◆ drawTile() [1/2]

FLOW_CONTROL stmg::ContainerModifier::drawTile ( const Cairo::RefPtr< Cairo::Context > &  refCc,
StdThemeDrawingContext oDc,
const Tile oTile,
int32_t  nPlayer,
const std::vector< double > &  aAniElapsed 
)
overridevirtualnoexcept

Draw tile (with player skin).

Parameters
refCcThe cairo context. Cannot be null.
oDcThe theme drawing context. Cannot be null.
oTileThe tile to draw.
nPlayerThe player the tile "belongs" to. -1 means no player. Must be >= -1.
aAniElapsedThe tile animations current value.
Returns
Whether the caller should continue or stop painting.

Implements stmg::StdThemeModifier.

Reimplemented in stmg::SelectAniModifier, stmg::SelectVarModifier, stmg::GrowModifier, stmg::FadeModifier, stmg::MaskModifier, stmg::IfElseModifier, stmg::SelectCaseModifier, stmg::RotateModifier, stmg::AlphaModifier, and stmg::CaseModifier.

◆ drawTile() [2/2]

static FLOW_CONTROL stmg::ContainerModifier::drawTile ( const std::vector< unique_ptr< StdThemeModifier > > &  aModifiers,
const Cairo::RefPtr< Cairo::Context > &  refCc,
StdThemeDrawingContext oDc,
const Tile oTile,
int32_t  nPlayer,
const std::vector< double > &  aAniElapsed 
)
staticnoexcept

◆ registerTileSize()

void stmg::ContainerModifier::registerTileSize ( int32_t  nW,
int32_t  nH 
)
overridevirtualnoexcept

Register tile size.

Make sure to unregisterTileSize() when done with this size.

This method should be implemented to cache images for frequently used sizes.

Subclasses of ContainerModifier should not propagate this to contained Modifier instances since StdTheme does it automatically.

Parameters
nWThe tile width. Must be positive.
nHThe tile height. Must be positive.

Reimplemented from stmg::StdThemeModifier.

Reimplemented in stmg::MaskModifier.

◆ unregisterTileSize()

void stmg::ContainerModifier::unregisterTileSize ( int32_t  nW,
int32_t  nH 
)
overridevirtualnoexcept

Unregister tile size.

Called when a tile size no longer needed. See registerTileSize().

Parameters
nWThe tile width. Must be positive.
nHThe tile height. Must be positive.

Reimplemented from stmg::StdThemeModifier.

Reimplemented in stmg::MaskModifier.