stmm-games-doc  0.32.0
Public Member Functions | List of all members
stmg::ThemeContext Class Referenceabstract
Inheritance diagram for stmg::ThemeContext:
Inheritance graph
[legend]

Public Member Functions

virtual ~ThemeContext () noexcept=default
 
virtual shared_ptr< ThemeAnimationcreateAnimation (const shared_ptr< LevelAnimation > &refLevelAnimation) noexcept=0
 Create theme animation. More...
 
virtual void preloadSound (int32_t nSoundIdx, const std::vector< shared_ptr< stmi::PlaybackCapability >> &aPlaybacks) noexcept=0
 Pre-load a sound. More...
 
virtual 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=0
 Create a sound. More...
 
virtual void drawTile (int32_t nPainterIdx, const Cairo::RefPtr< Cairo::Context > &refCc, const Tile &oTile, int32_t nPlayer, const std::vector< double > &aAniElapsed) noexcept=0
 Draw a tile with tile animations. More...
 
virtual void drawTile (int32_t nPainterIdx, const Cairo::RefPtr< Cairo::Context > &refCc, const Tile &oTile, int32_t nPlayer) noexcept=0
 Draw a tile without tile animations. More...
 
virtual NSize getTileSize () const noexcept=0
 Get the current tile size. More...
 
virtual void setTileSize (NSize oSize) noexcept=0
 Set the current tile size. More...
 
virtual const Glib::RefPtr< Pango::Context > & getFontContext () noexcept=0
 Get the font context. More...
 

Constructor & Destructor Documentation

◆ ~ThemeContext()

virtual stmg::ThemeContext::~ThemeContext ( )
virtualdefaultnoexcept

Member Function Documentation

◆ createAnimation()

virtual shared_ptr<ThemeAnimation> stmg::ThemeContext::createAnimation ( const shared_ptr< LevelAnimation > &  refLevelAnimation)
pure virtualnoexcept

Create theme animation.

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

Implemented in stmg::StdThemeContext.

◆ createSound()

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

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.

Implemented in stmg::StdThemeContext.

◆ drawTile() [1/2]

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

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.

Implemented in stmg::StdThemeContext.

◆ drawTile() [2/2]

virtual void stmg::ThemeContext::drawTile ( int32_t  nPainterIdx,
const Cairo::RefPtr< Cairo::Context > &  refCc,
const Tile oTile,
int32_t  nPlayer 
)
pure virtualnoexcept

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.

Implemented in stmg::StdThemeContext.

◆ getFontContext()

virtual const Glib::RefPtr<Pango::Context>& stmg::ThemeContext::getFontContext ( )
pure virtualnoexcept

Get the font context.

Returns
The pango context used for writing text.

Implemented in stmg::StdThemeContext.

◆ getTileSize()

virtual NSize stmg::ThemeContext::getTileSize ( ) const
pure virtualnoexcept

Get the current tile size.

Returns
The tile size in pixels.

Implemented in stmg::StdThemeContext.

◆ preloadSound()

virtual void stmg::ThemeContext::preloadSound ( int32_t  nSoundIdx,
const std::vector< shared_ptr< stmi::PlaybackCapability >> &  aPlaybacks 
)
pure virtualnoexcept

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.

Implemented in stmg::StdThemeContext.

◆ setTileSize()

virtual void stmg::ThemeContext::setTileSize ( NSize  oSize)
pure virtualnoexcept

Set the current tile size.

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

Implemented in stmg::StdThemeContext.