aboutsummaryrefslogtreecommitdiffstats
path: root/source/logview.h
blob: 3c6acf1c315ebb7aaaea13ee272ef9858f398a0a (plain)
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
#ifndef LOGVIEW_H
#define LOGVIEW_H

#include <string>

#include "imgui.h"

// Adapted from ExampleAppLog from imgui_demo.cpp
class LogView
{
public:
    LogView();

    void Clear();
    void AddLog(const std::string& str);
    void AddLog(const char* fmt, ...) IM_FMTARGS(2);
    void Draw(const char* title, bool* p_open = NULL, ImGuiWindowFlags flags = 0);

private:
    ImGuiTextBuffer Buf;
    ImVector<int> LineOffsets; // Index to lines offset. We maintain this with AddLog() calls.
    bool updated;
};

#endif // LOGVIEW_H