TachyonUI 1.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
gui_redraw.h
Go to the documentation of this file.
1#pragma once
2
3#include <atomic>
4#include <cstdint>
5#include <mutex>
6#include <vector>
7
8namespace tachyon
9{
12
14 enum class RedrawMode : uint8_t
15 {
19 };
20
24 {
25 public:
27 void Request() { m_now = true; }
29 void RequestAt(int64_t nanos);
31 bool IsDue(int64_t nowNanos) const;
33 int64_t NextAt() const;
35 void Answer(int64_t nowNanos);
36
37 private:
38 std::atomic<bool> m_now = false;
39 mutable std::mutex m_mutex;
40 std::vector<int64_t> m_at;
41 };
42
44}
Redraws asked for: now, or at a time on the steady clock (SteadyClockNowNanos).
Definition gui_redraw.h:24
void Request()
A frame as soon as possible.
Definition gui_redraw.h:27
void RequestAt(int64_t nanos)
A frame at nanos.
bool IsDue(int64_t nowNanos) const
True when a frame was asked for now, or for nowNanos or before.
void Answer(int64_t nowNanos)
At a frame's start: the requests it answers (now, and up to nowNanos) are done.
int64_t NextAt() const
The earliest time asked for; INT64_MAX when there's none.
RedrawMode
How often GUIApplication::Run draws a frame (GUIApplication::SetRedrawMode).
Definition gui_redraw.h:15
@ WhenNeeded
sleeps until there's input, a redraw is asked for, a timer is due or something animates (the default)
Definition gui_redraw.h:18
@ WhenChanged
builds every frame at the refresh rate; records and presents only the windows whose draws changed
Definition gui_redraw.h:17
@ Always
every frame, as often as the display refreshes
Definition gui_redraw.h:16
Definition gui_logging.h:24