-
Notifications
You must be signed in to change notification settings - Fork 1
/
ets2dc_imgui.h
59 lines (47 loc) · 1.4 KB
/
ets2dc_imgui.h
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once
#include <plog/Log.h>
#include <plog/Appenders/IAppender.h>
#include <plog/Init.h>
#include <plog/Formatters/TxtFormatter.h>
#include "imgui/imgui.h"
/// <summary>
/// ImGui PlogD appender
/// Receives PlogD messages, saves them to a buffer, renders log window
/// </summary>
class AppLog : public plog::IAppender
{
ImGuiTextBuffer Buf;
ImGuiTextFilter Filter;
ImVector<int> LineOffsets; // Index to lines offset. We maintain this with AddLog() calls.
bool AutoScroll; // Keep scrolling if already at the bottom.
plog::TxtFormatter formatter;
public:
static AppLog* appLog;
AppLog();
void Clear();
void AddLog(const char* fmt, ...) IM_FMTARGS(2);
void AddLog(std::string str);
void Draw(bool* p_open = NULL);
void write(const plog::Record& record) override;
};
/// <summary>
/// ImGui Application settings rendering
/// </summary>
class AppSettings {
bool showLogWindow = false;
bool showImgGuiDemo = false;
bool changed = false;
void SaveSettings();
public:
// Settings
bool simulate;
bool isCapturing = false;
int currentLogLevel = 0;
int consecutiveFrames = 1;
int secondsBetweenSnapshots = 1;
bool captureDepth = true;
bool captureTelemetry = true;
AppSettings();
void Draw(const char* windowName = "ETS2DataCapture settings");
bool hasChanged();
};