8#include <entt/locator/locator.hpp>
21 auto& lua = entt::locator<sol::state>::value();
24 lua.set_function(
"time_set_dt", sol::resolve<
void(
const double)>(&
time::dt));
25 lua.set_function(
"time_get_dt", sol::resolve<
double(
void)>(&
time::dt));
27 auto stopwatch_type = lua.new_usertype<
Stopwatch>(
"Stopwatch", sol::constructors<Stopwatch()>());
39 auto timer_type = lua.new_usertype<
Timer>(
"Timer", sol::constructors<Timer()>());
static void inject_time() noexcept
Register galaxy time support functions into Lua.
void stop()
Stop Stopwatch.
void pause()
Pause the Stopwatch.
void unpause()
Resume the Stopwatch.
void start()
Start Stopwatch.
void repeat(const bool repeat)
Make function repeat itself instead of running once.
bool paused() const
Is the Stopwatch paused?
void update()
Call this if you want to trigger the callback after delay has passed.
std::uint64_t get_time_passed() const noexcept
Time passed in milliseconds.
bool stopped() const
Is the Stopwatch finished?
Asynchronous timer class.
void stop() noexcept
Stop timer.
void pause(const bool pause) noexcept
Pause the timer.
void start(const bool repeat=false)
Start timer.
bool paused() const noexcept
Is the timer paused?
bool stopped() const noexcept
Is the timer finished?
double dt() noexcept
Get galaxy delta time.
auto now() noexcept -> std::chrono::local_time< std::chrono::system_clock::duration >
Current local time.