RigsofRods
Soft-body Physics Simulation
Public Types | Public Member Functions | Data Fields | Private Member Functions | Private Attributes
RoR::GUI::TopMenubar Class Reference

#include <GUI_TopMenubar.h>

+ Collaboration diagram for RoR::GUI::TopMenubar:

Public Types

enum  TopMenu {
  TopMenu::TOPMENU_NONE, TopMenu::TOPMENU_SIM, TopMenu::TOPMENU_ACTORS, TopMenu::TOPMENU_SAVEGAMES,
  TopMenu::TOPMENU_SETTINGS, TopMenu::TOPMENU_TOOLS, TopMenu::TOPMENU_AI, TopMenu::TOPMENU_TUNING
}
 
enum  StateBox {
  StateBox::STATEBOX_NONE, StateBox::STATEBOX_REPLAY, StateBox::STATEBOX_RACE, StateBox::STATEBOX_LIVE_REPAIR,
  StateBox::STATEBOX_QUICK_REPAIR
}
 

Public Member Functions

 TopMenubar ()
 
 ~TopMenubar ()
 
void Draw (float dt)
 
bool ShouldDisplay (ImVec2 window_pos)
 
bool IsVisible ()
 
void FetchExternAiPresetsOnBackground ()
 Initiate threaded (down)load of 'extern' waypoints from GitHub repo. More...
 
void LoadBundledAiPresets (TerrainPtr terrain)
 Loads JSON files from [AI Presets] section in .terrn2 file format. More...
 
void RefreshAiPresets ()
 Refresh the list of presets, used for display. Needs to be called when terrain is loaded. More...
 
void RefreshTuningMenu ()
 

Data Fields

const float MENU_Y_OFFSET = 40.f
 
const float PANEL_HOVERBOX_HEIGHT = 50.f
 
const ImVec4 GRAY_HINT_TEXT = ImVec4(0.62f, 0.62f, 0.61f, 1.f)
 
const ImVec4 WHITE_TEXT = ImVec4(0.9f, 0.9f, 0.9f, 1.f)
 
const ImVec4 GREEN_TEXT = ImVec4(0.0f, 0.9f, 0.0f, 1.f)
 
const ImVec4 ORANGE_TEXT = ImVec4(0.9f, 0.6f, 0.0f, 1.f)
 
const ImVec4 RED_TEXT = ImVec4(1.00f, 0.00f, 0.00f, 1.f)
 
const ImVec2 MENU_HOVERBOX_PADDING = ImVec2(25.f, 10.f)
 
const int TUNING_SUBJECTID_USE_NAME = -2
 
std::vector< ai_eventsai_waypoints
 
int ai_num = 1
 
int ai_speed = 50
 
int ai_times = 1
 
int ai_altitude = 1000
 
int ai_distance = 20
 
int ai_position_scheme = 0
 
Ogre::String ai_fname = "95bbUID-agoras.truck"
 
Ogre::String ai_dname = "Bus RVI Agora S"
 
Ogre::String ai_sectionconfig = ""
 
std::string ai_skin = ""
 
bool ai_select = false
 
bool ai_rec = false
 
int ai_mode = 0
 
bool ai_menu = false
 
bool ai_select2 = false
 
Ogre::String ai_fname2 = "95bbUID-agoras.truck"
 
Ogre::String ai_dname2 = "Bus RVI Agora S"
 
Ogre::String ai_sectionconfig2 = ""
 
std::string ai_skin2 = ""
 
int ai_num_prev = 1
 
int ai_speed_prev = 50
 
int ai_position_scheme_prev = 0
 
int ai_times_prev = 1
 
int ai_mode_prev = 0
 
rapidjson::Document ai_presets_all
 The full list of presets, used for display. Needs to be refreshed when terrain is loaded. More...
 
rapidjson::Document ai_presets_extern
 Externally provided presets (GitHub repo or local 'savegames/waypoints.json' file). More...
 
bool ai_presets_extern_fetching = false
 True if the (down)load of 'extern' waypoints is in progress. More...
 
std::string ai_presets_extern_error
 Error message from the (down)load of 'extern' waypoints. More...
 
rapidjson::Document ai_presets_bundled
 Presets bundled with the terrain, see [AI Presets] section in .terrn2 file format. More...
 
ActorPtr tuning_actor
 Detecting actor change to update cached values. More...
 
std::vector< CacheEntryPtrtuning_addonparts
 Addonparts eligible for current actor, both matched by GUID and force-installed by user via [browse all] button. More...
 
std::vector< bool > tuning_addonparts_conflict_w_used
 1:1 with tuning_addonparts; True means the eligible (not used) addonpart conflicts with an used addonpart. More...
 
AddonPartConflictVec tuning_conflicts
 Conflicts between eligible addonparts tweaking the same element. More...
 
CacheQuery tuning_saves
 Tuneups saved by user, with category ID RoR::CID_AddonpartUser More...
 
Str< 200 > tuning_savebox_buf
 Buffer for tuneup name to be saved. More...
 
bool tuning_savebox_visible = false
 User pressed 'save active' to open savebox. More...
 
bool tuning_savebox_overwrite = false
 Status of "Overwrite?" checkbox. More...
 
const ImVec4 TUNING_HOLDTOCONFIRM_COLOR = ImVec4(0.25f, 0.15f, 0.2f, 0.5f)
 
const float TUNING_HOLDTOCONFIRM_TIMELIMIT = 1.5f
 Delete button must be held for several sec to confirm. More...
 
float tuning_rwidget_cursorx_min = 0.f
 Avoid drawing right-side widgets ('Delete' button or 'Protected' chk) over saved tuneup names. More...
 
CacheEntryPtr tuning_hovered_addonpart
 

Private Member Functions

bool IsMenuEnabled (TopMenu which)
 
void DrawActorListSinglePlayer ()
 
void DrawMpUserToActorList (RoRnet::UserInfo &user)
 
void DrawSpecialStateBox (float top_offset)
 
void DrawTuningBoxedSubjectIdInline (int subject_id)
 
void DrawTuningProtectedChkRightAligned (const int subject_id, bool is_protected, ModifyProjectRequestType request_type_set, ModifyProjectRequestType request_type_reset, const std::string &subject="")
 
void DrawTuningForceRemoveControls (const int subject_id, const std::string &name, const bool is_unwanted, const bool is_force_removed, ModifyProjectRequestType request_type_set, ModifyProjectRequestType request_type_reset)
 

Private Attributes

ImVec2 m_open_menu_hoverbox_min
 
ImVec2 m_open_menu_hoverbox_max
 
TopMenu m_open_menu = TopMenu::TOPMENU_NONE
 
ImVec2 m_state_box_hoverbox_min
 
ImVec2 m_state_box_hoverbox_max
 
StateBox m_state_box = StateBox::STATEBOX_NONE
 
bool m_confirm_remove_all = false
 
float m_daytime = 0.f
 
float m_waves_height
 
bool m_quickload = false
 
std::string m_quicksave_name
 
std::vector< std::string > m_savegame_names
 

Detailed Description

Definition at line 46 of file GUI_TopMenubar.h.

Member Enumeration Documentation

◆ StateBox

Enumerator
STATEBOX_NONE 
STATEBOX_REPLAY 
STATEBOX_RACE 
STATEBOX_LIVE_REPAIR 
STATEBOX_QUICK_REPAIR 

Definition at line 60 of file GUI_TopMenubar.h.

◆ TopMenu

Enumerator
TOPMENU_NONE 
TOPMENU_SIM 
TOPMENU_ACTORS 
TOPMENU_SAVEGAMES 
TOPMENU_SETTINGS 
TOPMENU_TOOLS 
TOPMENU_AI 
TOPMENU_TUNING 

Definition at line 59 of file GUI_TopMenubar.h.

Constructor & Destructor Documentation

◆ TopMenubar()

TopMenubar::TopMenubar ( )

Definition at line 139 of file GUI_TopMenubar.cpp.

◆ ~TopMenubar()

TopMenubar::~TopMenubar ( )

Definition at line 148 of file GUI_TopMenubar.cpp.

Member Function Documentation

◆ Draw()

void TopMenubar::Draw ( float  dt)

Definition at line 153 of file GUI_TopMenubar.cpp.

+ Here is the caller graph for this function:

◆ DrawActorListSinglePlayer()

void TopMenubar::DrawActorListSinglePlayer ( )
private

Definition at line 2058 of file GUI_TopMenubar.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DrawMpUserToActorList()

void TopMenubar::DrawMpUserToActorList ( RoRnet::UserInfo user)
private

Definition at line 1988 of file GUI_TopMenubar.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DrawSpecialStateBox()

void TopMenubar::DrawSpecialStateBox ( float  top_offset)
private

Definition at line 2126 of file GUI_TopMenubar.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DrawTuningBoxedSubjectIdInline()

void TopMenubar::DrawTuningBoxedSubjectIdInline ( int  subject_id)
private

Definition at line 2564 of file GUI_TopMenubar.cpp.

+ Here is the caller graph for this function:

◆ DrawTuningForceRemoveControls()

void TopMenubar::DrawTuningForceRemoveControls ( const int  subject_id,
const std::string &  name,
const bool  is_unwanted,
const bool  is_force_removed,
ModifyProjectRequestType  request_type_set,
ModifyProjectRequestType  request_type_reset 
)
private

Definition at line 2579 of file GUI_TopMenubar.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DrawTuningProtectedChkRightAligned()

void TopMenubar::DrawTuningProtectedChkRightAligned ( const int  subject_id,
bool  is_protected,
ModifyProjectRequestType  request_type_set,
ModifyProjectRequestType  request_type_reset,
const std::string &  subject = "" 
)
private

Definition at line 2528 of file GUI_TopMenubar.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FetchExternAiPresetsOnBackground()

void TopMenubar::FetchExternAiPresetsOnBackground ( )

Initiate threaded (down)load of 'extern' waypoints from GitHub repo.

Definition at line 2403 of file GUI_TopMenubar.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsMenuEnabled()

bool TopMenubar::IsMenuEnabled ( TopMenu  which)
private

Definition at line 2637 of file GUI_TopMenubar.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsVisible()

bool RoR::GUI::TopMenubar::IsVisible ( )
inline

Definition at line 68 of file GUI_TopMenubar.h.

◆ LoadBundledAiPresets()

void TopMenubar::LoadBundledAiPresets ( TerrainPtr  terrain)

Loads JSON files from [AI Presets] section in .terrn2 file format.

Definition at line 2364 of file GUI_TopMenubar.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RefreshAiPresets()

void TopMenubar::RefreshAiPresets ( )

Refresh the list of presets, used for display. Needs to be called when terrain is loaded.

Definition at line 2412 of file GUI_TopMenubar.cpp.

+ Here is the caller graph for this function:

◆ RefreshTuningMenu()

void TopMenubar::RefreshTuningMenu ( )

Definition at line 2433 of file GUI_TopMenubar.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ShouldDisplay()

bool TopMenubar::ShouldDisplay ( ImVec2  window_pos)

Definition at line 1939 of file GUI_TopMenubar.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ ai_altitude

int RoR::GUI::TopMenubar::ai_altitude = 1000

Definition at line 75 of file GUI_TopMenubar.h.

◆ ai_distance

int RoR::GUI::TopMenubar::ai_distance = 20

Definition at line 76 of file GUI_TopMenubar.h.

◆ ai_dname

Ogre::String RoR::GUI::TopMenubar::ai_dname = "Bus RVI Agora S"

Definition at line 79 of file GUI_TopMenubar.h.

◆ ai_dname2

Ogre::String RoR::GUI::TopMenubar::ai_dname2 = "Bus RVI Agora S"

Definition at line 90 of file GUI_TopMenubar.h.

◆ ai_fname

Ogre::String RoR::GUI::TopMenubar::ai_fname = "95bbUID-agoras.truck"

Definition at line 78 of file GUI_TopMenubar.h.

◆ ai_fname2

Ogre::String RoR::GUI::TopMenubar::ai_fname2 = "95bbUID-agoras.truck"

Definition at line 89 of file GUI_TopMenubar.h.

◆ ai_menu

bool RoR::GUI::TopMenubar::ai_menu = false

Definition at line 85 of file GUI_TopMenubar.h.

◆ ai_mode

int RoR::GUI::TopMenubar::ai_mode = 0

Definition at line 84 of file GUI_TopMenubar.h.

◆ ai_mode_prev

int RoR::GUI::TopMenubar::ai_mode_prev = 0

Definition at line 98 of file GUI_TopMenubar.h.

◆ ai_num

int RoR::GUI::TopMenubar::ai_num = 1

Definition at line 72 of file GUI_TopMenubar.h.

◆ ai_num_prev

int RoR::GUI::TopMenubar::ai_num_prev = 1

Definition at line 94 of file GUI_TopMenubar.h.

◆ ai_position_scheme

int RoR::GUI::TopMenubar::ai_position_scheme = 0

Definition at line 77 of file GUI_TopMenubar.h.

◆ ai_position_scheme_prev

int RoR::GUI::TopMenubar::ai_position_scheme_prev = 0

Definition at line 96 of file GUI_TopMenubar.h.

◆ ai_presets_all

rapidjson::Document RoR::GUI::TopMenubar::ai_presets_all

The full list of presets, used for display. Needs to be refreshed when terrain is loaded.

Definition at line 104 of file GUI_TopMenubar.h.

◆ ai_presets_bundled

rapidjson::Document RoR::GUI::TopMenubar::ai_presets_bundled

Presets bundled with the terrain, see [AI Presets] section in .terrn2 file format.

Definition at line 108 of file GUI_TopMenubar.h.

◆ ai_presets_extern

rapidjson::Document RoR::GUI::TopMenubar::ai_presets_extern

Externally provided presets (GitHub repo or local 'savegames/waypoints.json' file).

Definition at line 105 of file GUI_TopMenubar.h.

◆ ai_presets_extern_error

std::string RoR::GUI::TopMenubar::ai_presets_extern_error

Error message from the (down)load of 'extern' waypoints.

Definition at line 107 of file GUI_TopMenubar.h.

◆ ai_presets_extern_fetching

bool RoR::GUI::TopMenubar::ai_presets_extern_fetching = false

True if the (down)load of 'extern' waypoints is in progress.

Definition at line 106 of file GUI_TopMenubar.h.

◆ ai_rec

bool RoR::GUI::TopMenubar::ai_rec = false

Definition at line 83 of file GUI_TopMenubar.h.

◆ ai_sectionconfig

Ogre::String RoR::GUI::TopMenubar::ai_sectionconfig = ""

Definition at line 80 of file GUI_TopMenubar.h.

◆ ai_sectionconfig2

Ogre::String RoR::GUI::TopMenubar::ai_sectionconfig2 = ""

Definition at line 91 of file GUI_TopMenubar.h.

◆ ai_select

bool RoR::GUI::TopMenubar::ai_select = false

Definition at line 82 of file GUI_TopMenubar.h.

◆ ai_select2

bool RoR::GUI::TopMenubar::ai_select2 = false

Definition at line 88 of file GUI_TopMenubar.h.

◆ ai_skin

std::string RoR::GUI::TopMenubar::ai_skin = ""

Definition at line 81 of file GUI_TopMenubar.h.

◆ ai_skin2

std::string RoR::GUI::TopMenubar::ai_skin2 = ""

Definition at line 92 of file GUI_TopMenubar.h.

◆ ai_speed

int RoR::GUI::TopMenubar::ai_speed = 50

Definition at line 73 of file GUI_TopMenubar.h.

◆ ai_speed_prev

int RoR::GUI::TopMenubar::ai_speed_prev = 50

Definition at line 95 of file GUI_TopMenubar.h.

◆ ai_times

int RoR::GUI::TopMenubar::ai_times = 1

Definition at line 74 of file GUI_TopMenubar.h.

◆ ai_times_prev

int RoR::GUI::TopMenubar::ai_times_prev = 1

Definition at line 97 of file GUI_TopMenubar.h.

◆ ai_waypoints

std::vector<ai_events> RoR::GUI::TopMenubar::ai_waypoints

Definition at line 68 of file GUI_TopMenubar.h.

◆ GRAY_HINT_TEXT

const ImVec4 RoR::GUI::TopMenubar::GRAY_HINT_TEXT = ImVec4(0.62f, 0.62f, 0.61f, 1.f)

Definition at line 51 of file GUI_TopMenubar.h.

◆ GREEN_TEXT

const ImVec4 RoR::GUI::TopMenubar::GREEN_TEXT = ImVec4(0.0f, 0.9f, 0.0f, 1.f)

Definition at line 53 of file GUI_TopMenubar.h.

◆ m_confirm_remove_all

bool RoR::GUI::TopMenubar::m_confirm_remove_all = false
private

Definition at line 145 of file GUI_TopMenubar.h.

◆ m_daytime

float RoR::GUI::TopMenubar::m_daytime = 0.f
private

Definition at line 147 of file GUI_TopMenubar.h.

◆ m_open_menu

TopMenu RoR::GUI::TopMenubar::m_open_menu = TopMenu::TOPMENU_NONE
private

Definition at line 139 of file GUI_TopMenubar.h.

◆ m_open_menu_hoverbox_max

ImVec2 RoR::GUI::TopMenubar::m_open_menu_hoverbox_max
private

Definition at line 138 of file GUI_TopMenubar.h.

◆ m_open_menu_hoverbox_min

ImVec2 RoR::GUI::TopMenubar::m_open_menu_hoverbox_min
private

Definition at line 137 of file GUI_TopMenubar.h.

◆ m_quickload

bool RoR::GUI::TopMenubar::m_quickload = false
private

Definition at line 149 of file GUI_TopMenubar.h.

◆ m_quicksave_name

std::string RoR::GUI::TopMenubar::m_quicksave_name
private

Definition at line 150 of file GUI_TopMenubar.h.

◆ m_savegame_names

std::vector<std::string> RoR::GUI::TopMenubar::m_savegame_names
private

Definition at line 151 of file GUI_TopMenubar.h.

◆ m_state_box

StateBox RoR::GUI::TopMenubar::m_state_box = StateBox::STATEBOX_NONE
private

Definition at line 143 of file GUI_TopMenubar.h.

◆ m_state_box_hoverbox_max

ImVec2 RoR::GUI::TopMenubar::m_state_box_hoverbox_max
private

Definition at line 142 of file GUI_TopMenubar.h.

◆ m_state_box_hoverbox_min

ImVec2 RoR::GUI::TopMenubar::m_state_box_hoverbox_min
private

Definition at line 141 of file GUI_TopMenubar.h.

◆ m_waves_height

float RoR::GUI::TopMenubar::m_waves_height
private

Definition at line 148 of file GUI_TopMenubar.h.

◆ MENU_HOVERBOX_PADDING

const ImVec2 RoR::GUI::TopMenubar::MENU_HOVERBOX_PADDING = ImVec2(25.f, 10.f)

Definition at line 56 of file GUI_TopMenubar.h.

◆ MENU_Y_OFFSET

const float RoR::GUI::TopMenubar::MENU_Y_OFFSET = 40.f

Definition at line 49 of file GUI_TopMenubar.h.

◆ ORANGE_TEXT

const ImVec4 RoR::GUI::TopMenubar::ORANGE_TEXT = ImVec4(0.9f, 0.6f, 0.0f, 1.f)

Definition at line 54 of file GUI_TopMenubar.h.

◆ PANEL_HOVERBOX_HEIGHT

const float RoR::GUI::TopMenubar::PANEL_HOVERBOX_HEIGHT = 50.f

Definition at line 50 of file GUI_TopMenubar.h.

◆ RED_TEXT

const ImVec4 RoR::GUI::TopMenubar::RED_TEXT = ImVec4(1.00f, 0.00f, 0.00f, 1.f)

Definition at line 55 of file GUI_TopMenubar.h.

◆ tuning_actor

ActorPtr RoR::GUI::TopMenubar::tuning_actor

Detecting actor change to update cached values.

Definition at line 111 of file GUI_TopMenubar.h.

◆ tuning_addonparts

std::vector<CacheEntryPtr> RoR::GUI::TopMenubar::tuning_addonparts

Addonparts eligible for current actor, both matched by GUID and force-installed by user via [browse all] button.

Definition at line 112 of file GUI_TopMenubar.h.

◆ tuning_addonparts_conflict_w_used

std::vector<bool> RoR::GUI::TopMenubar::tuning_addonparts_conflict_w_used

1:1 with tuning_addonparts; True means the eligible (not used) addonpart conflicts with an used addonpart.

Definition at line 113 of file GUI_TopMenubar.h.

◆ tuning_conflicts

AddonPartConflictVec RoR::GUI::TopMenubar::tuning_conflicts

Conflicts between eligible addonparts tweaking the same element.

Definition at line 114 of file GUI_TopMenubar.h.

◆ TUNING_HOLDTOCONFIRM_COLOR

const ImVec4 RoR::GUI::TopMenubar::TUNING_HOLDTOCONFIRM_COLOR = ImVec4(0.25f, 0.15f, 0.2f, 0.5f)

Definition at line 119 of file GUI_TopMenubar.h.

◆ TUNING_HOLDTOCONFIRM_TIMELIMIT

const float RoR::GUI::TopMenubar::TUNING_HOLDTOCONFIRM_TIMELIMIT = 1.5f

Delete button must be held for several sec to confirm.

Definition at line 120 of file GUI_TopMenubar.h.

◆ tuning_hovered_addonpart

CacheEntryPtr RoR::GUI::TopMenubar::tuning_hovered_addonpart

Definition at line 122 of file GUI_TopMenubar.h.

◆ tuning_rwidget_cursorx_min

float RoR::GUI::TopMenubar::tuning_rwidget_cursorx_min = 0.f

Avoid drawing right-side widgets ('Delete' button or 'Protected' chk) over saved tuneup names.

Definition at line 121 of file GUI_TopMenubar.h.

◆ tuning_savebox_buf

Str<200> RoR::GUI::TopMenubar::tuning_savebox_buf

Buffer for tuneup name to be saved.

Definition at line 116 of file GUI_TopMenubar.h.

◆ tuning_savebox_overwrite

bool RoR::GUI::TopMenubar::tuning_savebox_overwrite = false

Status of "Overwrite?" checkbox.

Definition at line 118 of file GUI_TopMenubar.h.

◆ tuning_savebox_visible

bool RoR::GUI::TopMenubar::tuning_savebox_visible = false

User pressed 'save active' to open savebox.

Definition at line 117 of file GUI_TopMenubar.h.

◆ tuning_saves

CacheQuery RoR::GUI::TopMenubar::tuning_saves

Tuneups saved by user, with category ID RoR::CID_AddonpartUser

Definition at line 115 of file GUI_TopMenubar.h.

◆ TUNING_SUBJECTID_USE_NAME

const int RoR::GUI::TopMenubar::TUNING_SUBJECTID_USE_NAME = -2

Definition at line 57 of file GUI_TopMenubar.h.

◆ WHITE_TEXT

const ImVec4 RoR::GUI::TopMenubar::WHITE_TEXT = ImVec4(0.9f, 0.9f, 0.9f, 1.f)

Definition at line 52 of file GUI_TopMenubar.h.


The documentation for this class was generated from the following files: