RigsofRods
Soft-body Physics Simulation
GUI_ConsoleWindow.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 
23 
24 #pragma once
25 
26 #include "Application.h"
27 
28 #include "Application.h"
29 #include "GUI_ConsoleView.h"
30 #include "OgreImGui.h"
32 #include "GUI_ScriptMonitor.h"
33 
34 #include <vector>
35 #include <string>
36 
37 namespace RoR {
38 namespace GUI {
39 
41 {
42 public:
43  static const size_t HISTORY_CAP = 100u;
44 
45  ConsoleWindow();
46  void SetVisible(bool visible) { m_is_visible = visible; }
47  bool IsVisible() const { return m_is_visible; }
48  bool IsHovered() const { return IsVisible() && m_is_hovered; }
49 
50  void Draw();
51  void doCommand(std::string msg);
52 
53 private:
54 
55  static int TextEditCallback(ImGuiTextEditCallbackData *data);
56  void TextEditCallbackProc(ImGuiTextEditCallbackData *data);
57 
58  // Window state
59  bool m_is_visible = false;
60  bool m_is_hovered = false;
61 
62  // Special panels
65 
66  // Console context
69  std::vector<std::string> m_cmd_history;
71 };
72 
73 } // namespace GUI
74 } // namespace RoR
RoR::GUI::ConsoleWindow::m_is_hovered
bool m_is_hovered
Definition: GUI_ConsoleWindow.h:60
RoR::GUI::ConsoleWindow::IsVisible
bool IsVisible() const
Definition: GUI_ConsoleWindow.h:47
RoR::GUI::ScriptMonitor
Definition: GUI_ScriptMonitor.h:27
RoR::GUI::ConsoleWindow::m_is_visible
bool m_is_visible
Definition: GUI_ConsoleWindow.h:59
GUI_ConsoleView.h
Generic console rendering.
GUI_AngelScriptExamples.h
RoR::GUI::ConsoleWindow::SetVisible
void SetVisible(bool visible)
Definition: GUI_ConsoleWindow.h:46
RoR::GUI::ConsoleWindow::m_cmd_buffer
Str< 500 > m_cmd_buffer
Definition: GUI_ConsoleWindow.h:68
OgreImGui.h
RoR::GUI::ConsoleWindow::m_cmd_history
std::vector< std::string > m_cmd_history
Definition: GUI_ConsoleWindow.h:69
RoR::GUI::ConsoleWindow::HISTORY_CAP
static const size_t HISTORY_CAP
Definition: GUI_ConsoleWindow.h:43
RoR::GUI::ConsoleView
Configurable console renderer, implements filtering, colorized text, incons.
Definition: GUI_ConsoleView.h:40
RoR::GUI::ConsoleWindow::m_cmd_history_cursor
int m_cmd_history_cursor
Definition: GUI_ConsoleWindow.h:70
RoR::Str< 500 >
RoR::GUI::ConsoleWindow::ConsoleWindow
ConsoleWindow()
Definition: GUI_ConsoleWindow.cpp:35
RoR::GUI::ConsoleWindow::Draw
void Draw()
Definition: GUI_ConsoleWindow.cpp:40
RoR::GUI::ConsoleWindow::doCommand
void doCommand(std::string msg)
Definition: GUI_ConsoleWindow.cpp:131
GUI_ScriptMonitor.h
Application.h
Central state/object manager and communications hub.
RoR::AngelScriptExamples
Definition: GUI_AngelScriptExamples.h:26
RoR::GUI::ConsoleWindow::TextEditCallback
static int TextEditCallback(ImGuiTextEditCallbackData *data)
Definition: GUI_ConsoleWindow.cpp:150
RoR::GUI::ConsoleWindow::TextEditCallbackProc
void TextEditCallbackProc(ImGuiTextEditCallbackData *data)
Definition: GUI_ConsoleWindow.cpp:157
RoR::GUI::ConsoleWindow::m_script_monitor
ScriptMonitor m_script_monitor
Definition: GUI_ConsoleWindow.h:64
RoR::GUI::ConsoleWindow
Definition: GUI_ConsoleWindow.h:40
RoR
Definition: AppContext.h:36
RoR::GUI::ConsoleWindow::m_console_view
ConsoleView m_console_view
Definition: GUI_ConsoleWindow.h:67
RoR::GUI::ConsoleWindow::IsHovered
bool IsHovered() const
Definition: GUI_ConsoleWindow.h:48
RoR::GUI::ConsoleWindow::m_angelscript_examples
AngelScriptExamples m_angelscript_examples
Definition: GUI_ConsoleWindow.h:63