Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
aurore::RepeatingTimer Class Reference

#include <aurore/core/timer.hpp>

Inheritance diagram for aurore::RepeatingTimer:
aurore::Ticking aurore::RepeatingTask

Public Member Functions

void start (Time period)
 
void start ()
 
void setPeriod (Time period)
 
void setCallback (TickingGenericCallback callback)
 
void onStart () override
 
bool onUpdate (Time delta) override
 
- Public Member Functions inherited from aurore::Ticking
virtual ~Ticking ()
 
void start ()
 
void stop ()
 
void setEndCallback (TickingEndCallback endCallback)
 
void setTickCallback (TickingTickCallback tickCallback)
 
bool isRunning ()
 

Protected Attributes

Time period = 0
 
Time progress = 0
 
TickingGenericCallback callback = [] {}
 

Additional Inherited Members

- Static Public Member Functions inherited from aurore::Ticking
static void updateTickings ()
 
- Static Public Attributes inherited from aurore::Ticking
static std::vector< Ticking * > runningTickings
 
- Protected Member Functions inherited from aurore::Ticking
virtual void onStop ()
 

Member Function Documentation

◆ onStart()

void aurore::RepeatingTimer::onStart ( )
overridevirtual

Called when the ticking becomes active.

Reimplemented from aurore::Ticking.

◆ onUpdate()

bool aurore::RepeatingTimer::onUpdate ( Time  delta)
overridevirtual

Executed every frame while the ticking lives. Delta is the time difference in ms between the last frame and the current one. Must return false if the ticking is finished and should be removed from the list of active tickings. The end callback will automatically be called then.

Implements aurore::Ticking.

◆ setCallback()

void aurore::RepeatingTimer::setCallback ( TickingGenericCallback  callback)

Sets the callback of the timer. Tick callback is still executed every tick. End callback is executed when the timer is stopped.

◆ setPeriod()

void aurore::RepeatingTimer::setPeriod ( Time  period)

Sets the period of the timer, in ms. Does not stop or reset it.

◆ start() [1/2]

void aurore::RepeatingTimer::start ( )

Starts the timer with the already set period.

◆ start() [2/2]

void aurore::RepeatingTimer::start ( Time  period)

Starts the timer directly with a given period, in ms.

Member Data Documentation

◆ callback

TickingGenericCallback aurore::RepeatingTimer::callback = [] {}
protected

◆ period

Time aurore::RepeatingTimer::period = 0
protected

◆ progress

Time aurore::RepeatingTimer::progress = 0
protected

The documentation for this class was generated from the following file: