-
Notifications
You must be signed in to change notification settings - Fork 1
/
Console.h
60 lines (44 loc) · 1.38 KB
/
Console.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
60
#pragma once
#include <Windows.h>
#include <vector>
#include <stdio.h>
#include "ImGui/imgui.h"
#include "Utils.h"
class CConsole
{
struct Entry
{
char* szText;
ImVec4 color;
};
char m_szInput[256];
char m_szFilter[256];
std::vector<Entry> m_Items;
bool m_bFilter;
bool m_bScrollToBottom;
bool m_bShouldScrollToBottom;
std::vector<Entry> m_History;
int m_iHistoryPos; // -1: new line, 0..History.Size-1 browsing history.
std::vector<const char*> m_Commands;
public:
CConsole(void);
~CConsole(void);
void Clear(void);
void Log(const ImVec4& color, const char* szFormat, ...);
void Warn(const char* szFormat, ...);
void Error(const char* szFormat, ...);
void Write(const ImVec4& color, const char* szFormat, ...);
void Write(const ImVec4& color, const char* szFormat, va_list args);
void Draw(const char* szTitle);
};
extern CConsole* g_pConsole;
#ifdef _DEBUG
#define CCONSOLE_DEBUG_LOG(color, szFormat, ...) g_pConsole->Log(color, szFormat, __VA_ARGS__)
#define CCONSOLE_DEBUG_WARN(color, szFormat, ...) g_pConsole->Warn(color, szFormat, __VA_ARGS__)
#define CCONSOLE_DEBUG_ERROR(color, szFormat, ...) g_pConsole->Error(color, szFormat, __VA_ARGS__)
#else
#define CCONSOLE_DEBUG_LOG(color, szFormat, ...)
#define CCONSOLE_DEBUG_WARN(color, szFormat, ...)
#define CCONSOLE_DEBUG_ERROR(color, szFormat, ...)
#endif
#include "Configuration.h"