|
stmm-games-doc
0.32.0
|

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 File & | getKnownImageFile (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 File & | getKnownSoundFile (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< ThemeContext > | createContext (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< ThemeWidget > | createWidget (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 Named & | getNamed () const noexcept override |
| The named values. More... | |
| Named & | getNamed () 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... | |
| StdThemeWidgetFactory * | getWidgetFactory (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... | |
| StdThemeAnimationFactory * | getAnimationFactory (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< Image > | getAssignImage (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 |
|
noexcept |
Constructor.
|
noexcept |
Add a theme animation factory.
If a factory with the given name already exists nothing is added.
| sName | The name. Cannot be empty. |
| refAnimationFactory | The factory. Cannot be null. |
| bAnonymousAnimations | Whether the factory should be used for anonymous model animations. |
|
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.
| sAssId | The string assign id. Cannot be empty. |
| refPlayerTraitSet | The player set. Can be null if a non empty trait set is defined. |
| bPlayerFirst | Whether players are more significant than tile traits or vice versa. |
| aTileTraitSets | The tile trait sets. Can be empty if a non empty player trait set is defined. |
| sArrayId | The array of images. Must exist. |
| nArrayFromIdx | From which image to start. |
|
noexcept |
Adds a named color.
If the name already exists. this function does nothing.
| sColorName | The color name. Cannot be empty. |
| nR | The red. |
| nG | The green. |
| nB | The blue. |
|
noexcept |
Set the color of the palette.
Uninitialized palette numbers are black (0,0,0).
| nPal | The palette number. Must be >= 0 and <= TileColor::COLOR_PAL_LAST. |
| nR | The red. |
| nG | The green. |
| nB | The blue. |
|
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.
| sArrayId | The string array id. Cannot be empty. |
| aFileArray | The image file names. Must have been added with addKnownImageFile(). Cannot be empty. |
|
noexcept |
Add named font.
| sFontName | The font name. Cannot be empty. |
| sFontDesc | The font description as used with Pango::FontDescription. Cannot be empty. |
|
noexcept |
Define string image id for a known image file name.
The image file name must already have been added with addKnownImageFile().
| sImgId | The image string id. Cannot be empty. Example: "ball". |
| sImgFileName | The image file name. Cannot be empty. Example: "ball.svg". |
|
noexcept |
Add an image file name and associated file.
If the name already exists does nothing and returns false.
| sImgFileName | The image file name. Cannot be empty. Example: "ball.svg". |
| oFile | The associated file. Must be defined. Example: "/usr/share/stmm-games/themes/simple.thm/images/ball.svg". |
|
noexcept |
Add a sound file name and associated file.
If the name already exists does nothing and returns false.
| sSndFileName | The sound file name. Cannot be empty. Example: "explode.wav". |
| oFile | The associated file. Must be defined. Example: "/usr/share/stmm-games/themes/simple.thm/sounds/explode.wav". |
|
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.
| sPainterName | The painter`s name. Cannot be empty. |
| aModifiers | The modifiers. The vector's values cannot be null. |
|
noexcept |
Define string sound id for a known sound file name.
The sound file name must already have been added with addKnownSoundFile().
| sSndId | The sound string id. Cannot be empty. Example: "explode". |
| sSndFileName | The sound file name. Cannot be empty. Example: "explode.wav". |
|
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).
| sArrayId | The string array id. Cannot be empty. |
| sImgFileName | The image file. Must have been added with addKnownImageFile(). |
| nImgW | The sub images width in pixwls. Must be positive. |
| nImgH | The sub images height in pixwls. Must be positive. |
| nSpacingX | The horizontal spacing of the sub images. Cannot be negative. |
| nSpacingY | The vertical spacing of the sub images. Cannot be negative. |
| nPerRow | The number of sub images per row. Must be positive. |
| nArraySize | The total number of sub images. Must be positive. |
|
noexcept |
Add a tile animation.
If a tile animation with the given id already exists nothing is added.
| sId | The id. Cannot be e empty. |
| refTileAni | The tile animation. Cannot be null. |
|
noexcept |
Add a theme widget factory.
If a factory with the given name already exists nothing is added.
| sName | The name of the factory. Cannot be empty. |
| refWidgetFactory | The theme widget factory. Cannot be null. |
| bAnonymousWidgets | Whether the factory should be used for anonymous model widgets. |
|
noexcept |
The size of the array.
| sArrayId | The array string id. Cannot be empty. |
|
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.
| oTileWH | The initial tile width and height in pixels. |
| bRegister | Whether the tile size of the context should be registered. |
| fSoundScaleX | The tile to sound reference system scale for the x axis. |
| fSoundScaleY | The tile to sound reference system scale for the y axis. |
| fSoundScaleZ | The tile to sound reference system scale for the z axis. |
| refFontContext | The font context. Cannot be null. |
| p0RuntimeVariablesEnv | Cannot be null. |
Implements stmg::Theme.
|
overridevirtualnoexcept |
Create a theme widget from a game widget (the model).
| refGameWidget | The game widget. Cannot be null. |
| fTileWHRatio | The tile wh ratio. Must be positive. |
| refFontContext | The font context. Cannot be null. |
Implements stmg::Theme.
|
noexcept |
Get the theme animation factory with a given name.
| sName | The name of the factory. Cannot be empty. |
|
noexcept |
Get the assign id from the string assign id.
| sAssId | The string assign id. Cannot be empty. |
|
noexcept |
Get string assign id from assign id.
| nAssId | The assign id. |
|
noexcept |
Get an assign image given a tile and player.
| sAssId | The string assign id. Cannot be empty. |
| oTile | The tile that chooses the image. |
| nPlayer | The player. Can be -1 if not defined. |
|
overridevirtualnoexcept |
Get best tile size given a requested width.
| nHintTileW | The requested width. If 0 the minimum size is returned. |
Implements stmg::Theme.
|
noexcept |
Get the rgb of a TileColor.
| oColor | The tile color. |
| nR | [output] The red. |
| nG | [output] The green. |
| nB | [output] The blue. |
|
noexcept |
Get default font description.
|
noexcept |
The default painter.
|
noexcept |
Get font description by named index or default.
| nFontIdx | The index into getNamed().fonts(). If -1 or invalid default is returned. |
|
noexcept |
The image by image file name.
This will load the image if necessary.
| sImgFileName | The image file name. Cannot be empty. Example: "ball.svg". |
|
noexcept |
The image by string image id.
This will load the image if necessary.
| sImgId | The image string id. Cannot be empty. Example: "ball". |
|
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).
| nImgId | The image id. Must be >= 0. |
|
noexcept |
The image file name of a image string id.
| sImgId | The image string id. Cannot be empty. Example: "ball". |
|
noexcept |
Get known image file by file name.
| sImgFileName | The image file name. Cannot be empty. Example: "ball.svg". |
|
noexcept |
Get known sound file by file name.
| sSndFileName | The sound file name. Cannot be empty. Example: "explode.wav". |
|
inlineoverridevirtualnoexcept |
The named values.
Contains the strings relevant to the game.
Implements stmg::Theme.
|
inlinenoexcept |
The named values.
Contains the strings relevant to the game.
|
noexcept |
Get a named color.
| sColorName | The color name. |
| nR | [output] The red. |
| nG | [output] The green. |
| nB | [output] The blue. |
|
noexcept |
Get a named color by index.
| nIdx | The index into getNamed().colors(). |
| nR | [output] The red. |
| nG | [output] The green. |
| nB | [output] The blue. |
|
noexcept |
Get a named font.
| sFontName | The font name. Cannot be empty. |
| sFontDesc | [output] The font description (see Pango::FontDescription). |
|
noexcept |
Get a named font by index.
| nFontIdx | The index into getNamed().fonts(). |
| sFontDesc | [output] The font description (see Pango::FontDescription). |
|
noexcept |
Get palette color.
| nPal | The palette number. Must be >= 0 and <= TileColor::COLOR_PAL_LAST. |
| nR | [output] The red. |
| nG | [output] The green. |
| nB | [output] The blue. |
|
noexcept |
The sound file name of a sound string id.
| sSndId | The sound string id. Cannot be empty. Example: "explode". |
|
noexcept |
Get a tile animation.
| sId | The id. Must exist. |
|
overridevirtualnoexcept |
The tile width to height ratio.
According to nTileW ~= fTileWHRatio * nTileH.
Implements stmg::Theme.
|
noexcept |
|
noexcept |
Get the theme widget factory with a given name.
| sName | The name of the factory. Cannot be empty. |
|
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.
| sName | The animation factory name. Cannot be empty. |
|
noexcept |
Whether a named array of images was definrd.
| sArrayId | The array string id. Cannot be empty. |
|
noexcept |
Whether a string assign id was added.
| sAssId | The string assign id. Cannot be empty. |
|
noexcept |
Whether an assign id was added.
| nAssId | The assign id. |
|
noexcept |
Whether a image string id was defined.
| sImgId | The image string id. Cannot be empty. Example: "ball". |
|
noexcept |
Whether a sound string id was defined.
| sSndId | The sound string id. Cannot be empty. Example: "explode". |
|
noexcept |
Tells whether a tile animation with the given id exists.
| sId | The id. Cannot be e empty. |
|
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.
| sName | The widget factory name. Cannot be empty. |
|
noexcept |
Whether the default font was set.
|
noexcept |
Whether an image file name is already defined.
| sImgFileName | The image file name. Cannot be empty. Example: "ball.svg". |
|
noexcept |
Whether a sound file name is already defined.
| sSndFileName | The sound file name. Cannot be empty. Example: "explode.wav". |
|
noexcept |
Set the default font.
If the default font is already set, does nothing.
| sFontDesc | The font name. Cannot be empty. |
|
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().
| nPainterIdx | The default painter index into Named::painters(). Must be valid. |
1.8.13