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

The theme context for a StdTheme. More...

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

Public Member Functions

 StdThemeContext (Theme::RuntimeVariablesEnv *p0RuntimeVariablesEnv) noexcept
 Constructor. More...
 
void drawTile (int32_t nPainterIdx, const Cairo::RefPtr< Cairo::Context > &refCc, const Tile &oTile, int32_t nPlayer, const std::vector< double > &aAniElapsed) noexcept override
 Draw a tile with tile animations. More...
 
void drawTile (int32_t nPainterIdx, const Cairo::RefPtr< Cairo::Context > &refCc, const Tile &oTile, int32_t nPlayer) noexcept override
 Draw a tile without tile animations. More...
 
shared_ptr< ThemeAnimationcreateAnimation (const shared_ptr< LevelAnimation > &refLevelAnimation) noexcept override
 Create theme animation. More...
 
void preloadSound (int32_t nSoundIdx, const std::vector< shared_ptr< stmi::PlaybackCapability >> &aPlaybacks) noexcept override
 Pre-load a sound. More...
 
shared_ptr< ThemeSoundcreateSound (int32_t nSoundIdx, const std::vector< shared_ptr< stmi::PlaybackCapability >> &aPlaybacks, FPoint oXYPosition, double fZPosition, bool bRelative, double fVolume, bool bLoop) noexcept override
 Create a sound. More...
 
NSize getTileSize () const noexcept override
 Get the current tile size. More...
 
void setTileSize (NSize oSize) noexcept override
 Set the current tile size. More...
 
const Glib::RefPtr< Pango::Context > & getFontContext () noexcept override
 Get the font context. More...
 
- Public Member Functions inherited from stmg::ThemeContext
virtual ~ThemeContext () noexcept=default
 

Protected Member Functions

void reInit (Theme::RuntimeVariablesEnv *p0RuntimeVariablesEnv) noexcept
 Reinitialization. More...
 

Detailed Description

The theme context for a StdTheme.

Constructor & Destructor Documentation

◆ StdThemeContext()

stmg::StdThemeContext::StdThemeContext ( Theme::RuntimeVariablesEnv p0RuntimeVariablesEnv)
noexcept

Constructor.

Member Function Documentation

◆ createAnimation()

shared_ptr<ThemeAnimation> stmg::StdThemeContext::createAnimation ( const shared_ptr< LevelAnimation > &  refLevelAnimation)
overridevirtualnoexcept

Create theme animation.

Parameters
refLevelAnimationThe model. Cannot be null.
Returns
The theme animation or null if model not supported.

Implements stmg::ThemeContext.

◆ createSound()

shared_ptr<ThemeSound> stmg::StdThemeContext::createSound ( int32_t  nSoundIdx,
const std::vector< shared_ptr< stmi::PlaybackCapability >> &  aPlaybacks,
FPoint  oXYPosition,
double  fZPosition,
bool  bRelative,
double  fVolume,
bool  bLoop 
)
overridevirtualnoexcept

Create a sound.

Parameters
nSoundIdxThe sound index according to Named::sounds(). Must be non-negative.
aPlaybacksAll the devices the sound should be played to. Cannot be empty. Devices can be null.
oXYPositionThe x and y position at which the sound should be played.
fZPositionThe z position.
bRelativeWhether the positions are relative to the listener of each capability.
fVolumeThe volume.
bLoopWhether the sound(s) should loop.
Returns
The created compound sound or null if sound is not enabled or sound index wrong.

Implements stmg::ThemeContext.

◆ drawTile() [1/2]

void stmg::StdThemeContext::drawTile ( int32_t  nPainterIdx,
const Cairo::RefPtr< Cairo::Context > &  refCc,
const Tile oTile,
int32_t  nPlayer,
const std::vector< double > &  aAniElapsed 
)
overridevirtualnoexcept

Draw a tile with tile animations.

The elapsed values in aAniElapsed are numbers from 0.0 to 1.0 (or -1.0 if not defined). The index into aAniElapsed is the index into Theme::getNamed().tileAnis().

Parameters
nPainterIdxThe painter to use. Must be valid. If -1 the theme's default is used.
refCcThe drawing context. Cannot be null.
oTileThe tile to draw.
nPlayerThe level player or -1 if tile not part of a block.
aAniElapsedThe elapsed tile animations.

Implements stmg::ThemeContext.

◆ drawTile() [2/2]

void stmg::StdThemeContext::drawTile ( int32_t  nPainterIdx,
const Cairo::RefPtr< Cairo::Context > &  refCc,
const Tile oTile,
int32_t  nPlayer 
)
overridevirtualnoexcept

Draw a tile without tile animations.

Parameters
nPainterIdxThe painter to use. Must be valid. If -1 the theme's default is used.
refCcThe drawing context. Cannot be null.
oTileThe tile to draw.
nPlayerThe level player or -1 if tile not part of a block.

Implements stmg::ThemeContext.

◆ getFontContext()

const Glib::RefPtr<Pango::Context>& stmg::StdThemeContext::getFontContext ( )
overridevirtualnoexcept

Get the font context.

Returns
The pango context used for writing text.

Implements stmg::ThemeContext.

◆ getTileSize()

NSize stmg::StdThemeContext::getTileSize ( ) const
inlineoverridevirtualnoexcept

Get the current tile size.

Returns
The tile size in pixels.

Implements stmg::ThemeContext.

◆ preloadSound()

void stmg::StdThemeContext::preloadSound ( int32_t  nSoundIdx,
const std::vector< shared_ptr< stmi::PlaybackCapability >> &  aPlaybacks 
)
overridevirtualnoexcept

Pre-load a sound.

Parameters
nSoundIdxThe sound index according to Named::sounds(). Must be non-negative.
aPlaybacksAll the devices that should pre-load the sound. Cannot be empty. Devices can be null.

Implements stmg::ThemeContext.

◆ reInit()

void stmg::StdThemeContext::reInit ( Theme::RuntimeVariablesEnv p0RuntimeVariablesEnv)
protectednoexcept

Reinitialization.

◆ setTileSize()

void stmg::StdThemeContext::setTileSize ( NSize  oSize)
overridevirtualnoexcept

Set the current tile size.

Parameters
oSizeThe new tile size in pixels. Must be positive for both coordinates.

Implements stmg::ThemeContext.