RigsofRods
Soft-body Physics Simulation
GUI_ConsoleView.h
Go to the documentation of this file.
1 /*
2  This source file is part of Rigs of Rods
3  Copyright 2005-2012 Pierre-Michel Ricordel
4  Copyright 2007-2012 Thomas Fischer
5  Copyright 2013-2020 Petr Ohlidal
6 
7  For more information, see http://www.rigsofrods.org/
8 
9  Rigs of Rods is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License version 3, as
11  published by the Free Software Foundation.
12 
13  Rigs of Rods is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
24 
25 #pragma once
26 
27 #include "Application.h"
28 
29 #include "Application.h"
30 #include "Console.h"
31 #include "OgreImGui.h"
32 
33 #include <vector>
34 
35 
36 namespace RoR {
37 namespace GUI {
38 
41 {
42  void DrawConsoleMessages();
43  void DrawFilteringOptions();
45 
46  // Filtering (true means allowed)
49  bool cvw_filter_type_error = true;
50  bool cvw_filter_type_chat = true;
51  bool cvw_filter_type_cmd = true;
52  bool cvw_filter_area_echo = false;
54  bool cvw_filter_area_actor = true;
55  bool cvw_filter_area_terrn = true;
56  bool cvw_smooth_scrolling = true;
57 
58  // Misc options
59  size_t cvw_msg_duration_ms = 0u;
60  bool cvw_enable_scrolling = false; // !< Vertical, multiline messages are broken apart when enabled
61  bool cvw_enable_icons = false;
62  ImVec4 cvw_background_color = ImVec4(0,0,0,0);
63  ImVec2 cvw_background_padding = ImVec2(0,0);
64  float cvw_line_spacing = 1.f;
65  float alpha = 1.f;
66  size_t fadeout_interval = 700u;
67 
68 private:
69  bool MessageFilter(Console::Message const& m);
70  ImVec2 DrawColoredTextWithIcon(ImVec2 text_cursor, Ogre::TexturePtr icon, ImVec4 default_color, std::string const& line);
72  int UpdateMessages();
73  ImVec2 DrawMessage(ImVec2 cursor, Console::Message const& m);
74 
75  std::vector<Console::Message> m_filtered_messages;
76  std::vector<const Console::Message*> m_display_messages;
77  bool m_reload_messages = false;
78  size_t m_total_messages = 0;
79 };
80 
81 } // namespace GUI
82 } // namespace RoR
RoR::GUI::ConsoleView::cvw_filter_area_echo
bool cvw_filter_area_echo
Not the same thing as 'log' command!
Definition: GUI_ConsoleView.h:52
RoR::GUI::ConsoleView::DrawColoredTextWithIcon
ImVec2 DrawColoredTextWithIcon(ImVec2 text_cursor, Ogre::TexturePtr icon, ImVec4 default_color, std::string const &line)
Returns final text size.
Definition: GUI_ConsoleView.cpp:285
RoR::GUI::ConsoleView::MessageFilter
bool MessageFilter(Console::Message const &m)
Returns true if message should be displayed.
Definition: GUI_ConsoleView.cpp:264
RoR::GUI::ConsoleView::UpdateMessages
int UpdateMessages()
Ret. num of new message(s)
Definition: GUI_ConsoleView.cpp:317
RoR::GUI::ConsoleView::cvw_filter_area_script
bool cvw_filter_area_script
Definition: GUI_ConsoleView.h:53
RoR::GUI::ConsoleView::m_total_messages
size_t m_total_messages
Definition: GUI_ConsoleView.h:78
RoR::GUI::ConsoleView::cvw_background_padding
ImVec2 cvw_background_padding
Definition: GUI_ConsoleView.h:63
RoR::GUI::ConsoleView::DrawConsoleMessages
void DrawConsoleMessages()
Definition: GUI_ConsoleView.cpp:45
RoR::GUI::ConsoleView::cvw_filter_type_notice
bool cvw_filter_type_notice
Definition: GUI_ConsoleView.h:47
RoR::GUI::ConsoleView::m_reload_messages
bool m_reload_messages
Definition: GUI_ConsoleView.h:77
RoR::GUI::ConsoleView::cvw_filter_type_chat
bool cvw_filter_type_chat
Definition: GUI_ConsoleView.h:50
RoR::GUI::ConsoleView::cvw_line_spacing
float cvw_line_spacing
Definition: GUI_ConsoleView.h:64
RoR::GUI::ConsoleView::cvw_enable_scrolling
bool cvw_enable_scrolling
Definition: GUI_ConsoleView.h:60
Console.h
RoR::GUI::ConsoleView::DrawMessage
ImVec2 DrawMessage(ImVec2 cursor, Console::Message const &m)
Definition: GUI_ConsoleView.cpp:155
RoR::GUI::ConsoleView::cvw_msg_duration_ms
size_t cvw_msg_duration_ms
Message expiration; 0 means unlimited.
Definition: GUI_ConsoleView.h:59
RoR::GUI::ConsoleView::RequestReloadMessages
void RequestReloadMessages()
Definition: GUI_ConsoleView.h:44
OgreImGui.h
RoR::GUI::ConsoleView::m_filtered_messages
std::vector< Console::Message > m_filtered_messages
Updated as needed.
Definition: GUI_ConsoleView.h:75
RoR::Console::Message
Definition: Console.h:67
RoR::GUI::ConsoleView
Configurable console renderer, implements filtering, colorized text, incons.
Definition: GUI_ConsoleView.h:40
RoR::GUI::ConsoleView::cvw_filter_type_error
bool cvw_filter_type_error
Definition: GUI_ConsoleView.h:49
RoR::GUI::ConsoleView::m_display_messages
std::vector< const Console::Message * > m_display_messages
Rebuilt every frame; kept as member to reuse allocated memory.
Definition: GUI_ConsoleView.h:76
RoR::GUI::ConsoleView::cvw_background_color
ImVec4 cvw_background_color
Text-background color.
Definition: GUI_ConsoleView.h:62
RoR::GUI::ConsoleView::DrawFilteringOptions
void DrawFilteringOptions()
Definition: GUI_ConsoleView.cpp:247
Application.h
Central state/object manager and communications hub.
RoR::GUI::ConsoleView::cvw_filter_area_terrn
bool cvw_filter_area_terrn
Definition: GUI_ConsoleView.h:55
RoR::GUI::ConsoleView::cvw_filter_area_actor
bool cvw_filter_area_actor
Definition: GUI_ConsoleView.h:54
RoR::GUI::ConsoleView::alpha
float alpha
Definition: GUI_ConsoleView.h:65
RoR::GUI::ConsoleView::cvw_filter_type_cmd
bool cvw_filter_type_cmd
Definition: GUI_ConsoleView.h:51
RoR::GUI::ConsoleView::fadeout_interval
size_t fadeout_interval
Definition: GUI_ConsoleView.h:66
RoR::GUI::ConsoleView::cvw_smooth_scrolling
bool cvw_smooth_scrolling
Definition: GUI_ConsoleView.h:56
RoR
Definition: AppContext.h:36
RoR::GUI::ConsoleView::cvw_enable_icons
bool cvw_enable_icons
Definition: GUI_ConsoleView.h:61
RoR::GUI::ConsoleView::cvw_filter_type_warning
bool cvw_filter_type_warning
Definition: GUI_ConsoleView.h:48