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

Base class for tile drawing. More...

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

Classes

struct  Init
 

Public Types

enum  FLOW_CONTROL { FLOW_CONTROL_CONTINUE = 0, FLOW_CONTROL_STOP = 1 }
 

Public Member Functions

virtual ~StdThemeModifier () noexcept=default
 
virtual FLOW_CONTROL drawTile (const Cairo::RefPtr< Cairo::Context > &refCc, StdThemeDrawingContext &oDc, const Tile &oTile, int32_t nPlayer, const std::vector< double > &aAniElapsed) noexcept=0
 Draw tile (with player skin). More...
 
virtual void registerTileSize (int32_t nW, int32_t nH) noexcept
 Register tile size. More...
 
virtual void unregisterTileSize (int32_t nW, int32_t nH) noexcept
 Unregister tile size. More...
 
int32_t getDebugTag () const noexcept
 The debug tag. More...
 

Protected Member Functions

 StdThemeModifier (Init &&oInit) noexcept
 Constructor. More...
 
StdThemeowner () noexcept
 The theme. More...
 
const StdThemeowner () const noexcept
 The theme. More...
 

Detailed Description

Base class for tile drawing.

Member Enumeration Documentation

◆ FLOW_CONTROL

Enumerator
FLOW_CONTROL_CONTINUE 

Continue painting.

FLOW_CONTROL_STOP 

Stop painting.

Constructor & Destructor Documentation

◆ StdThemeModifier()

stmg::StdThemeModifier::StdThemeModifier ( Init &&  oInit)
explicitprotectednoexcept

Constructor.

Parameters
oInitThe initialization data.

◆ ~StdThemeModifier()

virtual stmg::StdThemeModifier::~StdThemeModifier ( )
virtualdefaultnoexcept

Member Function Documentation

◆ drawTile()

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

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.

Implemented in stmg::TextModifier, stmg::SelectAniModifier, stmg::SelectVarModifier, stmg::GrowModifier, stmg::FadeModifier, stmg::MaskModifier, stmg::IfElseModifier, stmg::SelectCaseModifier, stmg::RotateModifier, stmg::TileAniModifier, stmg::ContainerModifier, stmg::ImageModifier, stmg::FillModifier, stmg::AlphaModifier, stmg::NextSubPainterModifier, stmg::CaseModifier, stmg::SelectedImageModifier, and stmg::StopModifier.

◆ getDebugTag()

int32_t stmg::StdThemeModifier::getDebugTag ( ) const
inlinenoexcept

The debug tag.

Returns
The tag.

◆ owner() [1/2]

StdTheme* stmg::StdThemeModifier::owner ( )
inlineprotectednoexcept

The theme.

Returns
The theme. Is not null.

◆ owner() [2/2]

const StdTheme* stmg::StdThemeModifier::owner ( ) const
inlineprotectednoexcept

The theme.

Returns
The theme. Is not null.

◆ registerTileSize()

virtual void stmg::StdThemeModifier::registerTileSize ( int32_t  nW,
int32_t  nH 
)
virtualnoexcept

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 in stmg::MaskModifier, stmg::ContainerModifier, stmg::TileAniModifier, and stmg::ImageModifier.

◆ unregisterTileSize()

virtual void stmg::StdThemeModifier::unregisterTileSize ( int32_t  nW,
int32_t  nH 
)
virtualnoexcept

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 in stmg::MaskModifier, stmg::ContainerModifier, stmg::TileAniModifier, and stmg::ImageModifier.