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

Public Member Functions

 StdTheme () noexcept
 Constructor. More...
 
bool addKnownImageFile (const std::string &sImgFileName, const File &oFile) noexcept
 Add an image file name and associated file. More...
 
bool knowsImageFile (const std::string &sImgFileName) const noexcept
 Whether an image file name is already defined. More...
 
const FilegetKnownImageFile (const std::string &sImgFileName) const noexcept
 Get known image file by file name. More...
 
bool addKnownSoundFile (const std::string &sSndFileName, const File &oFile) noexcept
 Add a sound file name and associated file. More...
 
bool knowsSoundFile (const std::string &sSndFileName) const noexcept
 Whether a sound file name is already defined. More...
 
const FilegetKnownSoundFile (const std::string &sSndFileName) const noexcept
 Get known sound file by file name. More...
 
NSize getBestTileSize (int32_t nHintTileW) const noexcept override
 Get best tile size given a requested width. More...
 
double getTileWHRatio () const noexcept override
 The tile width to height ratio. More...
 
shared_ptr< ThemeContextcreateContext (NSize oTileWH, bool bRegister, double fSoundScaleX, double fSoundScaleY, double fSoundScaleZ, const Glib::RefPtr< Pango::Context > &refFontContext, RuntimeVariablesEnv *p0RuntimeVariablesEnv) noexcept override
 Create a theme context. More...
 
shared_ptr< ThemeWidgetcreateWidget (const shared_ptr< GameWidget > &refGameWidget, double fTileWHRatio, const Glib::RefPtr< Pango::Context > &refFontContext) noexcept override
 Create a theme widget from a game widget (the model). More...
 
const NamedgetNamed () const noexcept override
 The named values. More...
 
NamedgetNamed () noexcept
 The named values. More...
 
const shared_ptr< Image > & getImageByFileName (const std::string &sImgFileName) noexcept
 The image by image file name. More...
 
const shared_ptr< Image > & getImageById (const std::string &sImgId) noexcept
 The image by string image id. More...
 
const shared_ptr< Image > & getImageById (int32_t nImgId) noexcept
 The image by image id. More...
 
void addColorName (const std::string &sColorName, uint8_t nR, uint8_t nG, uint8_t nB) noexcept
 Adds a named color. More...
 
void addColorPal (int32_t nPal, uint8_t nR, uint8_t nG, uint8_t nB) noexcept
 Set the color of the palette. More...
 
bool getNamedColor (const std::string &sColorName, uint8_t &nR, uint8_t &nG, uint8_t &nB) const noexcept
 Get a named color. More...
 
bool getNamedColor (int32_t nIdx, uint8_t &nR, uint8_t &nG, uint8_t &nB) const noexcept
 Get a named color by index. More...
 
void getPalColor (int32_t nPal, uint8_t &nR, uint8_t &nG, uint8_t &nB) const noexcept
 Get palette color. More...
 
void getColorRgb (const TileColor &oColor, uint8_t &nR, uint8_t &nG, uint8_t &nB) const noexcept
 Get the rgb of a TileColor. More...
 
void setDefaultFont (const std::string &sFontDesc) noexcept
 Set the default font. More...
 
void addFontName (const std::string &sFontName, const std::string &sFontDesc) noexcept
 Add named font. More...
 
bool getNamedFont (const std::string &sFontName, std::string &sFontDesc) noexcept
 Get a named font. More...
 
bool getNamedFont (int32_t nFontIdx, std::string &sFontDesc) noexcept
 Get a named font by index. More...
 
bool isDefaultFontDefined () const noexcept
 Whether the default font was set. More...
 
const std::string & getDefaultFont () const noexcept
 Get default font description. More...
 
const std::string & getFontDesc (int32_t nFontIdx) const noexcept
 Get font description by named index or default. More...
 
bool hasImageId (const std::string &sImgId) const noexcept
 Whether a image string id was defined. More...
 
const std::string & getImageIdFileName (const std::string &sImgId) const noexcept
 The image file name of a image string id. More...
 
void addImageId (const std::string &sImgId, const std::string &sImgFileName) noexcept
 Define string image id for a known image file name. More...
 
bool hasSoundId (const std::string &sSndId) const noexcept
 Whether a sound string id was defined. More...
 
const std::string & getSoundIdFileName (const std::string &sSndId) const noexcept
 The sound file name of a sound string id. More...
 
void addSoundId (const std::string &sSndId, const std::string &sSndFileName) noexcept
 Define string sound id for a known sound file name. More...
 
bool hasArray (const std::string &sArrayId) const noexcept
 Whether a named array of images was definrd. More...
 
int32_t arraySize (const std::string &sArrayId) const noexcept
 The size of the array. More...
 
void addSubArray (const std::string &sArrayId, const std::string &sImgFileName, int32_t nImgW, int32_t nImgH, int32_t nSpacingX, int32_t nSpacingY, int32_t nPerRow, int32_t nArraySize) noexcept
 Add an array of sub images of a master image. More...
 
void addFileArray (const std::string &sArrayId, const std::vector< std::string > &aFileArray) noexcept
 Add an array of images defined by image files. More...
 
bool hasWidgetFactory (const std::string &sName) const noexcept
 Tells whether a theme widget factory with the given name exists. More...
 
void addWidgetFactory (const std::string &sName, unique_ptr< StdThemeWidgetFactory > refWidgetFactory, bool bAnonymousWidgets) noexcept
 Add a theme widget factory. More...
 
StdThemeWidgetFactorygetWidgetFactory (const std::string &sName) noexcept
 Get the theme widget factory with a given name. More...
 
bool hasAnimationFactory (const std::string &sName) const noexcept
 Tells whether a theme animation factory with the given name exists. More...
 
void addAnimationFactory (const std::string &sName, unique_ptr< StdThemeAnimationFactory > refAnimationFactory, bool bAnonymousAnimations) noexcept
 Add a theme animation factory. More...
 
StdThemeAnimationFactorygetAnimationFactory (const std::string &sName) noexcept
 Get the theme animation factory with a given name. More...
 
bool hasTileAniId (const std::string &sId) const noexcept
 Tells whether a tile animation with the given id exists. More...
 
void addTileAni (const std::string &sId, const shared_ptr< TileAni > &refTileAni) noexcept
 Add a tile animation. More...
 
const shared_ptr< TileAni > & getTileAni (const std::string &sId) noexcept
 Get a tile animation. More...
 
int32_t getAssignId (const std::string &sAssId) const noexcept
 Get the assign id from the string assign id. More...
 
bool hasAssignId (const std::string &sAssId) const noexcept
 Whether a string assign id was added. More...
 
bool hasAssignId (int32_t nAssId) const noexcept
 Whether an assign id was added. More...
 
const std::string & getAssignId (int32_t nAssId) const noexcept
 Get string assign id from assign id. More...
 
int32_t addAssign (const std::string &sAssId, std::unique_ptr< IntSet > &&refPlayerTraitSet, bool bPlayerFirst, std::vector< std::unique_ptr< TraitSet > > &&aTileTraitSets, const std::string &sArrayId, int32_t nArrayFromIdx) noexcept
 Add an image array to tile traits and players assignment. More...
 
shared_ptr< ImagegetAssignImage (int32_t sAssId, const Tile &oTile, int32_t nPlayer) const noexcept
 Get an assign image given a tile and player. More...
 
int32_t addPainter (const std::string &sPainterName, std::vector< unique_ptr< StdThemeModifier > > &&aModifiers) noexcept
 Add modifiers to a painter. More...
 
void setDefaultPainter (int32_t nPainterIdx) noexcept
 Sets the default painter name. More...
 
int32_t getDefaultPainterIdx () noexcept
 The default painter. More...
 
int32_t getVariableIndex (const std::string &sVariableName) noexcept
 
- Public Member Functions inherited from stmg::Theme
virtual ~Theme () noexcept=default
 

Constructor & Destructor Documentation

◆ StdTheme()

stmg::StdTheme::StdTheme ( )
noexcept

Constructor.

Member Function Documentation

◆ addAnimationFactory()

void stmg::StdTheme::addAnimationFactory ( const std::string &  sName,
unique_ptr< StdThemeAnimationFactory refAnimationFactory,
bool  bAnonymousAnimations 
)
noexcept

Add a theme animation factory.

If a factory with the given name already exists nothing is added.

Parameters
sNameThe name. Cannot be empty.
refAnimationFactoryThe factory. Cannot be null.
bAnonymousAnimationsWhether the factory should be used for anonymous model animations.

◆ addAssign()

int32_t stmg::StdTheme::addAssign ( const std::string &  sAssId,
std::unique_ptr< IntSet > &&  refPlayerTraitSet,
bool  bPlayerFirst,
std::vector< std::unique_ptr< TraitSet > > &&  aTileTraitSets,
const std::string &  sArrayId,
int32_t  nArrayFromIdx 
)
noexcept

Add an image array to tile traits and players assignment.

If an assign with the given id already exists nothing is added.

The total number of traits must be positive. The array of images must be big enough (from nArrayFromIdx) to provide an image for each trait set combination.

Example: the images of a snake's head, body and tail for two players are assigned to tiles with TileChar "H","B","T" and players 0 and 1. The array of images would be H0, B0, T0, H1, B1, T1. In this case the player is more significant since all the images of the first player (0) come first.

Parameters
sAssIdThe string assign id. Cannot be empty.
refPlayerTraitSetThe player set. Can be null if a non empty trait set is defined.
bPlayerFirstWhether players are more significant than tile traits or vice versa.
aTileTraitSetsThe tile trait sets. Can be empty if a non empty player trait set is defined.
sArrayIdThe array of images. Must exist.
nArrayFromIdxFrom which image to start.
Returns
The created or already existing assign id.

◆ addColorName()

void stmg::StdTheme::addColorName ( const std::string &  sColorName,
uint8_t  nR,
uint8_t  nG,
uint8_t  nB 
)
noexcept

Adds a named color.

If the name already exists. this function does nothing.

Parameters
sColorNameThe color name. Cannot be empty.
nRThe red.
nGThe green.
nBThe blue.

◆ addColorPal()

void stmg::StdTheme::addColorPal ( int32_t  nPal,
uint8_t  nR,
uint8_t  nG,
uint8_t  nB 
)
noexcept

Set the color of the palette.

Uninitialized palette numbers are black (0,0,0).

Parameters
nPalThe palette number. Must be >= 0 and <= TileColor::COLOR_PAL_LAST.
nRThe red.
nGThe green.
nBThe blue.

◆ addFileArray()

void stmg::StdTheme::addFileArray ( const std::string &  sArrayId,
const std::vector< std::string > &  aFileArray 
)
noexcept

Add an array of images defined by image files.

If an array (of any kind) with the given name already exists, this function does nothing.

Parameters
sArrayIdThe string array id. Cannot be empty.
aFileArrayThe image file names. Must have been added with addKnownImageFile(). Cannot be empty.

◆ addFontName()

void stmg::StdTheme::addFontName ( const std::string &  sFontName,
const std::string &  sFontDesc 
)
noexcept

Add named font.

Parameters
sFontNameThe font name. Cannot be empty.
sFontDescThe font description as used with Pango::FontDescription. Cannot be empty.

◆ addImageId()

void stmg::StdTheme::addImageId ( const std::string &  sImgId,
const std::string &  sImgFileName 
)
noexcept

Define string image id for a known image file name.

The image file name must already have been added with addKnownImageFile().

Parameters
sImgIdThe image string id. Cannot be empty. Example: "ball".
sImgFileNameThe image file name. Cannot be empty. Example: "ball.svg".

◆ addKnownImageFile()

bool stmg::StdTheme::addKnownImageFile ( const std::string &  sImgFileName,
const File oFile 
)
noexcept

Add an image file name and associated file.

If the name already exists does nothing and returns false.

Parameters
sImgFileNameThe image file name. Cannot be empty. Example: "ball.svg".
oFileThe associated file. Must be defined. Example: "/usr/share/stmm-games/themes/simple.thm/images/ball.svg".

◆ addKnownSoundFile()

bool stmg::StdTheme::addKnownSoundFile ( const std::string &  sSndFileName,
const File oFile 
)
noexcept

Add a sound file name and associated file.

If the name already exists does nothing and returns false.

Parameters
sSndFileNameThe sound file name. Cannot be empty. Example: "explode.wav".
oFileThe associated file. Must be defined. Example: "/usr/share/stmm-games/themes/simple.thm/sounds/explode.wav".

◆ addPainter()

int32_t stmg::StdTheme::addPainter ( const std::string &  sPainterName,
std::vector< unique_ptr< StdThemeModifier > > &&  aModifiers 
)
noexcept

Add modifiers to a painter.

If a painter with given name doesn't already exist, one is created with an associated (empty) array of modifiers. Modifiers are sort of instructions used to draw a single tile taking into account tile animations.

The passed aModifiers are appended to the array of modifiers of that painter, followed by a StopModifier. These are considered as a sub painter.

A painter starts painting from index 0 of the array of modifiers and stops at the first occurrence of a StopModifier. If a NextSubPainterModifier is encountered it jumps to the first modifier of the next sub painter or stops if there isn't one.

Parameters
sPainterNameThe painter`s name. Cannot be empty.
aModifiersThe modifiers. The vector's values cannot be null.
Returns
The painter index into Named::painters().

◆ addSoundId()

void stmg::StdTheme::addSoundId ( const std::string &  sSndId,
const std::string &  sSndFileName 
)
noexcept

Define string sound id for a known sound file name.

The sound file name must already have been added with addKnownSoundFile().

Parameters
sSndIdThe sound string id. Cannot be empty. Example: "explode".
sSndFileNameThe sound file name. Cannot be empty. Example: "explode.wav".

◆ addSubArray()

void stmg::StdTheme::addSubArray ( const std::string &  sArrayId,
const std::string &  sImgFileName,
int32_t  nImgW,
int32_t  nImgH,
int32_t  nSpacingX,
int32_t  nSpacingY,
int32_t  nPerRow,
int32_t  nArraySize 
)
noexcept

Add an array of sub images of a master image.

If an array (of any kind) with the given name already exists, this function does nothing.

The sub images start at position 0,0 within the master image (defined by sImgFileName).

Parameters
sArrayIdThe string array id. Cannot be empty.
sImgFileNameThe image file. Must have been added with addKnownImageFile().
nImgWThe sub images width in pixwls. Must be positive.
nImgHThe sub images height in pixwls. Must be positive.
nSpacingXThe horizontal spacing of the sub images. Cannot be negative.
nSpacingYThe vertical spacing of the sub images. Cannot be negative.
nPerRowThe number of sub images per row. Must be positive.
nArraySizeThe total number of sub images. Must be positive.

◆ addTileAni()

void stmg::StdTheme::addTileAni ( const std::string &  sId,
const shared_ptr< TileAni > &  refTileAni 
)
noexcept

Add a tile animation.

If a tile animation with the given id already exists nothing is added.

Parameters
sIdThe id. Cannot be e empty.
refTileAniThe tile animation. Cannot be null.

◆ addWidgetFactory()

void stmg::StdTheme::addWidgetFactory ( const std::string &  sName,
unique_ptr< StdThemeWidgetFactory refWidgetFactory,
bool  bAnonymousWidgets 
)
noexcept

Add a theme widget factory.

If a factory with the given name already exists nothing is added.

Parameters
sNameThe name of the factory. Cannot be empty.
refWidgetFactoryThe theme widget factory. Cannot be null.
bAnonymousWidgetsWhether the factory should be used for anonymous model widgets.

◆ arraySize()

int32_t stmg::StdTheme::arraySize ( const std::string &  sArrayId) const
noexcept

The size of the array.

Parameters
sArrayIdThe array string id. Cannot be empty.
Returns
The number of images in the array.

◆ createContext()

shared_ptr<ThemeContext> stmg::StdTheme::createContext ( NSize  oTileWH,
bool  bRegister,
double  fSoundScaleX,
double  fSoundScaleY,
double  fSoundScaleZ,
const Glib::RefPtr< Pango::Context > &  refFontContext,
RuntimeVariablesEnv p0RuntimeVariablesEnv 
)
overridevirtualnoexcept

Create a theme context.

The bRegister value tells to the theme whether the tile size of the context is stable and will be used often. If true images and possibly other data structures might be cached.

Parameters
oTileWHThe initial tile width and height in pixels.
bRegisterWhether the tile size of the context should be registered.
fSoundScaleXThe tile to sound reference system scale for the x axis.
fSoundScaleYThe tile to sound reference system scale for the y axis.
fSoundScaleZThe tile to sound reference system scale for the z axis.
refFontContextThe font context. Cannot be null.
p0RuntimeVariablesEnvCannot be null.
Returns
The theme context.

Implements stmg::Theme.

◆ createWidget()

shared_ptr<ThemeWidget> stmg::StdTheme::createWidget ( const shared_ptr< GameWidget > &  refGameWidget,
double  fTileWHRatio,
const Glib::RefPtr< Pango::Context > &  refFontContext 
)
overridevirtualnoexcept

Create a theme widget from a game widget (the model).

Parameters
refGameWidgetThe game widget. Cannot be null.
fTileWHRatioThe tile wh ratio. Must be positive.
refFontContextThe font context. Cannot be null.
Returns
The created theme widget or null if model not supported.

Implements stmg::Theme.

◆ getAnimationFactory()

StdThemeAnimationFactory* stmg::StdTheme::getAnimationFactory ( const std::string &  sName)
noexcept

Get the theme animation factory with a given name.

Parameters
sNameThe name of the factory. Cannot be empty.
Returns
The factory or null if not defined.

◆ getAssignId() [1/2]

int32_t stmg::StdTheme::getAssignId ( const std::string &  sAssId) const
noexcept

Get the assign id from the string assign id.

Parameters
sAssIdThe string assign id. Cannot be empty.
Returns
The assign id or -1 if not defined.

◆ getAssignId() [2/2]

const std::string& stmg::StdTheme::getAssignId ( int32_t  nAssId) const
noexcept

Get string assign id from assign id.

Parameters
nAssIdThe assign id.
Returns
The string id.

◆ getAssignImage()

shared_ptr<Image> stmg::StdTheme::getAssignImage ( int32_t  sAssId,
const Tile oTile,
int32_t  nPlayer 
) const
noexcept

Get an assign image given a tile and player.

Parameters
sAssIdThe string assign id. Cannot be empty.
oTileThe tile that chooses the image.
nPlayerThe player. Can be -1 if not defined.
Returns
The image or null if outside the ranges of the assign.

◆ getBestTileSize()

NSize stmg::StdTheme::getBestTileSize ( int32_t  nHintTileW) const
overridevirtualnoexcept

Get best tile size given a requested width.

Parameters
nHintTileWThe requested width. If 0 the minimum size is returned.
Returns
The best size.

Implements stmg::Theme.

◆ getColorRgb()

void stmg::StdTheme::getColorRgb ( const TileColor oColor,
uint8_t &  nR,
uint8_t &  nG,
uint8_t &  nB 
) const
noexcept

Get the rgb of a TileColor.

Parameters
oColorThe tile color.
nR[output] The red.
nG[output] The green.
nB[output] The blue.

◆ getDefaultFont()

const std::string& stmg::StdTheme::getDefaultFont ( ) const
noexcept

Get default font description.

Returns
The default font description (see Pango::FontDescription).

◆ getDefaultPainterIdx()

int32_t stmg::StdTheme::getDefaultPainterIdx ( )
noexcept

The default painter.

Returns
The default painter index into Named::painters() or -1 if no painters defined.

◆ getFontDesc()

const std::string& stmg::StdTheme::getFontDesc ( int32_t  nFontIdx) const
noexcept

Get font description by named index or default.

Parameters
nFontIdxThe index into getNamed().fonts(). If -1 or invalid default is returned.
Returns
The font description (see Pango::FontDescription).

◆ getImageByFileName()

const shared_ptr<Image>& stmg::StdTheme::getImageByFileName ( const std::string &  sImgFileName)
noexcept

The image by image file name.

This will load the image if necessary.

Parameters
sImgFileNameThe image file name. Cannot be empty. Example: "ball.svg".
Returns
The image or null if not defined.

◆ getImageById() [1/2]

const shared_ptr<Image>& stmg::StdTheme::getImageById ( const std::string &  sImgId)
noexcept

The image by string image id.

This will load the image if necessary.

Parameters
sImgIdThe image string id. Cannot be empty. Example: "ball".
Returns
The image or null if not defined.

◆ getImageById() [2/2]

const shared_ptr<Image>& stmg::StdTheme::getImageById ( int32_t  nImgId)
noexcept

The image by image id.

This will load the image if necessary.

To get the id from a string id use getNamed().images().getIndex(sImgId).

This function is faster than getImageById(const std::string& sImgId).

Parameters
nImgIdThe image id. Must be >= 0.
Returns
The image or null if not defined.

◆ getImageIdFileName()

const std::string& stmg::StdTheme::getImageIdFileName ( const std::string &  sImgId) const
noexcept

The image file name of a image string id.

Parameters
sImgIdThe image string id. Cannot be empty. Example: "ball".
Returns
The file name or empty string if not defined.

◆ getKnownImageFile()

const File& stmg::StdTheme::getKnownImageFile ( const std::string &  sImgFileName) const
noexcept

Get known image file by file name.

Parameters
sImgFileNameThe image file name. Cannot be empty. Example: "ball.svg".
Returns
The file. If not found File::isUndefined() is true.

◆ getKnownSoundFile()

const File& stmg::StdTheme::getKnownSoundFile ( const std::string &  sSndFileName) const
noexcept

Get known sound file by file name.

Parameters
sSndFileNameThe sound file name. Cannot be empty. Example: "explode.wav".
Returns
The file. If not found File::isUndefined() is true.

◆ getNamed() [1/2]

const Named& stmg::StdTheme::getNamed ( ) const
inlineoverridevirtualnoexcept

The named values.

Contains the strings relevant to the game.

Returns
The named values.

Implements stmg::Theme.

◆ getNamed() [2/2]

Named& stmg::StdTheme::getNamed ( )
inlinenoexcept

The named values.

Contains the strings relevant to the game.

Returns
The named values.

◆ getNamedColor() [1/2]

bool stmg::StdTheme::getNamedColor ( const std::string &  sColorName,
uint8_t &  nR,
uint8_t &  nG,
uint8_t &  nB 
) const
noexcept

Get a named color.

Parameters
sColorNameThe color name.
nR[output] The red.
nG[output] The green.
nB[output] The blue.
Returns
Whether the name was defined.

◆ getNamedColor() [2/2]

bool stmg::StdTheme::getNamedColor ( int32_t  nIdx,
uint8_t &  nR,
uint8_t &  nG,
uint8_t &  nB 
) const
noexcept

Get a named color by index.

Parameters
nIdxThe index into getNamed().colors().
nR[output] The red.
nG[output] The green.
nB[output] The blue.
Returns
Whether the (indexed) name was defined.

◆ getNamedFont() [1/2]

bool stmg::StdTheme::getNamedFont ( const std::string &  sFontName,
std::string &  sFontDesc 
)
noexcept

Get a named font.

Parameters
sFontNameThe font name. Cannot be empty.
sFontDesc[output] The font description (see Pango::FontDescription).
Returns
Whether the font name was defined.

◆ getNamedFont() [2/2]

bool stmg::StdTheme::getNamedFont ( int32_t  nFontIdx,
std::string &  sFontDesc 
)
noexcept

Get a named font by index.

Parameters
nFontIdxThe index into getNamed().fonts().
sFontDesc[output] The font description (see Pango::FontDescription).
Returns
Whether the font name was defined.

◆ getPalColor()

void stmg::StdTheme::getPalColor ( int32_t  nPal,
uint8_t &  nR,
uint8_t &  nG,
uint8_t &  nB 
) const
noexcept

Get palette color.

Parameters
nPalThe palette number. Must be >= 0 and <= TileColor::COLOR_PAL_LAST.
nR[output] The red.
nG[output] The green.
nB[output] The blue.

◆ getSoundIdFileName()

const std::string& stmg::StdTheme::getSoundIdFileName ( const std::string &  sSndId) const
noexcept

The sound file name of a sound string id.

Parameters
sSndIdThe sound string id. Cannot be empty. Example: "explode".
Returns
The file name or empty string if not defined.

◆ getTileAni()

const shared_ptr<TileAni>& stmg::StdTheme::getTileAni ( const std::string &  sId)
noexcept

Get a tile animation.

Parameters
sIdThe id. Must exist.
Returns
The tile animation.

◆ getTileWHRatio()

double stmg::StdTheme::getTileWHRatio ( ) const
overridevirtualnoexcept

The tile width to height ratio.

According to nTileW ~= fTileWHRatio * nTileH.

Returns
The ratio.

Implements stmg::Theme.

◆ getVariableIndex()

int32_t stmg::StdTheme::getVariableIndex ( const std::string &  sVariableName)
noexcept

◆ getWidgetFactory()

StdThemeWidgetFactory* stmg::StdTheme::getWidgetFactory ( const std::string &  sName)
noexcept

Get the theme widget factory with a given name.

Parameters
sNameThe name of the factory. Cannot be empty.
Returns
The factory or null if not defined.

◆ hasAnimationFactory()

bool stmg::StdTheme::hasAnimationFactory ( const std::string &  sName) const
noexcept

Tells whether a theme animation factory with the given name exists.

The names are stored getNamed().animations() and are used in the GameWidget to express a preference for a factory.

Parameters
sNameThe animation factory name. Cannot be empty.
Returns
Whether factory exists.

◆ hasArray()

bool stmg::StdTheme::hasArray ( const std::string &  sArrayId) const
noexcept

Whether a named array of images was definrd.

Parameters
sArrayIdThe array string id. Cannot be empty.
Returns
Whether array defined.

◆ hasAssignId() [1/2]

bool stmg::StdTheme::hasAssignId ( const std::string &  sAssId) const
noexcept

Whether a string assign id was added.

Parameters
sAssIdThe string assign id. Cannot be empty.
Returns
Whether defined.

◆ hasAssignId() [2/2]

bool stmg::StdTheme::hasAssignId ( int32_t  nAssId) const
noexcept

Whether an assign id was added.

Parameters
nAssIdThe assign id.
Returns
Whether defined.

◆ hasImageId()

bool stmg::StdTheme::hasImageId ( const std::string &  sImgId) const
noexcept

Whether a image string id was defined.

Parameters
sImgIdThe image string id. Cannot be empty. Example: "ball".
Returns
Whether id defined.

◆ hasSoundId()

bool stmg::StdTheme::hasSoundId ( const std::string &  sSndId) const
noexcept

Whether a sound string id was defined.

Parameters
sSndIdThe sound string id. Cannot be empty. Example: "explode".
Returns
Whether id defined.

◆ hasTileAniId()

bool stmg::StdTheme::hasTileAniId ( const std::string &  sId) const
noexcept

Tells whether a tile animation with the given id exists.

Parameters
sIdThe id. Cannot be e empty.
Returns
Whether a tile animation was added.

◆ hasWidgetFactory()

bool stmg::StdTheme::hasWidgetFactory ( const std::string &  sName) const
noexcept

Tells whether a theme widget factory with the given name exists.

The names are stored getNamed().widgets() and are used in the GameWidget to express a preference for a factory.

Parameters
sNameThe widget factory name. Cannot be empty.
Returns
Whether factory exists.

◆ isDefaultFontDefined()

bool stmg::StdTheme::isDefaultFontDefined ( ) const
noexcept

Whether the default font was set.

Returns
Whether set.

◆ knowsImageFile()

bool stmg::StdTheme::knowsImageFile ( const std::string &  sImgFileName) const
noexcept

Whether an image file name is already defined.

Parameters
sImgFileNameThe image file name. Cannot be empty. Example: "ball.svg".
Returns
Whether already defined.

◆ knowsSoundFile()

bool stmg::StdTheme::knowsSoundFile ( const std::string &  sSndFileName) const
noexcept

Whether a sound file name is already defined.

Parameters
sSndFileNameThe sound file name. Cannot be empty. Example: "explode.wav".
Returns
Whether already defined.

◆ setDefaultFont()

void stmg::StdTheme::setDefaultFont ( const std::string &  sFontDesc)
noexcept

Set the default font.

If the default font is already set, does nothing.

Parameters
sFontDescThe font name. Cannot be empty.

◆ setDefaultPainter()

void stmg::StdTheme::setDefaultPainter ( int32_t  nPainterIdx)
noexcept

Sets the default painter name.

If a default was already set this function does nothing.

The painter must have been previously added with addPainter().

Parameters
nPainterIdxThe default painter index into Named::painters(). Must be valid.