stmm-games-doc  0.32.0
Classes | Public Member Functions | List of all members
stmg::LevelShow Class Reference

This class is used for both Show and Subshows. More...

Classes

class  Positioner
 Interface to position the LevelShow during view ticks. More...
 

Public Member Functions

int32_t getW () const noexcept
 The width of the Show or Subshow. More...
 
int32_t getH () const noexcept
 The height of the Show or Subshow. More...
 
FPoint getPos (int32_t nViewTick, int32_t nTotViewTicks) const noexcept
 Gets the position of the show or subshow during a view tick. More...
 
FPoint getPos () const noexcept
 Gets the position of the show or subshow during the game tick. More...
 
double getMaxX () const noexcept
 The maximum x coordinate of the level show. More...
 
double getMaxY () const noexcept
 The maximum y coordinate of the level show. More...
 
bool isBoardPosVisible (double fX, double fY) const noexcept
 Tells whether a board position is visible. More...
 
FPoint getBoardPos (double fX, double fY) const noexcept
 The board position given the position relative to this instance. More...
 
void setPos (const FPoint &oNewPos) noexcept
 Sets the level show position within its context. More...
 
void setPositioner (Positioner *p0Positioner) noexcept
 Install a positioner. More...
 
void resetPositioner () noexcept
 Reset the positioner. More...
 

Detailed Description

This class is used for both Show and Subshows.

In the case of Show the position is relative to the level's Board origin. In the case of a player Subshow the position is relative to the level's Show origin.

Member Function Documentation

◆ getBoardPos()

FPoint stmg::LevelShow::getBoardPos ( double  fX,
double  fY 
) const
noexcept

The board position given the position relative to this instance.

Parameters
fXThe x coordinate in tiles.
fYThe y coordinate in tiles.
Returns
The position within the board.

◆ getH()

int32_t stmg::LevelShow::getH ( ) const
inlinenoexcept

The height of the Show or Subshow.

Returns
The height in tiles.

◆ getMaxX()

double stmg::LevelShow::getMaxX ( ) const
inlinenoexcept

The maximum x coordinate of the level show.

The minimum value is 0.

The context can be the board (for the main LevelShow) or the main LevelShow (for the subshows).

Returns
The maximum x position in tiles within its context.

◆ getMaxY()

double stmg::LevelShow::getMaxY ( ) const
inlinenoexcept

The maximum y coordinate of the level show.

The minimum value is 0.

The context can be the board (for the main LevelShow) or the main LevelShow (for the subshows).

Returns
The maximum y position in tiles within its context.

◆ getPos() [1/2]

FPoint stmg::LevelShow::getPos ( int32_t  nViewTick,
int32_t  nTotViewTicks 
) const
noexcept

Gets the position of the show or subshow during a view tick.

This calls the positioner if one is installed.

Parameters
nViewTickThe view tick. Must be >= 0 and < nTotViewTicks.
nTotViewTicksThe number of view ticks in the game interval. Must be >= 1.
Returns
The current position in tiles.

◆ getPos() [2/2]

FPoint stmg::LevelShow::getPos ( ) const
noexcept

Gets the position of the show or subshow during the game tick.

This gets the position of the last call to getPos(nViewTick, nTotViewTicks) or setPos().

Returns
The current position in tiles.

◆ getW()

int32_t stmg::LevelShow::getW ( ) const
inlinenoexcept

The width of the Show or Subshow.

Returns
The width in tiles.

◆ isBoardPosVisible()

bool stmg::LevelShow::isBoardPosVisible ( double  fX,
double  fY 
) const
noexcept

Tells whether a board position is visible.

Parameters
fXThe x board coordinate in tiles.
fYThe y board coordinate in tiles.
Returns
Whether board position visible in this instance.

◆ resetPositioner()

void stmg::LevelShow::resetPositioner ( )
noexcept

Reset the positioner.

If no positioner is currently installed has no effect.

◆ setPos()

void stmg::LevelShow::setPos ( const FPoint oNewPos)
noexcept

Sets the level show position within its context.

This must be called within a game tick.

Parameters
oNewPosThe new position.

◆ setPositioner()

void stmg::LevelShow::setPositioner ( Positioner p0Positioner)
noexcept

Install a positioner.

The caller should ensure that the positioner isn't deleted while this LevelShow instance is using it.

Parameters
p0PositionerThe positioner. Cannot be null.