8#ifndef GALAXY_TIME_STOPWATCH_HPP_
9#define GALAXY_TIME_STOPWATCH_HPP_
24 using Function = std::move_only_function<void(
void)>;
void stop()
Stop Stopwatch.
void pause()
Pause the Stopwatch.
std::uint64_t m_start_ticks
The clock time when the timer started.
void unpause()
Resume the Stopwatch.
void start()
Start Stopwatch.
void set(Stopwatch::Function &&func, const std::uint64_t delay)
Run a function on a precision Stopwatch.
void repeat(const bool repeat)
Make function repeat itself instead of running once.
bool paused() const
Is the Stopwatch paused?
bool m_paused
Is Stopwatch paused.
bool m_stopped
Is Stopwatch stopped.
void update()
Call this if you want to trigger the callback after delay has passed.
std::move_only_function< void(void)> Function
Stopwatch callback type.
std::uint64_t get_time_passed() const noexcept
Time passed in milliseconds.
std::uint64_t m_paused_ticks
The ticks stored when the timer was paused.
bool m_repeat
Is function repeating?
Stopwatch::Function m_callback
Callback function.
std::uint64_t m_delay
Duration before callback is invoked.
bool stopped() const
Is the Stopwatch finished?