ScummVM API documentation
imgui_logger.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef BACKENDS_IMGUI_COMPONENTS_IMGUI_LOGGER_H
23 #define BACKENDS_IMGUI_COMPONENTS_IMGUI_LOGGER_H
24 
25 #ifndef IMGUI_DEFINE_MATH_OPERATORS
26 #define IMGUI_DEFINE_MATH_OPERATORS
27 #endif
28 
29 #include "backends/imgui/imgui.h"
30 
31 namespace ImGuiEx {
32 
33 class ImGuiLogger {
34  char _inputBuf[256];
35  ImVector<char *> _items;
36  ImVector<char *> _history;
37  int _historyPos; // -1: new line, 0.._history.Size-1 browsing history.
38  ImGuiTextFilter _filter;
39  bool _autoScroll;
40  bool _scrollToBottom;
41  bool _showError = true;
42  bool _showWarn = true;
43  bool _showInfo = true;
44  bool _showdebug = true;
45 
46  struct {
47  ImVec4 _logger_error_b = ImVec4(1.f, 0.f, 0.f, 1.f);
48  ImVec4 _logger_warning_b = ImVec4(1.f, 1.f, 0.f, 1.f);
49  ImVec4 _logger_info_b = ImVec4(1.f, 1.f, 1.f, 1.f);
50  ImVec4 _logger_debug_b = ImVec4(0.8f, 0.8f, 0.8f, 1.f);
51 
52  ImVec4 _logger_error = ImVec4(1.0f, 0.4f, 0.4f, 1.0f);
53  ImVec4 _logger_warning = ImVec4(1.0f, 1.0f, 0.4f, 1.0f);
54  ImVec4 _logger_info = ImVec4(1.0f, 0.8f, 0.6f, 1.0f);
55  ImVec4 _logger_debug = ImVec4(0.8f, 0.8f, 0.8f, 1.0f);
56  } _colors;
57 
58 public:
59  ImGuiLogger();
60  ~ImGuiLogger();
61  void clear();
62  void addLog(const char *fmt, ...) IM_FMTARGS(2);
63  void drawColorOptions();
64  void draw(const char *title, bool *p_open);
65 };
66 
67 } // namespace ImGuiEx
68 
69 #endif
Definition: imgui_logger.h:31
Definition: imgui.h:308
Definition: imgui.h:2141
Definition: imgui_logger.h:33
Definition: imgui.h:2653