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_SurveyMap.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-2023 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
22#pragma once
23
25
26#include "Application.h"
27#include "OgreImGui.h"
28#include "SimData.h"
29#include "SurveyMapEntity.h"
31
32#include <vector>
33
34namespace RoR {
35namespace GUI {
36
49{
50public:
51
52 const float WINDOW_PADDING = 4.f;
53 const float WINDOW_ROUNDING = 2.f;
54
56 void Draw();
57 bool IsVisible() const { return mMapMode != SurveyMapMode::NONE; }
58 bool IsHovered() const { return IsVisible() && mWindowMouseHovered; }
59 void CycleMode();
60 void ToggleMode();
61
62protected:
63
64 enum class SurveyMapMode
65 {
66 NONE, // Not visible
67 SMALL,
68 BIG
69 };
70
71 void setMapZoom(float zoom);
72 void setMapZoomRelative(float dt);
73 const char* getTypeByDriveable(const ActorPtr& actor);
74 const char* getAIType(const ActorPtr& actor);
75
77
78 void DrawMapIcon(const SurveyMapEntity& e, ImVec2 view_pos, ImVec2 view_size, Ogre::Vector2 view_origin);
79
80 ImVec2 DrawWaypoint(ImVec2 view_pos, ImVec2 view_size, Ogre::Vector2 view_origin,
81 std::string const& caption, int idx);
82
83 ImVec2 CalcWaypointMapPos(ImVec2 view_pos, ImVec2 view_size, Ogre::Vector2 view_origin, int idx);
84
85 // Window display
88 bool mWindowMouseHovered = false;
89 bool mMouseClicked = false;
90 int mWaypointNum = 0;
91
92 // Map
93 Ogre::Vector2 mTerrainSize = Ogre::Vector2::ZERO; // Computed reference map size (in meters)
94 Ogre::Vector2 mMapCenterOffset = Ogre::Vector2::ZERO; // Displacement, in meters
95 float mMapZoom = 0.f; // Ratio: 0-1
96 Ogre::TexturePtr mMapTexture;
97
98 // Icon cache
99 bool m_icons_cached = false;
100 Ogre::TexturePtr m_left_mouse_button;
101 Ogre::TexturePtr m_middle_mouse_button;
103 Ogre::TexturePtr m_right_mouse_button;
104 void CacheIcons();
105
106 // Circular minimap
108 float m_circle_radius = 0.f;
109};
110
111} // namespace GUI
112} // namespace RoR
Central state/object manager and communications hub.
Core data structures for simulation; Everything affected by by either physics, network or user intera...
In-game map widget Has 3 display modes (see SurveyMapMode), cycled using input SURVEY_MAP_TOGGLE_VIEW
SurveyMapMode mMapMode
ImVec2 DrawWaypoint(ImVec2 view_pos, ImVec2 view_size, Ogre::Vector2 view_origin, std::string const &caption, int idx)
Ogre::Vector2 mMapCenterOffset
Ogre::TexturePtr m_right_mouse_button
SurveyMapMode mMapLastMode
void DrawMapIcon(const SurveyMapEntity &e, ImVec2 view_pos, ImVec2 view_size, Ogre::Vector2 view_origin)
Ogre::TexturePtr mMapTexture
void setMapZoom(float zoom)
Ogre::TexturePtr m_middle_mouse_scroll_button
const float WINDOW_ROUNDING
const float WINDOW_PADDING
Ogre::TexturePtr m_left_mouse_button
bool IsVisible() const
const char * getAIType(const ActorPtr &actor)
Ogre::TexturePtr m_middle_mouse_button
const char * getTypeByDriveable(const ActorPtr &actor)
Ogre::Vector2 mTerrainSize
void CacheMapIcon(SurveyMapEntity &e)
ImVec2 CalcWaypointMapPos(ImVec2 view_pos, ImVec2 view_size, Ogre::Vector2 view_origin, int idx)
void setMapZoomRelative(float dt)
bool IsHovered() const