stmm-games-doc  0.32.0
Public Member Functions | List of all members
stmg::GameView Class Referenceabstract

Public Member Functions

virtual void handleXYEvent (const shared_ptr< stmi::Event > &refXYEvent) noexcept=0
 Forward an XYEvent to the view. More...
 
virtual shared_ptr< GameSoundcreateSound (int32_t nSoundIdx, int32_t nTeam, int32_t nMate, FPoint oXYPos, double fZPos, bool bListenerRelative, double fVolume01, bool bLooping) noexcept=0
 Create a game sound. More...
 
virtual void preloadSound (int32_t nSoundIdx) noexcept=0
 Pre-load a sound. More...
 
virtual bool removeSound (const shared_ptr< GameSound > &refSound) noexcept=0
 Remove a sound. More...
 
virtual ~GameView () noexcept=default
 

Constructor & Destructor Documentation

◆ ~GameView()

virtual stmg::GameView::~GameView ( )
virtualdefaultnoexcept

Member Function Documentation

◆ createSound()

virtual shared_ptr<GameSound> stmg::GameView::createSound ( int32_t  nSoundIdx,
int32_t  nTeam,
int32_t  nMate,
FPoint  oXYPos,
double  fZPos,
bool  bListenerRelative,
double  fVolume01,
bool  bLooping 
)
pure virtualnoexcept

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 nTeam and nMate select it (or its team).

Parameters
nSoundIdxThe sound index according to Named::sounds(). Must be valid.
nTeamThe team or -1 if a sound directed to all.
nMateThe mate or -1 if a sound directed to all or team.
oXYPosThe position of the sound on the board. Absolute or relative to the listener.
fZPosThe z position of the sound.
bListenerRelativeWhether oXYPos is relative to the listener.
fVolume01The volume. Must be from 0.0 (inaudible) to 1.0 (max).
bLoopingWhether the sound should continuously repeat.
Returns
The created sound or null if not supported.

◆ handleXYEvent()

virtual void stmg::GameView::handleXYEvent ( const shared_ptr< stmi::Event > &  refXYEvent)
pure virtualnoexcept

Forward an XYEvent to the view.

This function is called while dispatching the queued inputs.

Parameters
refXYEventThe event to handle. Cannot be null.

◆ preloadSound()

virtual void stmg::GameView::preloadSound ( int32_t  nSoundIdx)
pure virtualnoexcept

Pre-load a sound.

Makes sure that subsequent calls to createSound with th e same nSoundIdx are as fast as possible.

Parameters
nSoundIdxThe sound index according to Named::sounds(). Must be valid.

◆ removeSound()

virtual bool stmg::GameView::removeSound ( const shared_ptr< GameSound > &  refSound)
pure virtualnoexcept

Remove a sound.

In order for the sound to be recycled the caller should also remove reference to it.

Parameters
refSoundThe sound. Cannot be null.
Returns
Whether the sound was still active.