RigsofRods
Soft-body Physics Simulation
GUI_FrictionSettings.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 
6  For more information, see http://www.rigsofrods.org/
7 
8  Rigs of Rods is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License version 3, as
10  published by the Free Software Foundation.
11 
12  Rigs of Rods 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 Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
24 
25 // Remade using DearIMGUI by Petr Ohlidal, 10/2019
26 
27 #pragma once
28 
29 #include "Application.h"
30 
31 #include "SimData.h"
32 
33 namespace RoR {
34 namespace GUI {
35 
37 {
38 public:
39 
40  struct Entry
41  {
42  Entry(const ground_model_t* const gm):
43  backup_copy(*gm), working_copy(*gm), live_data(gm)
44  {}
45 
48  const ground_model_t* const live_data;
49  };
50 
51  void SetVisible(bool visible) { m_is_visible = visible; }
52  bool IsVisible() const { return m_is_visible; }
53  bool IsHovered() const { return IsVisible() && m_is_hovered; }
54 
55  void AnalyzeTerrain();
56  void setActiveCol(const ground_model_t* gm) { m_nearest_gm = gm; }
57  void Draw();
58 
59 private:
60  static bool GmComboItemGetter(void* data, int idx, const char** out_text);
61  void DrawTooltip(const char* title, const char* text);
62 
63  std::vector<Entry> m_gm_entries;
64  int m_selected_gm = 0;
65  const ground_model_t* m_nearest_gm = nullptr;
66  bool m_is_visible = false;
67  bool m_is_hovered = false;
68 };
69 
70 } // namespace GUI
71 } // namespace RoR
RoR::GUI::FrictionSettings::m_is_visible
bool m_is_visible
Definition: GUI_FrictionSettings.h:66
RoR::GUI::FrictionSettings::Draw
void Draw()
Definition: GUI_FrictionSettings.cpp:42
RoR::GUI::FrictionSettings
Definition: GUI_FrictionSettings.h:36
RoR::GUI::FrictionSettings::GmComboItemGetter
static bool GmComboItemGetter(void *data, int idx, const char **out_text)
Definition: GUI_FrictionSettings.cpp:131
RoR::GUI::FrictionSettings::m_nearest_gm
const ground_model_t * m_nearest_gm
Definition: GUI_FrictionSettings.h:65
RoR::GUI::FrictionSettings::m_gm_entries
std::vector< Entry > m_gm_entries
Definition: GUI_FrictionSettings.h:63
RoR::GUI::FrictionSettings::Entry::working_copy
ground_model_t working_copy
Definition: GUI_FrictionSettings.h:47
RoR::GUI::FrictionSettings::AnalyzeTerrain
void AnalyzeTerrain()
Definition: GUI_FrictionSettings.cpp:139
RoR::GUI::FrictionSettings::Entry::backup_copy
ground_model_t backup_copy
Definition: GUI_FrictionSettings.h:46
SimData.h
Core data structures for simulation; Everything affected by by either physics, network or user intera...
RoR::GUI::FrictionSettings::Entry
Definition: GUI_FrictionSettings.h:40
Application.h
Central state/object manager and communications hub.
RoR::GUI::FrictionSettings::SetVisible
void SetVisible(bool visible)
Definition: GUI_FrictionSettings.h:51
RoR::GUI::FrictionSettings::Entry::live_data
const ground_model_t *const live_data
Definition: GUI_FrictionSettings.h:48
RoR::GUI::FrictionSettings::DrawTooltip
void DrawTooltip(const char *title, const char *text)
Definition: GUI_FrictionSettings.cpp:150
RoR::GUI::FrictionSettings::setActiveCol
void setActiveCol(const ground_model_t *gm)
Definition: GUI_FrictionSettings.h:56
RoR::GUI::FrictionSettings::m_selected_gm
int m_selected_gm
Definition: GUI_FrictionSettings.h:64
RoR::GUI::FrictionSettings::IsHovered
bool IsHovered() const
Definition: GUI_FrictionSettings.h:53
RoR::ground_model_t
Surface friction properties.
Definition: SimData.h:739
RoR::GUI::FrictionSettings::IsVisible
bool IsVisible() const
Definition: GUI_FrictionSettings.h:52
RoR::GUI::FrictionSettings::Entry::Entry
Entry(const ground_model_t *const gm)
Definition: GUI_FrictionSettings.h:42
RoR
Definition: AppContext.h:36
RoR::GUI::FrictionSettings::m_is_hovered
bool m_is_hovered
Definition: GUI_FrictionSettings.h:67