Nui
Loading...
Searching...
No Matches
timer.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <functional>
4
6
7#include <cstdint>
8
9namespace Nui
10{
12 {
13 public:
15 explicit TimerHandle(int32_t id);
16 TimerHandle(const TimerHandle&) = delete;
17 TimerHandle(TimerHandle&& other) noexcept;
19 TimerHandle& operator=(TimerHandle&& other) noexcept;
20
22
23 void stop();
24 bool hasActiveTimer() const;
25
26 private:
27 int32_t id_;
28 };
29
40 void setInterval(int milliseconds, std::function<void()> toWrap, std::function<void(TimerHandle&&)> callback);
41
52 void setTimeout(int milliseconds, std::function<void()> toWrap, std::function<void(TimerHandle)> callback);
53}
Definition timer.hpp:12
bool hasActiveTimer() const
Definition timer.cpp:44
~TimerHandle()
Definition timer.cpp:16
TimerHandle()
Definition timer.cpp:8
TimerHandle & operator=(const TimerHandle &)=delete
TimerHandle(const TimerHandle &)=delete
void stop()
Definition timer.cpp:34
Definition file_dialog.hpp:6
void setTimeout(int milliseconds, std::function< void()> toWrap, std::function< void(TimerHandle)> callback)
Creates a new delayed function that calls "toWrap" after "milliseconds" milliseconds.
Definition timer.cpp:60
void setInterval(int milliseconds, std::function< void()> toWrap, std::function< void(TimerHandle &&)> callback)
Creates a new timer that calls "toWrap" every "milliseconds" milliseconds.
Definition timer.cpp:49