|
stmm-games-doc
0.32.0
|

Classes | |
| class | CreateLevelCallback |
| Level factory callback. More... | |
| struct | Init |
Public Member Functions | |
| Game (Init &&oInit, CreateLevelCallback &oCreateLevelCallback, const Level::Init &oLevelInit) noexcept | |
| Constructor. More... | |
| void | reInit (Init &&oInit, CreateLevelCallback &oCreateLevelCallback, const Level::Init &oLevelInit) noexcept |
| Reinitialize game instance. More... | |
| const std::string & | getName () const noexcept |
| The name of the game. More... | |
| const AppPreferences & | prefs () const noexcept |
| GameOwner & | owner () noexcept |
| const GameOwner & | owner () const noexcept |
| int32_t | getMaxViewTicks () const noexcept |
| int32_t | getAdditionalHighscoresWait () const noexcept |
| void | setGameView (GameView *p0GameView) noexcept |
| Connect to the game view. More... | |
| int64_t | getGameId () const noexcept |
| The game identifier. More... | |
| Named & | getNamed () noexcept |
| const Named & | getNamed () const noexcept |
| bool | isAllTeamsInOneLevel () const noexcept |
| int32_t | getPlayer (int32_t nLevel, int32_t nLevelPlayer) noexcept |
| Returns the preference player number from the level player number. More... | |
| int32_t | getTotLevels () const noexcept |
| shared_ptr< Level > & | level (int32_t nLevel) noexcept |
| const shared_ptr< Level > & | level (int32_t nLevel) const noexcept |
| const Variable & | variable (int32_t nId) const noexcept |
| Get a game variable by id. More... | |
| Variable & | variable (int32_t nId) noexcept |
| Get a game variable by id. More... | |
| const Variable & | variable (int32_t nId, int32_t nLevel, int32_t nLevelTeam, int32_t nMate) const noexcept |
| Get variable by context. More... | |
| Variable & | variable (int32_t nId, int32_t nLevel, int32_t nLevelTeam, int32_t nMate) noexcept |
| Get variable by context. More... | |
| std::pair< int32_t, OwnerType > | variableIdAndOwner (const std::string &sName) const noexcept |
| Get variable id and owner type by name. More... | |
| bool | hasVariableId (int32_t nId, OwnerType eOwnerType) const noexcept |
| Whether a variable id exists. More... | |
| int32_t | getGameVarIdGameOverTime () const noexcept |
| int32_t | getGameVarIdWinnerTeam () const noexcept |
| int32_t | getTeamVarIdFinishedTime () const noexcept |
| int32_t | getTeamVarIdRank () const noexcept |
| int32_t | getTeamVarIdHighscoreRank () const noexcept |
| int32_t | getTeamVarIdStatus () const noexcept |
| int32_t | getPlayerVarIdFinishedTime () const noexcept |
| int32_t | getPlayerVarIdStatus () const noexcept |
| const shared_ptr< Layout > & | getLayout () const noexcept |
| const shared_ptr< const Highscore > & | getPreGameHighscore () const noexcept |
| Highscore const & | getInGameHighscore () const noexcept |
| void | interrupt (GameProxy::INTERRUPT_TYPE eInterruptType) noexcept |
| void | setLevelView (int32_t nLevel, LevelView *p0View) noexcept |
| Set the view for a level. More... | |
| void | start () noexcept |
| Start the game. More... | |
| void | end () noexcept |
| End the game. More... | |
| bool | isRunning () const noexcept |
| Whether the game is running. More... | |
| void | handleInput (const shared_ptr< stmi::Event > &refEvent) noexcept |
| The game's input event handler. More... | |
| void | handleTimer () noexcept |
| The game progress function. More... | |
| bool | isInGameTick () const noexcept |
| double | gameInterval () const noexcept |
| The game interval. More... | |
| double | gameNextInterval () const noexcept |
| The next game interval. More... | |
| double | gameElapsedMillisec () const noexcept |
| The elapsed time since the game start in milliseconds. More... | |
| int32_t | gameElapsed () const noexcept |
| The elapsed time since the game start in intervals. More... | |
| void | changedInterval (int32_t nLevel) noexcept |
| Signal a level's interval has changed. More... | |
| int32_t | gameStatusPlayingTeams () noexcept |
| The number of teams still playing. More... | |
| int32_t | gameStatusCompleted (int32_t nCompletedLevel, int32_t nLevelTeam, bool bForceOthersFailed, bool bCreateTexts) noexcept |
| Declare team completed the game. More... | |
| int32_t | gameStatusFailed (int32_t nFailedLevel, int32_t nLevelTeam, bool bForceOtherCompleted, bool bCreateTexts) noexcept |
| Declare team failed the game. More... | |
| void | gameStatusTechnical (int32_t nBadLevel, const std::vector< std::string > &aIssue) noexcept |
| Technical game over. More... | |
| void | othersSend (int32_t nSenderLevel, int32_t nMsg, int32_t nValue) noexcept |
| Send a message to other level's receivers. More... | |
| shared_ptr< GameSound > | createSound (int32_t nSoundIdx, int32_t nTeam, int32_t nMate, FPoint oXYPos, double fZPos, bool bListenerRelative, double fVolume01, bool bLooping) noexcept |
| Create a game sound. More... | |
| void | preloadSound (int32_t nSoundIdx) noexcept |
| Pre-load a sound. More... | |
| bool | removeSound (const shared_ptr< GameSound > &refSound) noexcept |
| Remove a sound. More... | |
| double | getSoundScaleX () const noexcept |
| The x scale from tiles to sound coordinates. More... | |
| double | getSoundScaleY () const noexcept |
| The y scale from tiles to sound coordinates. More... | |
| double | getSoundScaleZ () const noexcept |
| The z scale from tiles to sound coordinates. More... | |
| int32_t | getBoardPainterIdx () const noexcept |
| The painter to use to draw board tiles. More... | |
| int32_t | getBlockPainterIdx () const noexcept |
| The painter to use to draw block tiles. More... | |
| int32_t | random (int32_t nFrom, int32_t nTo) noexcept override |
| Return a random value within a range. More... | |
| void | createKeyActionFromXYEvent (int32_t nLevel, int32_t nLevelTeam, int32_t nMate, int32_t nKeyActionId, const shared_ptr< stmi::Event > &refXYEvent) noexcept |
| Create a key action input event for a player from an xy event. More... | |
| void | handleInput (int32_t nTeam, int32_t nMate, const shared_ptr< stmi::Event > &refEvent) noexcept |
| Send an input event directly to a player. More... | |
| bool | getUniqueActiveHumanPlayer (int32_t &nLevel, int32_t &nLevelTeam, int32_t &nMate) noexcept |
| Get the unique active human player within a context. More... | |
| bool | getUniqueActiveHumanPlayer (int32_t &nTeam, int32_t &nMate) noexcept |
| Get the unique active human player within a context. More... | |
Public Member Functions inherited from stmg::RandomSource | |
| virtual | ~RandomSource () noexcept=default |
|
noexcept |
Constructor.
See Game::reInit().
|
noexcept |
Signal a level's interval has changed.
| nLevel | The level. |
|
noexcept |
Create a key action input event for a player from an xy event.
Note that the creation might fail if a key action with the same id and player is already happening, for example from a (keyboard) key.
| nLevel | The player's level. Must be >= 0. |
| nLevelTeam | The player's level team. Must be >= 0. |
| nMate | The player's mate number within the team. Must be >= 0. |
| nKeyActionId | The key action id. Must be valid. |
| refXYEvent | The input event. Must be of type stmi::XYEvent. Cannot be null. |
|
noexcept |
Create a game sound.
The team or mate select the player(s) that should hear the sound. When nTeam is not -1, the sound can only be heard in per player sound mode, or there is only one human player and nTeamand nMate select it (or its team).
| nSoundIdx | The sound index according to Named::sounds(). Must be valid. |
| nTeam | The team or -1 if a sound directed to all. |
| nMate | The team or -1 if a sound directed to all ot team. |
| oXYPos | The position of the sound on the board. Absolute or relative to the listener. |
| fZPos | The z position of the sound. |
| bListenerRelative | Whether oXYPos is relative to the listener. |
| fVolume01 | The volume. Must be from 0.0 (inaudible) to 1.0 (max). |
| bLooping | Whether the sound should continuously repeat. |
|
noexcept |
End the game.
Calling this function when the game is not running is an error.
|
inlinenoexcept |
The elapsed time since the game start in intervals.
|
inlinenoexcept |
The elapsed time since the game start in milliseconds.
|
inlinenoexcept |
The game interval.
In a game tick the current interval cannot be changed. Levels can only determine the next game interval.
The game's interval is a function of each level's interval. Currently it is always set to the minimum of all levels.
|
inlinenoexcept |
The next game interval.
The game's interval is a function of each level's interval. Currently it is always set to the minimum of all levels.
|
noexcept |
Declare team completed the game.
The first team that completes the game has rank 1, the second rank 2, etc.
| nCompletedLevel | The level of the team that completed the game. |
| nLevelTeam | The level team that completed the game. |
| bForceOthersFailed | Whether other still playing teams status is set to failed. |
| bCreateTexts | Whether to create default texts. |
|
noexcept |
Declare team failed the game.
The first team that fails the game has rank "prefs().getTotTeams()", the second has rank "prefs().getTotTeams() - 1", etc.
| nFailedLevel | The level of the team that failed the game. |
| nLevelTeam | The level team that failed the game. |
| bForceOtherCompleted | Whether other still playing team status is set to completed. |
| bCreateTexts | Whether to create default texts. |
|
noexcept |
The number of teams still playing.
|
noexcept |
Technical game over.
| nBadLevel | The level in which a technical issue occurred. |
| aIssue | The strings describing the issue. |
|
inlinenoexcept |
|
inlinenoexcept |
The painter to use to draw block tiles.
|
inlinenoexcept |
The painter to use to draw board tiles.
|
inlinenoexcept |
The game identifier.
The game id is a unique number set when the game is started.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
|
inlinenoexcept |
|
inlinenoexcept |
The name of the game.
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
Returns the preference player number from the level player number.
| nLevel | The level. Must be >= 0 and < getTotLevels(). |
| nLevelPlayer | The level player. |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
The x scale from tiles to sound coordinates.
|
inlinenoexcept |
The y scale from tiles to sound coordinates.
|
inlinenoexcept |
The z scale from tiles to sound coordinates.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
Get the unique active human player within a context.
| nLevel | (Input) The level context (if >=0) or -1. (Output) The level of the found player. |
| nLevelTeam | (Input) The level team context (if >=0) or -1. (Output) The level team of the found player. |
| nMate | (Input) The mate number context (if >=0) or -1. (Output) The mate number of the found player. |
|
noexcept |
Get the unique active human player within a context.
| nTeam | (Input) The team context (if >=0) or -1. (Output) The team of the found player. |
| nMate | (Input) The mate number context (if >=0) or -1. (Output) The mate number of the found player. |
|
noexcept |
The game's input event handler.
Called by the device manager listener. All input events go through here.
| refEvent | The event. Cannot be null. |
|
inlinenoexcept |
Send an input event directly to a player.
This function is called by LevelShowWidget.
| nTeam | The player's team. Must be >= 0. |
| nMate | The player's mate number within the team. Must be >= 0. |
| refEvent | The input event. Cannot be null. |
|
noexcept |
The game progress function.
This is the game tick.
|
noexcept |
Whether a variable id exists.
| nId | The id. |
| eOwnerType | The owner type. |
|
noexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
Whether the game is running.
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
Send a message to other level's receivers.
| nSenderLevel | The sender level. Usually the level of the event calling this function. |
| nMsg | The message. |
| nValue | The value. |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
Pre-load a sound.
Makes sure that subsequent calls to createSound with th e same nSoundIdx are as fast as possible.
| nSoundIdx | The sound index according to Named::sounds(). Must be valid. |
|
overridevirtualnoexcept |
Return a random value within a range.
All entities within the game should use the same implementation of this function to generate random numbers (and not keep a personal generator alongside) so that the sequences can potentially be recorded and reproduced for debugging.
| nFrom | The first of the possible values. |
| nTo | The last of the possible values. |
Implements stmg::RandomSource.
|
noexcept |
Reinitialize game instance.
If the random number source is null, the game creates its own instance.
Allowed characters for the game name are alphanumeric, '-' and '_'.
Variable names must be unique among all owner types (for example there cannot be a variable named Points for both team and player). The names must also not start with "__" (reserved).
The callback oCreateLevelCallback is only used during the call.
If oInit.m_refHighscoresDefinition is defined it is used to determine the ranking among the teams. Its constraints and eligibilities are not evaluated.
If oInit.m_refHighscore is defined it represents the saved highscores prior the game start. This can be used to inform the player(s) where it stands during a game.
If both oInit.m_refHighscoresDefinition and oInit.m_refHighscore are defined oInit.m_refHighscore->getHighscoresDefinition() must be equivalent to oInit.m_refHighscoresDefinition.
The oInit.m_refHighscoresDefinition.getMaxScores() cannot be lower than the number of teams playing.
| oInit | The initialization data. |
| oCreateLevelCallback | The callback function that creates level instances. |
| oLevelInit | The level initialization object. |
|
noexcept |
Remove a sound.
In order for the sound to be recycled the caller should also remove reference to it.
| refSound | The sound. Cannot be null. |
|
inlinenoexcept |
Connect to the game view.
| p0GameView | Can be null. |
|
inlinenoexcept |
Set the view for a level.
| nLevel | The level. Must >= 0 and < getTotLevels(). |
| p0View | The view. Can be null. |
|
noexcept |
Start the game.
Calling this function when the game is running is an error.
|
noexcept |
Get a game variable by id.
| nId | The id. Must be valid. |
|
noexcept |
Get a game variable by id.
| nId | The id. Must be valid. |
|
noexcept |
Get variable by context.
| nId | The id. Must be valid for the context defined by nLevel, nLevelTeam and nMate. |
| nLevel | The level. Must exist or -1 for game variables. |
| nLevelTeam | The level team. Must exist or -1 for game variables. |
| nMate | The mate. Must exist or -1 for game or team variables. |
|
noexcept |
Get variable by context.
| nId | The id. Must be valid for the context defined by nLevel, nLevelTeam and nMate. |
| nLevel | The level. Must exist or -1 for game variables. |
| nLevelTeam | The level team. Must exist or -1 for game variables. |
| nMate | The mate. Must exist or -1 for game or team variables. |
|
noexcept |
Get variable id and owner type by name.
| sName | The name. Cannot be empty. |
1.8.13