RigsofRods
Soft-body Physics Simulation
GUI_GameControls.h
Go to the documentation of this file.
1 /*
2  This source file is part of Rigs of Rods
3  Copyright 2020 tritonas00
4 
5  For more information, see http://www.rigsofrods.org/
6 
7  Rigs of Rods is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License version 3, as
9  published by the Free Software Foundation.
10 
11  Rigs of Rods is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
22 #include "InputEngine.h"
23 #include "OgreImGui.h"
24 
25 namespace RoR {
26 namespace GUI {
27 
29 {
30 public:
31  const ImVec4 GRAY_HINT_TEXT = ImVec4(0.62f, 0.62f, 0.61f, 1.f);
32 
33  void SetVisible(bool visible);
34  bool IsVisible() const { return m_is_visible; }
35  bool IsHovered() const { return m_is_hovered; }
36 
38  void Draw();
39 
40 private:
41  void DrawEventEditBox();
42  void DrawEvent(RoR::events ev_code);
43  void DrawControlsTab(const char* prefix);
44  void DrawControlsTabItem(const char* name, const char* prefix);
45 
46  // Edit bindings (used for both expert and interactive modes)
47  void ApplyChanges();
48  void CancelChanges();
49 
50  void SaveMapFile();
51  void ReloadMapFile();
52 
53  bool ShouldDisplay(event_trigger_t& trig);
54 
55  bool m_is_visible = false;
56  bool m_is_hovered = false;
57  float m_colum_widths[3] = {};
58 
59  // Mode/config file selection
61  bool m_unsaved_changes = false;
62 
63  // Editing context
70 };
71 
72 } // namespace GUI
73 } // namespace RoR
RoR::GUI::GameControls::m_colum_widths
float m_colum_widths[3]
body->header width sync
Definition: GUI_GameControls.h:57
RoR::GUI::GameControls
Definition: GUI_GameControls.h:28
RoR::GUI::GameControls::m_active_buffer
Str< 1000 > m_active_buffer
Definition: GUI_GameControls.h:67
RoR::GUI::GameControls::m_selected_evtype
eventtypes m_selected_evtype
Definition: GUI_GameControls.h:66
RoR::GUI::GameControls::m_active_mapping_file
int m_active_mapping_file
Definition: GUI_GameControls.h:60
RoR::GUI::GameControls::IsVisible
bool IsVisible() const
Definition: GUI_GameControls.h:34
RoR::GUI::GameControls::m_interactive_keybinding_expl
bool m_interactive_keybinding_expl
Definition: GUI_GameControls.h:69
OgreImGui.h
RoR::GUI::GameControls::DrawControlsTab
void DrawControlsTab(const char *prefix)
Draws table with events matching prefix.
Definition: GUI_GameControls.cpp:297
RoR::event_trigger_t
Definition: InputEngine.h:415
RoR::GUI::GameControls::m_active_event
RoR::events m_active_event
Definition: GUI_GameControls.h:64
RoR::GUI::GameControls::m_active_trigger
event_trigger_t * m_active_trigger
Definition: GUI_GameControls.h:65
RoR::GUI::GameControls::DrawControlsTabItem
void DrawControlsTabItem(const char *name, const char *prefix)
Wraps DrawControlsTab() with scrollbar and tabs-bar logic.
Definition: GUI_GameControls.cpp:321
RoR::EV_MODE_LAST
@ EV_MODE_LAST
Definition: InputEngine.h:404
RoR::GUI::GameControls::DrawEvent
void DrawEvent(RoR::events ev_code)
One line in table.
Definition: GUI_GameControls.cpp:156
RoR::Str< 1000 >
RoR::GUI::GameControls::IsInteractiveKeyBindingActive
bool IsInteractiveKeyBindingActive()
Definition: GUI_GameControls.h:37
RoR::GUI::GameControls::IsHovered
bool IsHovered() const
Definition: GUI_GameControls.h:35
RoR::GUI::GameControls::Draw
void Draw()
Definition: GUI_GameControls.cpp:37
RoR::InputEngine::DEFAULT_MAPFILE_DEVICEID
static const int DEFAULT_MAPFILE_DEVICEID
virtual device ID for "input.map" entries
Definition: InputEngine.h:464
RoR::GUI::GameControls::GRAY_HINT_TEXT
const ImVec4 GRAY_HINT_TEXT
Definition: GUI_GameControls.h:31
RoR::GUI::GameControls::m_is_visible
bool m_is_visible
Definition: GUI_GameControls.h:55
RoR::GUI::GameControls::CancelChanges
void CancelChanges()
Definition: GUI_GameControls.cpp:392
RoR::eventtypes
eventtypes
Definition: InputEngine.h:50
RoR::GUI::GameControls::ReloadMapFile
void ReloadMapFile()
Definition: GUI_GameControls.cpp:408
RoR::GUI::GameControls::m_is_hovered
bool m_is_hovered
Definition: GUI_GameControls.h:56
RoR::GUI::GameControls::ShouldDisplay
bool ShouldDisplay(event_trigger_t &trig)
Definition: GUI_GameControls.cpp:427
RoR::GUI::GameControls::ApplyChanges
void ApplyChanges()
Definition: GUI_GameControls.cpp:354
RoR::ET_NONE
@ ET_NONE
Definition: InputEngine.h:52
InputEngine.h
Handles controller inputs from player. Defines input events and binding mechanism,...
RoR::GUI::GameControls::SetVisible
void SetVisible(bool visible)
Definition: GUI_GameControls.cpp:416
RoR::GUI::GameControls::DrawEventEditBox
void DrawEventEditBox()
Only the editing UI, embeddable.
Definition: GUI_GameControls.cpp:231
RoR::events
events
Definition: InputEngine.h:74
RoR
Definition: AppContext.h:36
RoR::GUI::GameControls::SaveMapFile
void SaveMapFile()
Definition: GUI_GameControls.cpp:401
RoR::GUI::GameControls::m_unsaved_changes
bool m_unsaved_changes
Definition: GUI_GameControls.h:61
RoR::GUI::GameControls::m_interactive_keybinding_active
bool m_interactive_keybinding_active
Definition: GUI_GameControls.h:68