Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
GUI_GameMainMenu.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
25
26#pragma once
27
28#include <imgui.h>
29
30namespace RoR {
31namespace GUI {
32
34{
35public:
36 // This class implements hand-made keyboard focus - button count must be known for wrapping
37 const float WINDOW_WIDTH = 200.f;
38 const ImVec4 WINDOW_BG_COLOR = ImVec4(0.1f, 0.1f, 0.1f, 0.8f);
39 const ImVec4 BUTTON_BG_COLOR = ImVec4(0.25f, 0.25f, 0.24f, 0.6f); // Drawn on top of a transparent panel; make it just a shade
40 const ImVec2 BUTTON_PADDING = ImVec2(4.f, 6.f);
41
42 inline bool IsVisible() const { return m_is_visible; }
43 inline void SetVisible(bool v) { m_is_visible = v; m_kb_focus_index = -1; }
44 void Draw();
45 void CacheUpdatedNotice();
46
47private:
48
49 void DrawMenuPanel();
50 void DrawVersionBox();
51 void DrawNoticeBox();
52 bool HighlightButton(const std::string &text, ImVec2 btn_size, int index) const;
53 void HandleInputEvents();
54 bool m_is_visible = false;
56 int m_kb_focus_index = -1; // -1 = no focus; 0+ = button index
57 int m_kb_enter_index = -1; // Focus positon when enter key was pressed.
58 const char* title;
59 bool cache_updated = false;
60};
61
62} // namespace GUI
63} // namespace RoR
bool HighlightButton(const std::string &text, ImVec2 btn_size, int index) const