-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathUI.h
More file actions
43 lines (31 loc) · 929 Bytes
/
UI.h
File metadata and controls
43 lines (31 loc) · 929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#pragma once
#include <bgfx/bgfx.h>
#include <imgui.h>
#include <spdlog/spdlog.h>
class Cluster;
class ClusterUI
{
public:
ClusterUI(Cluster& app);
void initialize();
void update(float dt);
void shutdown();
void log(const char* message, spdlog::level::level_enum level = spdlog::level::info);
private:
bool drawBar(const char* id, float width, float maxWidth, float height, const ImVec4& color);
spdlog::sink_ptr logUISink = nullptr;
struct LogEntry
{
spdlog::level::level_enum level;
int messageOffset; // points into vector of char
};
ImVector<LogEntry> logEntries;
ImVector<char> logText;
// update 10 times per second
static constexpr float GRAPH_FREQUENCY = 0.1f;
// show 100 values
static constexpr size_t GRAPH_HISTORY = 100;
Cluster& app;
float mTime = 0.0f;
bgfx::TextureHandle fontTexture = BGFX_INVALID_HANDLE;
};