|
stmm-games-doc
0.32.0
|
Proxy class (of Game) exposed by Level available to events. More...
Public Types | |
| enum | INTERRUPT_TYPE { INTERRUPT_ABORT = 0, INTERRUPT_ABORT_ASK = 1, INTERRUPT_RESTART = 2, INTERRUPT_RESTART_ASK = 3, INTERRUPT_QUIT_APP = 4, INTERRUPT_QUIT_APP_ASK = 5, INTERRUPT_PAUSE = 10 } |
| enum | VAR_VALUE_TEAM_STATUS { VAR_VALUE_TEAM_STATUS_COMPLETED = 1, VAR_VALUE_TEAM_STATUS_PLAYING = 0, VAR_VALUE_TEAM_STATUS_FAILED = -1 } |
| The values the special team variable with id getTeamVarIdStatus() can take. More... | |
| enum | VAR_VALUE_PLAYER_STATUS { VAR_VALUE_PLAYER_STATUS_COMPLETED = 1, VAR_VALUE_PLAYER_STATUS_PLAYING = 0, VAR_VALUE_PLAYER_STATUS_FAILED = -1, VAR_VALUE_PLAYER_STATUS_OUT = -2 } |
| The values the special player variable with id getPlayerVarIdStatus() can take. More... | |
Public Member Functions | |
| int32_t | random (int32_t nFrom, int32_t nTo) noexcept |
| Return a random value within a range. More... | |
| RandomSource & | getRandomSource () noexcept |
| Return the game's random source. More... | |
| int64_t | getGameId () const noexcept |
| The unique game id. More... | |
| Named & | getNamed () noexcept |
| const Named & | getNamed () const noexcept |
| bool | isAllTeamsInOneLevel () const noexcept |
| Whether teams play all in the same level or each on its own level. More... | |
| double | gameInterval () const noexcept |
| The current game interval in milliseconds. More... | |
| int32_t | gameElapsed () const noexcept |
| Number of game ticks since start of game. More... | |
| double | gameElapsedMillisec () const noexcept |
| Number of milliseconds since start of game. More... | |
| bool | isInGameTick () const noexcept |
| Tells whether within a game tick. More... | |
| void | changedInterval (int32_t nLevel) noexcept |
| Tell game the preferred next interval of the level has changed. More... | |
| void | interrupt (INTERRUPT_TYPE eInterruptType) noexcept |
| Tells owner to interrupt the current game. More... | |
| bool | hasVariableId (int32_t nId, OwnerType eOwnerType) const noexcept |
| Whether a variable id is defined. More... | |
| std::pair< int32_t, OwnerType > | variableIdAndOwner (const std::string &sName) const noexcept |
| Variable id and owner by name. More... | |
| const Variable & | variable (int32_t nId) const noexcept |
| Return the game variable instance for the id. More... | |
| Variable & | variable (int32_t nId) noexcept |
| Return the game variable instance for the id. More... | |
| const Variable & | variable (int32_t nId, int32_t nLevel, int32_t nLevelTeam, int32_t nMate) const noexcept |
| Return a game, team or player variable. More... | |
| Variable & | variable (int32_t nId, int32_t nLevel, int32_t nLevelTeam, int32_t nMate) noexcept |
| Return a game, team or player variable. More... | |
| int32_t | getPlayer (int32_t nLevel, int32_t nLevelPlayer) noexcept |
| Get the player number from the level player. More... | |
| Layout const & | getLayout () const noexcept |
| The layout. More... | |
| int32_t | getGameVarIdGameOverTime () const noexcept |
| Game over time variable id. More... | |
| int32_t | getGameVarIdWinnerTeam () const noexcept |
| The winner team variable id. More... | |
| int32_t | getTeamVarIdFinishedTime () const noexcept |
| The team's finished time variable id. More... | |
| int32_t | getTeamVarIdRank () const noexcept |
| The team's rank variable id. More... | |
| int32_t | getTeamVarIdHighscoreRank () const noexcept |
| The team's highscore rank variable id. More... | |
| int32_t | getTeamVarIdStatus () const noexcept |
| The team's status variable id. More... | |
| int32_t | getPlayerVarIdFinishedTime () const noexcept |
| The player's finished time variable id. More... | |
| int32_t | getPlayerVarIdStatus () const noexcept |
| The player's status variable id. More... | |
| void | othersSend (int32_t nSenderLevelInGame, int32_t nMsg, int32_t nValue) noexcept |
| Send a message to other levels. 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... | |
| void | handleInput (int32_t nTeam, int32_t nMate, const shared_ptr< stmi::Event > &refEvent) noexcept |
| Send input directly to a player. 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. More... | |
| int32_t | getTotLevels () const noexcept |
| The total number of levels participating in the game. More... | |
| Level & | level (int32_t nLevel) noexcept |
| The level. More... | |
| Level const & | level (int32_t nLevel) const noexcept |
| The const level. More... | |
| const shared_ptr< const Highscore > & | getPreGameHighscore () const noexcept |
| The highscores before the game started. More... | |
| Highscore const & | getInGameHighscore () const noexcept |
| The game highscores. More... | |
The values the special player variable with id getPlayerVarIdStatus() can take.
| Enumerator | |
|---|---|
| VAR_VALUE_PLAYER_STATUS_COMPLETED | |
| VAR_VALUE_PLAYER_STATUS_PLAYING | |
| VAR_VALUE_PLAYER_STATUS_FAILED | |
| VAR_VALUE_PLAYER_STATUS_OUT | |
The values the special team variable with id getTeamVarIdStatus() can take.
| Enumerator | |
|---|---|
| VAR_VALUE_TEAM_STATUS_COMPLETED | |
| VAR_VALUE_TEAM_STATUS_PLAYING | |
| VAR_VALUE_TEAM_STATUS_FAILED | |
|
noexcept |
Tell game the preferred next interval of the level has changed.
The game interval is the time between game ticks.
| nLevel | The level the preferred game interval has changed. Must be valid. |
|
noexcept |
Create a key action input event for a player.
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 if there is only one human team and it is nTeam.
When nMate is not -1, the sound can only be heard in per player sound mode or if there is only one human player and it is (nTeam, nMate).
| nSoundIdx | The sound index according to Named::sounds(). Must be valid. |
| nTeam | The (preferences) team or -1 if sound directed to all players. |
| nMate | The mate or -1 if sound directed to all players of team (provided it is not -1). |
| 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 |
Number of game ticks since start of game.
|
noexcept |
Number of milliseconds since start of game.
|
noexcept |
The current game interval in milliseconds.
|
noexcept |
The unique game id.
A new one is created each time a game is started.
|
noexcept |
|
noexcept |
The winner team variable id.
The variable's value is either the winner team (numbered according to AppPreferences) or -1 if still playing.
|
noexcept |
The game highscores.
After game over contains only the teams that played the game.
|
noexcept |
The layout.
Can be used to find named widgets.
|
noexcept |
|
noexcept |
|
noexcept |
Get the player number from the level player.
| nLevel | The level. Must be valid. |
| nLevelPlayer | The level player. Must be valid. |
|
noexcept |
The player's finished time variable id.
The variable's value is either the time the player finished playing in millisec or -1 if still playing.
|
noexcept |
The player's status variable id.
The variable's value is in enum VAR_VALUE_PLAYER_STATUS.
|
noexcept |
The highscores before the game started.
|
noexcept |
Return the game's random source.
|
noexcept |
The team's finished time variable id.
The variable's value is either the time the team finished playing in millisec or -1 if still playing.
|
noexcept |
The team's highscore rank variable id.
The highscore rank is only set when all the teams have finished and is based on the highscres definition for the game.
|
noexcept |
The team's rank variable id.
The variable's value is either the rank of a team (starting from 0) or -1 if still playing. The normal rank is solely determined by the order of the calls to Level::gameStatusFailed() and Level::gameStatusCompleted().
|
noexcept |
The team's status variable id.
The variable's value is in enum VAR_VALUE_TEAM_STATUS.
|
noexcept |
The total number of levels participating in the game.
|
noexcept |
Send input directly to a player.
Can only be called within a game tick.
| nTeam | The player's team. Must be >= 0. |
| nMate | The player's mate number within the team. Must be >= 0. |
| refEvent | The event. Cannot be null. |
|
noexcept |
Whether a variable id is defined.
| nId | The variable id. |
| eOwnerType | The owner type. |
|
noexcept |
Tells owner to interrupt the current game.
| eInterruptType | The interrupt type. |
|
noexcept |
Whether teams play all in the same level or each on its own level.
|
noexcept |
Tells whether within a game tick.
This might be useful for events to determine whether within a game tick or a view tick callback.
|
noexcept |
|
noexcept |
The const level.
| nLevel | The level number. Must be >= 0 and < getTotLevels(). |
|
noexcept |
Send a message to other levels.
The message can be listened to by a OthersReceiverEvent instance.
| nSenderLevelInGame | The sender level. Must be valid. |
| nMsg | The message to send. |
| nValue | The value to send with it. |
|
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. |
|
noexcept |
Return a random value within a range.
This is just a shortcut to getRandomSource().random().
| nFrom | The first of the possible values. |
| nTo | The last of the possible values. |
|
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. |
|
noexcept |
Return the game variable instance for the id.
| nId | A valid variable id for OwnerType::GAME. |
|
noexcept |
Return the game variable instance for the id.
| nId | A valid variable id for OwnerType::GAME. |
|
noexcept |
Return a game, team or player variable.
| nId | The variable id. Must be valid for the owner type. |
| nLevel | The level. Must be valid or -1 for game variable. |
| nLevelTeam | The level team. Must be valid or -1 for game variable. |
| nMate | The mate. Must be valid or -1 for game or team variable. |
|
noexcept |
Return a game, team or player variable.
| nId | The variable id. Must be valid for the owner type. |
| nLevel | The level. Must be valid or -1 for game variable. |
| nLevelTeam | The level team. Must be valid or -1 for game variable. |
| nMate | The mate. Must be valid or -1 for game or team variable. |
1.8.13