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

Public Member Functions

virtual ~ThemeAnimation () noexcept=default
 
virtual int32_t getZ (int32_t nViewTick, int32_t nTotViewTicks) noexcept=0
 Get the z value at a view tick. More...
 
virtual bool isStarted (int32_t nViewTick, int32_t nTotViewTicks) noexcept=0
 Signals to the view that the theme animation can be started. More...
 
virtual bool isDone (int32_t nViewTick, int32_t nTotViewTicks) noexcept=0
 Signals to the view that the theme animation has finished and can be removed. More...
 
virtual void draw (int32_t nViewTick, int32_t nTotViewTicks, const Cairo::RefPtr< Cairo::Context > &refCc) noexcept=0
 Called by the view to draw the animation. More...
 
virtual void onRemoved () noexcept=0
 Called by view when animation is removed from the model. More...
 

Constructor & Destructor Documentation

◆ ~ThemeAnimation()

virtual stmg::ThemeAnimation::~ThemeAnimation ( )
virtualdefaultnoexcept

Member Function Documentation

◆ draw()

virtual void stmg::ThemeAnimation::draw ( int32_t  nViewTick,
int32_t  nTotViewTicks,
const Cairo::RefPtr< Cairo::Context > &  refCc 
)
pure virtualnoexcept

Called by the view to draw the animation.

refCC points at the center of the animation.

Parameters
nViewTickThe view tick. Is >= 0 and < nTotViewTicks.
nTotViewTicksThe total number of view ticks for the game interval. Is > 0.
refCcThe drawing context. Is not null.

◆ getZ()

virtual int32_t stmg::ThemeAnimation::getZ ( int32_t  nViewTick,
int32_t  nTotViewTicks 
)
pure virtualnoexcept

Get the z value at a view tick.

Parameters
nViewTickThe view tick. Is >= 0 and < nTotViewTicks.
nTotViewTicksThe total number of view ticks for the game interval. Is > 0.
Returns
The z value.

◆ isDone()

virtual bool stmg::ThemeAnimation::isDone ( int32_t  nViewTick,
int32_t  nTotViewTicks 
)
pure virtualnoexcept

Signals to the view that the theme animation has finished and can be removed.

If the returned value is true the implementation must also remove any reference to the LevelAnimation so that it can be recycled.

If the returned value is true the view won't call onRemoved().

Parameters
nViewTickThe view tick. Is >= 0 and < nTotViewTicks.
nTotViewTicksThe total number of view ticks for the game interval. Is > 0.
Returns
Whether the animation is finished and must be removed.

◆ isStarted()

virtual bool stmg::ThemeAnimation::isStarted ( int32_t  nViewTick,
int32_t  nTotViewTicks 
)
pure virtualnoexcept

Signals to the view that the theme animation can be started.

While animations are added during game ticks, the vier really starts to draw them at view tick granularity.

Parameters
nViewTickThe view tick. Is >= 0 and < nTotViewTicks.
nTotViewTicksThe total number of view ticks for the game interval. Is > 0.
Returns
Whether started in the view tick.

◆ onRemoved()

virtual void stmg::ThemeAnimation::onRemoved ( )
pure virtualnoexcept

Called by view when animation is removed from the model.

The implementation must remove any reference to the LevelAnimation so that it can be recycled.

Isn't called if isDone() was called by the view returning true.