|
stmm-games-doc
0.32.0
|

Public Member Functions | |
| GameDiskFiles (const std::string &sAppName, bool bIncludeHomeLocal) | |
| Constructor. More... | |
| GameDiskFiles (const std::string &sAppName, bool bIncludeHomeLocal, std::vector< File > &&aGameFiles, bool bAddStandardLocationGameFiles, std::vector< File > &&aThemeFiles, bool bAddStandardLocationThemeFiles, const std::string &sIconFile, const std::string &sHighscoresDir, const std::string &sPreferencesFile) | |
| Non standard location constructor. More... | |
| const std::vector< File > & | getGameFiles () noexcept override |
| The game files for the app. More... | |
| const File & | getGameThumbnailFile (const File &oGameFile) noexcept override |
| The game's thumbnail. More... | |
| File | getIconFile () |
| The icon file. More... | |
| File | getHighscoreFile (const std::string &sGameName) noexcept override |
| Returns the full highscore file given the game name. More... | |
| File | getPreferencesFile () noexcept override |
| Returns the preferences file. More... | |
| const std::vector< File > & | getThemeFiles () |
| The theme files for the app. More... | |
| const std::vector< std::pair< std::string, File > > & | getThemeImageFiles (const File &oThemeFile) |
| The theme's image files. More... | |
| const std::vector< std::pair< std::string, File > > & | getThemeSoundFiles (const File &oThemeFile) |
| The theme's sound files. More... | |
| const std::vector< std::pair< std::string, File > > & | getThemeFontFiles (const File &oThemeFile) |
| The theme's font files. More... | |
| const File & | getThemeThumbnailFile (const File &oThemeFile) |
| The theme's thumbnail. More... | |
| const std::vector< std::pair< std::string, File > > & | getDefaultImageFiles () |
| The image files shared by all themes. More... | |
| const std::vector< std::pair< std::string, File > > & | getDefaultSoundFiles () |
| The sound files shared by all themes. More... | |
| const std::vector< std::pair< std::string, File > > & | getDefaultFontFiles () |
| The font files shared by all themes. More... | |
| const std::string & | getPrefsAndHighscoresBasePath () const |
| The base path for preferences and highscores. More... | |
| const std::vector< std::string > & | getGamesAndThemesBasePaths () const |
| The base paths for games and themes. More... | |
Public Member Functions inherited from stmg::XmlGameFiles | |
| virtual | ~XmlGameFiles ()=default |
Additional Inherited Members | |
Protected Member Functions inherited from stmg::XmlGameFiles | |
| XmlGameFiles ()=default | |
| stmg::GameDiskFiles::GameDiskFiles | ( | const std::string & | sAppName, |
| bool | bIncludeHomeLocal | ||
| ) |
Constructor.
The app name is usually also the subdirectory name in the standard location paths.
Example: app name jointris
/home/user/.local/share/stmm-games/themes/jointris # for themes /usr/local/share/stmm-games/themes/jointris # for themes /home/user/.local/share/stmm-games/games/jointris # for games /usr/local/share/stmm-games/games/jointris # for games /home/user/.local/share/stmm-games/preferences/jointris # for preferences (main.prefs) /home/user/.local/share/stmm-games/highscores/jointris # for highscores /usr/local/share/stmm-games/games/jointris.png # for the app icon (128x128 pixel)
Themes can also be non game specific and be imported by game specific themes.
Example:
/home/user/.local/share/stmm-games/themes # for generic themes /usr/local/share/stmm-games/themes # for generic themes
A theme is a folder named after the theme with suffix .thm containing files theme.xml and thumbnail.png and folders images, sounds and fonts
Example: generic theme foo
/usr/share/stmm-games/themes/foo.thm/theme.xml # theme definition file /usr/share/stmm-games/themes/foo.thm/thumbnail.png # 128x128 pixel /usr/share/stmm-games/themes/foo.thm/images /usr/share/stmm-games/themes/foo.thm/images/mybar.jpg /usr/share/stmm-games/themes/foo.thm/sounds /usr/share/stmm-games/themes/foo.thm/sounds/yourbang.mp3 /usr/share/stmm-games/themes/foo.thm/fonts /usr/share/stmm-games/themes/foo.thm/fonts/skripto.ttf
All themes also automatically have access to common images, sounds and fonts.
Example: common images, sounds and fonts
/usr/share/stmm-games/themes/common/images /usr/share/stmm-games/themes/common/images/background.jpg /usr/share/stmm-games/themes/common/sounds /usr/share/stmm-games/themes/common/sounds/test.wav /usr/share/stmm-games/themes/common/fonts /usr/share/stmm-games/themes/common/fonts/parial.ttf
A game is defined by an xml file and a corresponding picture.
Example: app jointris can have many games
/usr/share/stmm-games/games/jointris/classic.xml # `classic` game definition file /usr/share/stmm-games/games/jointris/classic.png # corresponding picture, 128x128 pixel /usr/share/stmm-games/games/jointris/penta.xml # `penta` game definition file /usr/share/stmm-games/games/jointris/penta.png # corresponding picture, 128x128 pixel
| sAppName | The app's name. Cannot be empty. Cannot contain spaces or weird characters. |
| bIncludeHomeLocal | Whether games and themes should also be loaded from the user's home directory. |
| stmg::GameDiskFiles::GameDiskFiles | ( | const std::string & | sAppName, |
| bool | bIncludeHomeLocal, | ||
| std::vector< File > && | aGameFiles, | ||
| bool | bAddStandardLocationGameFiles, | ||
| std::vector< File > && | aThemeFiles, | ||
| bool | bAddStandardLocationThemeFiles, | ||
| const std::string & | sIconFile, | ||
| const std::string & | sHighscoresDir, | ||
| const std::string & | sPreferencesFile | ||
| ) |
Non standard location constructor.
The folder structure of a theme must be the same as for standard location themes.
Beware! This constructor doesn't evaluate environment variable STMM_GAMES_EXTRA_BASE_PATH and add its content as a path from which to load games and themes.
Example: /tmp/mytheme (note: the folder must not necessarily end with .thm)
/tmp/mytheme/theme.xml /tmp/mytheme/thumbnail.png # 128x128 pixel /tmp/mytheme/images /tmp/mytheme/sounds /tmp/mytheme/fonts
| sAppName | The app's name. Cannot be empty. |
| bIncludeHomeLocal | Whether the user's home directory is also considered as a standard location for games and themes. |
| aGameFiles | The game files. Can be empty. All files must be defined and not be buffers. Example: '/tmp/mygames/pong.xml'. |
| bAddStandardLocationGameFiles | Whether to add standard locations game files to those in aGameFiles. |
| aThemeFiles | The theme files. Can be empty. All files must be defined and not be buffers. Example: '/tmp/mytheme/theme.xml'. |
| bAddStandardLocationThemeFiles | Whether to add standard locations theme files to those in aThemeFiles. |
| sIconFile | The icon file. If not empty must exist. Example: '/tmp/myicons/pong128x128.png'. |
| sHighscoresDir | The highscores directory. If not empty, must exist. |
| sPreferencesFile | The preferences file. Can be empty. |
| const std::vector< std::pair<std::string, File> >& stmg::GameDiskFiles::getDefaultFontFiles | ( | ) |
The font files shared by all themes.
| const std::vector< std::pair<std::string, File> >& stmg::GameDiskFiles::getDefaultImageFiles | ( | ) |
The image files shared by all themes.
| const std::vector< std::pair<std::string, File> >& stmg::GameDiskFiles::getDefaultSoundFiles | ( | ) |
The sound files shared by all themes.
|
overridevirtualnoexcept |
| const std::vector< std::string >& stmg::GameDiskFiles::getGamesAndThemesBasePaths | ( | ) | const |
The base paths for games and themes.
|
overridevirtualnoexcept |
The game's thumbnail.
The name of the game's thumbnail image is usually the game's xml file with the image format suffix instead of the .xml suffix.
Example: game file '/usr/local/share/stmm-games/games/jointris/classic.xml' could return thumbnail file '/usr/local/share/stmm-games/games/jointris/classic.jpg'
| oGameFile | The game file. Must be defined. |
Implements stmg::XmlGameFiles.
|
overridevirtualnoexcept |
Returns the full highscore file given the game name.
Example: if sGameName is 'Classic' the returned file might have path '~/.local/share/stmm-games/highscores/jointris/Classic.scores'.
| sGameName | The game name. Cannot be empty. |
Implements stmg::XmlGameFiles.
| File stmg::GameDiskFiles::getIconFile | ( | ) |
The icon file.
Example: '/usr/local/share/stmm-games/games/jointris.png"
|
overridevirtualnoexcept |
Returns the preferences file.
Implements stmg::XmlGameFiles.
| const std::string& stmg::GameDiskFiles::getPrefsAndHighscoresBasePath | ( | ) | const |
The base path for preferences and highscores.
Example: '/home/user/.local/share/stmm-games'.
| const std::vector< File >& stmg::GameDiskFiles::getThemeFiles | ( | ) |
The theme files for the app.
| const std::vector< std::pair<std::string, File> >& stmg::GameDiskFiles::getThemeFontFiles | ( | const File & | oThemeFile | ) |
The theme's font files.
| oThemeFile | The theme file. Must be defined. |
| const std::vector< std::pair<std::string, File> >& stmg::GameDiskFiles::getThemeImageFiles | ( | const File & | oThemeFile | ) |
The theme's image files.
Example: for theme file '/usr/local/share/stmm-games/themes/jointris/simple_j.thm/theme.xml' all the images in the directory '/usr/local/share/stmm-games/themes/jointris/simple_j.thm/images' are returned.
| oThemeFile | The theme file. Must be defined. |
| const std::vector< std::pair<std::string, File> >& stmg::GameDiskFiles::getThemeSoundFiles | ( | const File & | oThemeFile | ) |
The theme's sound files.
| oThemeFile | The theme file. Must be defined. |
1.8.13