Represent an SDL timer.
More...
#include <timer.hpp>
|
using | Callback = SDL_TimerCallback |
| Just so that the type of a callback function can be. More...
|
|
|
static Timer | create (uint32_t interval, Callback function, void *user_context) |
| Factory function. More...
|
|
static Timer | create (std::chrono::milliseconds interval, Callback function, void *user_context) |
| Factory function using std::chrono. More...
|
|
static void | delay (std::chrono::milliseconds millisec) |
| Wait for millisec milliseconds. More...
|
|
static void | delay (uint32_t millisec) |
| Wait for millisec milliseconds. More...
|
|
static uint32_t | ticks_u32 () |
| Returns the number of milliseconds elapsed as a unint32_t (standard SDL API) More...
|
|
static std::chrono::milliseconds | ticks () |
| Retruns the number of milliseconds. More...
|
|
static uint64_t | perf_counter () |
| Return the performance counter value. More...
|
|
static uint64_t | perf_frequency () |
| Return the performace frequency value. More...
|
|
Represent an SDL timer.
Definition at line 12 of file timer.hpp.
◆ Callback
Just so that the type of a callback function can be.
Definition at line 24 of file timer.hpp.
◆ Timer() [1/2]
sdl::Timer::Timer |
( |
SDL_TimerID |
timer | ) |
|
|
inlineprivate |
◆ Timer() [2/2]
A timer object that is not tied to a timer id in SDL doesn't make senes.
Referenced by Timer().
◆ create() [1/2]
static Timer sdl::Timer::create |
( |
uint32_t |
interval, |
|
|
Callback |
function, |
|
|
void * |
user_context |
|
) |
| |
|
inlinestatic |
◆ create() [2/2]
static Timer sdl::Timer::create |
( |
std::chrono::milliseconds |
interval, |
|
|
Callback |
function, |
|
|
void * |
user_context |
|
) |
| |
|
inlinestatic |
Factory function using std::chrono.
Definition at line 49 of file timer.hpp.
References create().
◆ delay() [1/2]
static void sdl::Timer::delay |
( |
std::chrono::milliseconds |
millisec | ) |
|
|
inlinestatic |
Wait for millisec
milliseconds.
Definition at line 55 of file timer.hpp.
◆ delay() [2/2]
static void sdl::Timer::delay |
( |
uint32_t |
millisec | ) |
|
|
inlinestatic |
Wait for millisec
milliseconds.
Definition at line 62 of file timer.hpp.
◆ operator SDL_TimerID()
sdl::Timer::operator SDL_TimerID |
( |
| ) |
const |
|
inline |
◆ perf_counter()
static uint64_t sdl::Timer::perf_counter |
( |
| ) |
|
|
inlinestatic |
Return the performance counter value.
Definition at line 71 of file timer.hpp.
◆ perf_frequency()
static uint64_t sdl::Timer::perf_frequency |
( |
| ) |
|
|
inlinestatic |
Return the performace frequency value.
Definition at line 74 of file timer.hpp.
◆ remove()
bool sdl::Timer::remove |
( |
| ) |
|
|
inline |
Remove the timer, return true if timer was removed.
Definition at line 27 of file timer.hpp.
◆ ticks()
static std::chrono::milliseconds sdl::Timer::ticks |
( |
| ) |
|
|
inlinestatic |
◆ ticks_u32()
static uint32_t sdl::Timer::ticks_u32 |
( |
| ) |
|
|
inlinestatic |
Returns the number of milliseconds elapsed as a unint32_t (standard SDL API)
Definition at line 65 of file timer.hpp.
References ticks().
◆ timer_id()
SDL_TimerID sdl::Timer::timer_id |
( |
| ) |
const |
|
inline |
◆ timer_
SDL_TimerID sdl::Timer::timer_ = 0 |
|
private |
The documentation for this class was generated from the following file:
- /home/runner/work/cpp-sdl2/cpp-sdl2/sources/cpp-sdl2/timer.hpp