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_GameSettings.cpp
Go to the documentation of this file.
1/*
2 This source file is part of Rigs of Rods
3 Copyright 2016-2020 Petr Ohlidal
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#include "GUI_GameSettings.h"
21
22#include "AppContext.h"
23#include "CacheSystem.h"
24#include "GameContext.h"
25#include "GUIManager.h"
26#include "GUIUtils.h"
27#include "Language.h"
28#include "SoundManager.h"
29
30#ifdef USE_OPENAL
31# include <alc.h>
32#endif
33
34using namespace RoR;
35using namespace GUI;
36
38{
39 const int flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar;
40 ImGui::SetNextWindowSize(ImVec2(670.f, 400.f), ImGuiCond_FirstUseEver);
41 if (m_bump_height != 0)
42 {
43 ImGui::SetNextWindowSize(m_window_size + ImVec2(0, m_bump_height));
44 m_bump_height = 0.f;
45 }
46 ImGui::SetNextWindowPosCenter(ImGuiCond_Appearing);
47 bool keep_open = true;
48 ImGui::Begin(_LC("GameSettings", "Game settings"), &keep_open, flags);
49
50 ImGui::BeginTabBar("GameSettingsTabs");
51
52 const float child_height = ImGui::GetWindowHeight()
53 - ((2.f * ImGui::GetStyle().WindowPadding.y) + (3.f * ImGui::GetItemsLineHeightWithSpacing())
54 + ImGui::GetStyle().ItemSpacing.y);
55
56 if (ImGui::BeginTabItem(_LC("GameSettings", "Render System")))
57 {
58 ImGui::BeginChild("Settings-Render-scroll", ImVec2(0.f, child_height), false);
60 ImGui::EndChild();
61 ImGui::EndTabItem();
62 }
63 if (ImGui::BeginTabItem(_LC("GameSettings", "General")))
64 {
65 ImGui::BeginChild("Settings-General-scroll", ImVec2(0.f, child_height), false);
66 this->DrawGeneralSettings();
67 ImGui::EndChild();
68 ImGui::EndTabItem();
69 }
70 if (ImGui::BeginTabItem(_LC("GameSettings", "Gameplay")))
71 {
72 ImGui::BeginChild("Settings-Gameplay-scroll", ImVec2(0.f, child_height), false);
74 ImGui::EndChild();
75 ImGui::EndTabItem();
76 }
77 if (ImGui::BeginTabItem(_LC("GameSettings", "UI")))
78 {
79 ImGui::BeginChild("Settings-UI-scroll", ImVec2(0.f, child_height), false);
80 this->DrawUiSettings();
81 ImGui::EndChild();
82 ImGui::EndTabItem();
83 }
84 if (ImGui::BeginTabItem(_LC("GameSettings", "Graphics")))
85 {
86 ImGui::BeginChild("Settings-Graphics-scroll", ImVec2(0.f, child_height), false);
88 ImGui::EndChild();
89 ImGui::EndTabItem();
90 }
91 if (ImGui::BeginTabItem(_LC("GameSettings", "Audio")))
92 {
93 ImGui::BeginChild("Settings-Audio-scroll", ImVec2(0.f, child_height), false);
94 this->DrawAudioSettings();
95 ImGui::EndChild();
96 ImGui::EndTabItem();
97 }
98 if (ImGui::BeginTabItem(_LC("GameSettings", "Controls")))
99 {
100 ImGui::BeginChild("Settings-Controls-scroll", ImVec2(0.f, child_height), false);
101 this->DrawControlSettings();
102 ImGui::EndChild();
103 ImGui::EndTabItem();
104 }
105 if (ImGui::BeginTabItem(_LC("GameSettings", "Diagnostic")))
106 {
107 ImGui::BeginChild("Settings-Diag-scroll", ImVec2(0.f, child_height), false);
108 this->DrawDiagSettings();
109 ImGui::EndChild();
110 ImGui::EndTabItem();
111 }
112
113 ImGui::EndTabBar();
114
115 ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 4.f);
116 m_window_size = ImGui::GetWindowSize();
117
118 ImGui::End();
119 if (!keep_open)
120 {
121 this->SetVisible(false);
122 }
123}
124
126{
127 ImGui::TextDisabled("%s", _LC("GameSettings", "Render system (changes require a restart)"));
128
130 {
131 std::string text = _LC("GameSettings", "You must restart the game to make changes effective.");
132 ImVec2 box_size = ImGui::CalcTextSize(text.c_str()) + ImGui::GetStyle().FramePadding * 2;
133 ImVec2 box_pos = ImGui::GetCursorPos() + ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f - box_size.x * 0.5f, 0.f);
134 ImGui::SetCursorPos(box_pos);
135 ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.8f, 0.7f, 0.1f, 1.f));
136 ImGui::BeginChildFrame(ImGuiID(123), box_size);
137 ImGui::TextColored(ImVec4(0.1f, 0.1f, 0.1f, 1.f), text.c_str());
138 ImGui::EndChildFrame();
139 ImGui::PopStyleColor(); // FrameBg
140 }
141
142 const auto ogre_root = App::GetAppContext()->GetOgreRoot();
143 const auto render_systems = ogre_root->getAvailableRenderers();
144 std::string render_system_names;
145 for (auto rs : render_systems)
146 {
147 render_system_names += rs->getName() + '\0';
148 }
149 const auto ro = ogre_root->getRenderSystemByName(App::app_rendersys_override->getStr());
150 const auto rs = ro ? ro : ogre_root->getRenderSystem();
151 const auto it = std::find(render_systems.begin(), render_systems.end(), rs);
152 int render_id = it != render_systems.end() ? std::distance(render_systems.begin(), it) : 0;
153 /* Combobox for selecting the Render System*/
154 if (ImGui::Combo(_LC ("GameSettings", "Render System"), &render_id, render_system_names.c_str()))
155 {
156 App::app_rendersys_override->setStr(render_systems[render_id]->getName());
157 }
158
159 const auto config_options = ogre_root->getRenderSystem()->getConfigOptions();
160 std::set<std::string> filter = {"Allow NVPerfHUD", "Colour Depth", "Fixed Pipeline Enabled",
161 "Floating-point mode", "Resource Creation Policy", "VSync Interval", "sRGB Gamma Conversion"};
162 for (auto opt : config_options)
163 {
164 auto co = opt.second;
165 if (co.immutable)
166 continue;
167 if (co.possibleValues.empty())
168 continue;
169 if (filter.find(co.name) != filter.end())
170 continue;
171 std::sort(co.possibleValues.rbegin(), co.possibleValues.rend());
172 std::string option_values;
173 for (auto value : co.possibleValues)
174 {
175 option_values += value + '\0';
176 }
177 const auto it = std::find(co.possibleValues.begin(), co.possibleValues.end(), opt.second.currentValue);
178 int option_id = it != co.possibleValues.end() ? std::distance(co.possibleValues.begin(), it) : 0;
179 if (ImGui::Combo(co.name.c_str(), &option_id, option_values.c_str()))
180 {
181 // Check the new value is different from the current one
182 if (co.currentValue != co.possibleValues[option_id])
183 {
184 // Set the new value to the render system
185 rs->setConfigOption(co.name, co.possibleValues[option_id]);
186 if (rs->validateConfigOptions().empty())
187 {
188 ogre_root->saveConfig();
189
190 // Show the "Must restart game..." box, make the window bigger to accomodate it
192 {
194 m_bump_height = ImGui::GetTextLineHeightWithSpacing() + ImGui::GetStyle().FramePadding.y * 2;
195 }
196 }
197 }
198 }
199 }
200}
201
203{
204 ImGui::TextDisabled("%s", _LC("GameSettings", "Application settings"));
205
206#ifndef NOLANG
207 std::vector<std::pair<std::string, std::string>> languages = App::GetLanguageEngine()->getLanguages();
208 std::string lang_values;
209 for (auto value : languages)
210 {
211 lang_values += value.first + '\0';
212 }
213 const auto it = std::find_if(languages.begin(), languages.end(),
214 [](const std::pair<std::string, std::string>& l) { return l.second == App::app_language->getStr(); });
215 int lang_selection = it != languages.end() ? std::distance(languages.begin(), it) : 0;
216 if (ImGui::Combo(_LC("GameSettings", "Language"), &lang_selection, lang_values.c_str()))
217 {
218 App::app_language->setStr(languages[lang_selection].second);
220 }
221#endif
222
223 // Country selection
224 static Ogre::FileInfoListPtr fl = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("FlagsRG", "*");
225 if (!fl->empty())
226 {
227 static std::vector<std::string> countries;
228 if (countries.empty())
229 {
230 for (auto& file : *fl)
231 {
232 std::string country = Ogre::StringUtil::replaceAll(file.filename, ".png", "");
233 if (country.size() == 2) // RoR protocol limitation
234 {
235 countries.push_back(country);
236 }
237 }
238 std::sort(countries.begin(), countries.end());
239 }
240 std::string country_values;
241 for (auto value : countries)
242 {
243 country_values += value + '\0';
244 }
245 const auto it = std::find(countries.begin(), countries.end(), App::app_country->getStr());
246 int country_selection = it != countries.end() ? std::distance(countries.begin(), it) : 0;
247 if (ImGui::Combo(_LC("GameSettings", "Country"), &country_selection, country_values.c_str()))
248 {
249 App::app_country->setStr(countries[country_selection].c_str());
250 }
251 }
252
253 int sshot_select = (App::app_screenshot_format->getStr() == "jpg") ? 1 : 0; // Hardcoded; TODO: list available formats.
254
255 /* Screenshot format: Can be png or jpg*/
256 if (ImGui::Combo(_LC("GameSettings", "Screenshot format"), &sshot_select, "png\0jpg\0\0"))
257 {
258 std::string str = (sshot_select == 1) ? "jpg" : "png";
260 }
261
262 DrawGTextEdit(App::app_extra_mod_path, _LC("GameSettings", "Extra mod path"), m_buf_app_extra_mod_dir);
263
264 DrawGCheckbox(App::app_skip_main_menu, _LC("GameSettings", "Skip main menu"));
265 DrawGCheckbox(App::app_async_physics, _LC("GameSettings", "Async physics"));
266 DrawGCheckbox(App::app_disable_online_api, _LC("GameSettings", "Disable online api"));
267
268 if (ImGui::Button(_LC("GameSettings", "Update cache")))
269 {
273 }
274}
275
277{
278 ImGui::TextDisabled("%s", _LC("GameSettings", "Simulation settings"));
279
280 DrawGCombo(App::sim_gearbox_mode, _LC("GameSettings", "Gearbox mode"),
282
283 //DrawGCheckbox(App::gfx_flexbody_cache, "Enable flexbody cache");
284
285 DrawGCheckbox(App::sim_spawn_running, _LC("GameSettings", "Engines spawn running"));
286
287 DrawGCheckbox(App::sim_replay_enabled, _LC("GameSettings", "Replay mode"));
288 if (App::sim_replay_enabled->getBool())
289 {
290 DrawGIntBox(App::sim_replay_length, _LC("GameSettings", "Replay length"));
291 DrawGIntBox(App::sim_replay_stepping, _LC("GameSettings", "Replay stepping"));
292 }
293
294 DrawGCheckbox(App::sim_realistic_commands, _LC("GameSettings", "Realistic forward commands"));
295
296 DrawGCheckbox(App::sim_races_enabled, _LC("GameSettings", "Enable races"));
297
298 DrawGCheckbox(App::sim_no_self_collisions, _LC("GameSettings", "No intra truck collisions"));
299 DrawGCheckbox(App::sim_no_collisions, _LC("GameSettings", "No inter truck collisions"));
300
301 DrawGCheckbox(App::io_discord_rpc, _LC("GameSettings", "Discord Rich Presence"));
302
303 DrawGCheckbox(App::sim_quickload_dialog, _LC("GameSettings", "Show confirm. UI dialog for quickload"));
304
305 DrawGCheckbox(App::sim_tuning_enabled, _LC("GameSettings", "Enable vehicle tuning"));
306}
307
309{
310#ifdef USE_OPENAL
311 ImGui::TextDisabled("%s", _LC("GameSettings", "Audio settings"));
312
313 static const ALCchar *devices = alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER);
314 const ALCchar *device = devices, *next = devices + 1;
315 std::vector<std::string> audio_devices;
316
317 while (device && *device != '\0' && next && *next != '\0')
318 {
319 audio_devices.push_back(device);
320 size_t len = strlen(device);
321 device += (len + 1);
322 next += (len + 2);
323 }
324
325 const auto it = std::find(audio_devices.begin(), audio_devices.end(), App::audio_device_name->getStr());
326 int device_id = it != audio_devices.end() ? std::distance(audio_devices.begin(), it) : 0;
327 if (ImGui::Combo(_LC("GameSettings", "Audio device"), &device_id, devices))
328 {
329 App::audio_device_name->setStr(audio_devices[device_id]);
330 }
331
332 DrawGCheckbox(App::audio_enable_creak, _LC("GameSettings", "Creak sound"));
333 DrawGCheckbox(App::audio_enable_efx, _LC("GameSettings", "Enable advanced sound effects via OpenAL EFX"));
334
335 if (App::audio_enable_efx->getBool())
336 {
337 DrawGCombo(App::audio_efx_reverb_engine, _LC("GameSettings", "OpenAL Reverb engine"), m_combo_items_efx_reverb_engine.c_str());
338 DrawGCheckbox(App::audio_enable_obstruction, _LC("GameSettings", "Sound obstruction"));
339 if (App::audio_enable_obstruction->getBool())
340 {
341 DrawGCheckbox(App::audio_force_obstruction_inside_vehicles, _LC("GameSettings", "Force obstruction inside vehicles"));
342 }
343 DrawGCheckbox(App::audio_enable_occlusion, _LC("GameSettings", "Sound occlusion"));
344 DrawGCheckbox(App::audio_enable_directed_sounds, _LC("GameSettings", "Directed sounds (exhausts etc.)"));
345 if (App::audio_efx_reverb_engine->getEnum<EfxReverbEngine>() == EfxReverbEngine::EAXREVERB)
346 {
347 DrawGCheckbox(App::audio_enable_reflection_panning, _LC("GameSettings", "Early reflections panning (experimental)"));
348 }
349
350 DrawGCheckbox(App::audio_engine_controls_environmental_audio, _LC("GameSettings", "Engine exerts automatic control over environmental audio"));
351
353 {
354 DrawGTextEdit(App::audio_default_efx_preset, _LC("GameSettings", "Default EFX Reverb Preset"), m_buf_audio_default_efx_preset);
356 }
357 }
358
359 DrawGCheckbox(App::audio_menu_music, _LC("GameSettings", "Main menu music"));
360 DrawGFloatSlider(App::audio_master_volume, _LC("GameSettings", "Master volume"), 0, 1);
361 DrawGFloatSlider(App::audio_doppler_factor, _LC("GameSettings", "Doppler factor"), 0, 10);
362#endif // USE_OPENAL
363}
364
366{
367 ImGui::TextDisabled("%s", _LC("GameSettings", "UI settings"));
368
369 this->DrawUiPresetCombo();
370
371 this->DrawUiDefaultDashboard(m_ui_known_dash_truck, App::ui_default_truck_dash, CID_DashboardsTruck, _LC("GameSettings", "Default truck dashboard"));
372 this->DrawUiDefaultDashboard(m_ui_known_dash_boat, App::ui_default_boat_dash, CID_DashboardsBoat, _LC("GameSettings", "Default boat dashboard"));
373
374 DrawGCheckbox(App::gfx_speedo_imperial, _LC("GameSettings", "Imperial units"));
375
376 DrawGCheckbox(App::ui_show_live_repair_controls, _LC("GameSettings", "Show controls in live repair box"));
377
378 DrawGCheckbox(App::ui_show_vehicle_buttons, _LC("GameSettings", "Show vehicle buttons menu"));
379
380 DrawGCheckbox(App::ui_always_show_fullsize, _LC("GameSettings", "Always show full size help image"));
381
382
383 DrawGCheckbox(App::gfx_surveymap_icons, _LC("GameSettings", "Overview map icons"));
384 if (App::gfx_surveymap_icons->getBool())
385 {
386 DrawGCheckbox(App::gfx_declutter_map, _LC("GameSettings", "Declutter overview map"));
387 }
388
389}
390
392{
393 ImGui::TextDisabled("%s", _LC("GameSettings", "Video settings"));
394
395 DrawGCombo(App::gfx_flares_mode, _LC("GameSettings", "Light sources"),
397
398 DrawGCombo(App::gfx_shadow_type, _LC("GameSettings", "Shadow type (requires restart)"),
400
401 if (App::gfx_shadow_type->getEnum<GfxShadowType>() != GfxShadowType::NONE)
402 {
403 DrawGCheckbox(App::gfx_reduce_shadows, _LC("GameSettings", "Shadow optimizations"));
404 if (App::gfx_shadow_type->getEnum<GfxShadowType>() == GfxShadowType::PSSM)
405 {
406 DrawGIntSlider(App::gfx_shadow_quality, _LC("GameSettings", "Shadow quality"), 0, 3);
407 }
408 }
409
410 DrawGCombo(App::gfx_sky_mode, _LC("GameSettings", "Sky gfx"),
411 m_combo_items_sky_mode.c_str());
412
413 if (App::gfx_sky_mode->getEnum<GfxSkyMode>() != GfxSkyMode::SKYX)
414 {
415 DrawGIntSlider(App::gfx_sight_range, _LC("GameSettings", "Sight range (meters)"), 100, 5000);
416 }
417
418 DrawGCombo(App::gfx_texture_filter , _LC("GameSettings", "Texture filtering"),
420
421 if (App::gfx_texture_filter->getEnum<GfxTexFilter>() == GfxTexFilter::ANISOTROPIC)
422 {
423 int anisotropy = Ogre::Math::Clamp(App::gfx_anisotropy->getInt(), 1, 16);
424 int selection = std::log2(anisotropy);
425 if (ImGui::Combo(_LC("GameSettings", "Anisotropy"), &selection, "1\0""2\0""4\0""8\0""16\0\0"))
426 {
427 App::gfx_anisotropy->setVal(std::pow(2, selection));
428 }
429 }
430
431 DrawGCombo(App::gfx_vegetation_mode, _LC("GameSettings", "Vegetation density"),
433
434 DrawGCombo(App::gfx_water_mode, _LC("GameSettings", "Water gfx"),
436
437 DrawGIntSlider(App::gfx_fps_limit, _LC("GameSettings", "FPS limit"), 0, 240);
438
439 DrawGIntCheck(App::gfx_particles_mode, _LC("GameSettings", "Enable particle gfx"));
440 DrawGIntCheck(App::gfx_skidmarks_mode, _LC("GameSettings", "Enable skidmarks"));
441
442 DrawGCheckbox(App::gfx_auto_lod, _LC("GameSettings", "Enable automatic mesh LOD generator (Increases loading times)"));
443
444 DrawGCheckbox(App::gfx_envmap_enabled, _LC("GameSettings", "Realtime reflections"));
445 if (App::gfx_envmap_enabled->getBool())
446 {
447 ImGui::PushItemWidth(125.f); // Width includes [+/-] buttons
448 DrawGIntSlider(App::gfx_envmap_rate, _LC("GameSettings", "Realtime refl. update rate"), 0, 2);
449 ImGui::PopItemWidth();
450 }
451
452 DrawGCheckbox(App::gfx_enable_videocams, _LC("GameSettings", "Render video cameras"));
453 DrawGCheckbox(App::gfx_water_waves, _LC("GameSettings", "Waves on water"));
454 DrawGCheckbox(App::gfx_alt_actor_materials, _LC("GameSettings", "Use alternate vehicle materials"));
455
456 DrawGCombo(App::gfx_extcam_mode, "Exterior camera mode",
458
459 DrawGIntSlider(App::gfx_camera_height, _LC("GameSettings", "Static camera height (meters)"), 1, 50);
460 DrawGIntSlider(App::gfx_fov_external_default, _LC("GameSettings", "Exterior field of view"), 10, 120);
461 DrawGIntSlider(App::gfx_fov_internal_default, _LC("GameSettings", "Interior field of view"), 10, 120);
462}
463
465{
466 ImGui::TextDisabled("%s", _LC("GameSettings", "Diagnostic options"));
467 ImGui::TextColored(ImVec4(0.89f,0.15f,0.21f,1.0f), "%s", _LC("GameSettings", "These settings are for advanced users only, you should only change these if you know what you're doing"));
468
469 DrawGTextEdit(App::diag_preset_terrain, _LC("GameSettings", "Preselected terrain"), m_buf_diag_preset_terrain);
470 DrawGTextEdit(App::diag_preset_vehicle, _LC("GameSettings", "Preselected vehicle"), m_buf_diag_preset_vehicle);
471 DrawGTextEdit(App::diag_preset_veh_config, _LC("GameSettings", "Presel. veh. config"), m_buf_diag_preset_veh_config);
472 DrawGCheckbox(App::diag_preset_veh_enter, _LC("GameSettings", "Enter preselected vehicle"));
473 DrawGCheckbox(App::diag_auto_spawner_report, _LC("GameSettings", "Auto actor spawner report"));
474 DrawGCheckbox(App::diag_rig_log_node_import, _LC("GameSettings", "Log node import (spawn)"));
475 DrawGCheckbox(App::diag_rig_log_node_stats, _LC("GameSettings", "Log node stats (spawn)"));
476 DrawGCheckbox(App::diag_camera, _LC("GameSettings", "Debug camera (rails)"));
477 DrawGCheckbox(App::diag_truck_mass, _LC("GameSettings", "Debug actor mass"));
478 DrawGCheckbox(App::diag_envmap, _LC("GameSettings", "Debug realtime reflections"));
479 DrawGCheckbox(App::diag_videocameras, _LC("GameSettings", "Debug videocameras"));
480 DrawGCheckbox(App::diag_warning_texture, _LC("GameSettings", "Debug textures"));
481 DrawGCheckbox(App::diag_hide_broken_beams, _LC("GameSettings", "Hide broken beams"));
482 DrawGCheckbox(App::diag_hide_wheel_info, _LC("GameSettings", "Hide wheel info"));
483 DrawGCheckbox(App::diag_hide_wheels, _LC("GameSettings", "Hide wheels"));
484 DrawGCheckbox(App::diag_hide_nodes, _LC("GameSettings", "Hide nodes"));
485 DrawGCheckbox(App::diag_log_console_echo, _LC("GameSettings", "Echo log to console"));
486 DrawGCheckbox(App::diag_log_beam_break, _LC("GameSettings", "Log beam breaking"));
487 DrawGCheckbox(App::diag_log_beam_deform, _LC("GameSettings", "Log beam deforming"));
488 DrawGCheckbox(App::diag_log_beam_trigger, _LC("GameSettings", "Log beam triggers"));
489 DrawGCheckbox(App::diag_allow_window_resize, _LC("GameSettings", "Allow game window resizing"));
490 DrawGCheckbox(App::diag_use_mygui_logfile, _LC("GameSettings", "Enable MyGUI.log (needs restart)"));
491 if (ImGui::Button(_LC("GameSettings", "Rebuild cache")))
492 {
496 }
497}
498
500{
501 ImGui::TextDisabled("%s", _LC("GameSettings", "Controller options"));
502
504 DrawGCombo(App::io_input_grab_mode, _LC("GameSettings", "Input grab mode"), m_combo_items_input_grab.c_str());
505 if (io_input_grab_mode_old != App::io_input_grab_mode->getEnum<IoInputGrabMode>())
506 {
508 // This may take a second - display a 'please wait' box
511 _LC("GameSettings", "Restarting input subsystem, please wait..."), /*render_frame:*/false);
512 }
513
514 DrawGFloatSlider(App::io_analog_smoothing, _LC("GameSettings", "Analog Input Smoothing"), 0.5f, 2.0f);
515 DrawGFloatSlider(App::io_analog_sensitivity, _LC("GameSettings", "Analog Input Sensitivity"), 0.5f, 2.0f);
516 DrawGFloatSlider(App::io_blink_lock_range, _LC("GameSettings", "Blinker Lock Range"), 0.1f, 1.0f);
517
518 DrawGCheckbox(App::io_arcade_controls, _LC("GameSettings", "Use arcade controls"));
519 DrawGCheckbox(App::io_invert_orbitcam, _LC("GameSettings", "Invert orbit camera"));
520
521 DrawGCheckbox(App::io_ffb_enabled, _LC("GameSettings", "Enable ForceFeedback"));
522 if (App::io_ffb_enabled->getBool())
523 {
524 ImGui::PushItemWidth(125.f);
525 DrawGFloatBox(App::io_ffb_camera_gain, _LC("GameSettings", "FFB camera gain"));
526 DrawGFloatBox(App::io_ffb_center_gain, _LC("GameSettings", "FFB center gain"));
527 DrawGFloatBox(App::io_ffb_master_gain, _LC("GameSettings", "FFB master gain"));
528 DrawGFloatBox(App::io_ffb_stress_gain, _LC("GameSettings", "FFB stress gain"));
529 ImGui::PopItemWidth();
530 }
531
532 DrawGIntCheck(App::io_outgauge_mode, _LC("GameSettings", "Enable OutGauge protocol"));
533 if (App::io_outgauge_mode->getBool())
534 {
535 DrawGTextEdit(App::io_outgauge_ip, _LC("GameSettings", "OutGauge IP"), m_buf_io_outgauge_ip);
536 ImGui::PushItemWidth(125.f);
537 DrawGIntBox(App::io_outgauge_port, _LC("GameSettings", "OutGauge port"));
538 DrawGIntBox(App::io_outgauge_id, _LC("GameSettings", "OutGauge ID"));
539 DrawGFloatBox(App::io_outgauge_delay, _LC("GameSettings", "OutGauge delay"));
540 ImGui::PopItemWidth();
541 }
542}
543
545{
546 m_is_visible = v;
547 if (!v && App::app_state->getEnum<AppState>() == RoR::AppState::MAIN_MENU)
548 {
550 }
551
552 // Pre-format combobox strings.
554 {
561 }
562
564 {
571 }
572
574 {
578 }
579
580 if (m_combo_items_sky_mode == "")
581 {
586 }
587
588 if (m_combo_items_tex_filter == "")
589 {
595 }
596
597 if (m_combo_items_vegetation == "")
598 {
604 }
605
606 if (m_combo_items_water_mode == "")
607 {
615 }
616
618 {
623 }
624
625 if (m_combo_items_input_grab == "")
626 {
631 }
632
634 {
639 }
640
642 {
648 }
649}
650
652{
653 ImGui::PushID("uiPreset");
654
655 ImGui::SetNextItemWidth(UI_SELECTOR_WIDTH);
656 if (DrawGCombo(App::ui_preset, _LC("TopMenubar", "UI Preset"), m_cached_uipreset_combo_string.c_str()))
657 {
659 }
660
661 if (ImGui::IsItemHovered())
662 {
663 ImGui::BeginTooltip();
664 const float COLLUMNWIDTH_NAME = 175.f;
665 const float COLLUMNWIDTH_VALUE = 60.f;
666 // Hack to make space for the table (doesn't autoresize)
667 ImGui::Dummy(ImVec2(COLLUMNWIDTH_NAME + COLLUMNWIDTH_VALUE*((int)UiPreset::Count), 1.f));
668
669 // UiPresets table
670 ImGui::Columns((int)UiPreset::Count + 1);
671 ImGui::SetColumnWidth(0, COLLUMNWIDTH_NAME);
672 for (int i = 0; i < (int)UiPreset::Count; i++)
673 {
674 ImGui::SetColumnWidth(i+1, COLLUMNWIDTH_VALUE);
675 }
676
677 // table header
678 ImGui::TextDisabled("%s", "Setting");
679 ImGui::NextColumn();
680 for (int i = 0; i < (int)UiPreset::Count; i++)
681 {
682 ImGui::TextDisabled("%s", ToLocalizedString((UiPreset)i).c_str());
683 ImGui::NextColumn();
684 }
685
686 // table body
687 ImGui::Separator();
688
689 int presetId = 0;
690 while (UiPresets[presetId].uip_cvar != nullptr)
691 {
692 ImGui::Text("%s", UiPresets[presetId].uip_cvar);
693 ImGui::NextColumn();
694 for (int i = 0; i < (int)UiPreset::Count; i++)
695 {
696 ImGui::Text("%s", UiPresets[presetId].uip_values[i].c_str());
697 ImGui::NextColumn();
698 }
699
700 presetId++;
701 }
702
703 // end table
704 ImGui::Columns(1);
705 ImGui::EndTooltip();
706 }
707
708 ImGui::PopID(); //"uiPreset"
709}
710
711void GameSettings::DrawUiDefaultDashboard(CacheEntryPtr& entry, CVar* cvar, CacheCategoryId category_id, const std::string& label)
712{
713 if (!entry || entry->fname != cvar->getStr())
714 {
715 entry = App::GetCacheSystem()->FindEntryByFilename(LT_DashBoard, /* partial: */false, cvar->getStr());
716 }
717
718 ImGui::AlignTextToFramePadding();
719 std::string caption = fmt::format("{}##truck_dash", entry ? entry->dname : cvar->getStr());
720 if (ImGui::Button(caption.c_str(), ImVec2(UI_SELECTOR_WIDTH, 0.f)))
721 {
722 default_dash_being_selected = category_id;
725 }
726 ImGui::SameLine();
727 ImGui::Text("%s", label.c_str());
728}
System integration layer; inspired by OgreBites::ApplicationContext.
A database of user-installed content alias 'mods' (vehicles, terrains...)
Game state manager and message-queue provider.
#define _LC(ctx, str)
Definition Language.h:38
Ogre::Root * GetOgreRoot()
Definition AppContext.h:65
Quake-style console variable, defined in RoR.cfg or crated via Console UI and scripts.
Definition CVar.h:53
T getEnum() const
Definition CVar.h:99
std::string const & getStr() const
Definition CVar.h:95
void setStr(std::string const &str)
Definition CVar.h:83
void setVal(T val)
Definition CVar.h:72
Ogre::String fname
filename
Definition CacheSystem.h:67
Ogre::String dname
name parsed from the file
Definition CacheSystem.h:70
CacheEntryPtr FindEntryByFilename(RoR::LoaderType type, bool partial, const std::string &_filename_maybe_bundlequalified)
Returns NULL if none found; "Bundle-qualified" format also specifies the ZIP/directory in modcache,...
std::string m_combo_items_tex_filter
std::string m_combo_items_shadow_type
CacheCategoryId default_dash_being_selected
Str< 1000 > m_buf_app_extra_mod_dir
std::string m_combo_items_extcam_mode
Str< 1000 > m_buf_diag_preset_terrain
Str< 1000 > m_buf_diag_preset_vehicle
std::string m_combo_items_sky_mode
Str< 1000 > m_buf_audio_default_efx_preset
CacheEntryPtr m_ui_known_dash_truck
std::string m_combo_items_water_mode
Str< 1000 > m_buf_audio_force_listener_efx_preset
std::string m_cached_uipreset_combo_string
void DrawUiDefaultDashboard(CacheEntryPtr &entry, CVar *cvar, CacheCategoryId category_id, const std::string &label)
std::string m_combo_items_input_grab
std::string m_combo_items_gearbox_mode
std::string m_combo_items_light_sources
CacheEntryPtr m_ui_known_dash_boat
Str< 1000 > m_buf_diag_preset_veh_config
std::string m_combo_items_efx_reverb_engine
std::string m_combo_items_vegetation
void SetProgress(int _percent, const std::string &_text="", bool render_frame=true)
GUI::GameSettings GameSettings
Definition GUIManager.h:119
void ApplyUiPreset()
reads cvar 'ui_preset'
GUI::LoadingWindow LoadingWindow
Definition GUIManager.h:132
GUI::GameMainMenu GameMainMenu
Definition GUIManager.h:117
void PushMessage(Message m)
Doesn't guarantee order! Use ChainMessage() if order matters.
std::vector< std::pair< std::string, std::string > > getLanguages()
Definition Language.h:50
@ MSG_GUI_OPEN_MENU_REQUESTED
@ MSG_APP_MODCACHE_PURGE_REQUESTED
Definition Application.h:92
@ MSG_APP_MODCACHE_UPDATE_REQUESTED
Definition Application.h:91
@ MSG_GUI_OPEN_SELECTOR_REQUESTED
Payload = LoaderType* (owner), Description = GUID | empty.
@ MSG_APP_REINIT_INPUT_REQUESTED
Definition Application.h:96
std::string ToLocalizedString(SimGearboxMode e)
@ MANUAL_STICK
Fully manual: stick shift.
@ MANUAL_RANGES
Fully manual: stick shift with ranges.
@ SEMI_AUTO
Manual shift with auto clutch.
@ MANUAL
Fully manual: sequential shift.
@ AUTO
Automatic shift.
CVar * diag_warning_texture
CVar * gfx_sky_mode
CVar * io_ffb_enabled
AppContext * GetAppContext()
CVar * audio_force_listener_efx_preset
CVar * ui_show_live_repair_controls
bool
CVar * audio_efx_reverb_engine
CVar * audio_menu_music
CVar * app_screenshot_format
CVar * audio_enable_directed_sounds
CVar * io_outgauge_delay
CVar * gfx_water_mode
CVar * ui_show_vehicle_buttons
CVar * audio_enable_obstruction
CVar * io_outgauge_mode
CVar * diag_auto_spawner_report
CVar * gfx_extcam_mode
CVar * sim_spawn_running
CVar * io_blink_lock_range
CVar * diag_log_beam_trigger
CVar * audio_doppler_factor
CVar * diag_rig_log_node_import
CVar * diag_allow_window_resize
CVar * gfx_envmap_rate
CVar * app_language
CVar * app_skip_main_menu
CVar * io_invert_orbitcam
CVar * diag_rig_log_node_stats
CVar * ui_preset
enum RoR::UiPreset
CVar * gfx_fov_internal_default
CVar * sim_replay_length
CVar * sim_races_enabled
CVar * app_rendersys_override
CVar * io_outgauge_port
CVar * audio_default_efx_preset
CVar * audio_enable_reflection_panning
CVar * audio_enable_creak
CVar * diag_preset_vehicle
CVar * gfx_sight_range
CVar * app_country
CVar * audio_force_obstruction_inside_vehicles
CVar * gfx_anisotropy
CVar * gfx_particles_mode
CVar * diag_hide_wheels
CVar * diag_truck_mass
CVar * io_ffb_stress_gain
CVar * diag_hide_nodes
CVar * audio_master_volume
GUIManager * GetGuiManager()
GameContext * GetGameContext()
CVar * gfx_camera_height
CVar * sim_tuning_enabled
CVar * io_ffb_center_gain
CVar * gfx_auto_lod
CVar * io_analog_sensitivity
CVar * app_state
CVar * gfx_water_waves
CVar * diag_log_beam_deform
CVar * sim_no_collisions
CVar * audio_device_name
CVar * sim_realistic_commands
CVar * sim_replay_stepping
CVar * sim_no_self_collisions
CVar * gfx_fps_limit
CVar * gfx_vegetation_mode
CVar * diag_envmap
CVar * diag_hide_wheel_info
CVar * gfx_declutter_map
CVar * diag_camera
CVar * audio_enable_efx
CVar * app_disable_online_api
CVar * io_outgauge_id
CVar * gfx_flares_mode
CVar * ui_default_boat_dash
string; name of the '.dashboard' file in modcache.
CVar * ui_default_truck_dash
string; name of the '.dashboard' file in modcache.
CVar * sim_gearbox_mode
CVar * io_ffb_master_gain
CVar * diag_hide_broken_beams
CVar * gfx_alt_actor_materials
CacheSystem * GetCacheSystem()
CVar * diag_preset_veh_enter
CVar * gfx_speedo_imperial
CVar * ui_always_show_fullsize
CVar * diag_use_mygui_logfile
CVar * sim_quickload_dialog
CVar * gfx_envmap_enabled
CVar * diag_preset_terrain
CVar * gfx_reduce_shadows
CVar * diag_videocameras
CVar * audio_enable_occlusion
CVar * audio_engine_controls_environmental_audio
CVar * gfx_surveymap_icons
CVar * io_ffb_camera_gain
CVar * io_outgauge_ip
CVar * diag_preset_veh_config
CVar * io_discord_rpc
CVar * gfx_texture_filter
CVar * gfx_fov_external_default
CVar * diag_log_beam_break
CVar * io_input_grab_mode
CVar * gfx_enable_videocams
CVar * sim_replay_enabled
CVar * io_arcade_controls
CVar * io_analog_smoothing
CVar * gfx_shadow_quality
LanguageEngine * GetLanguageEngine()
CVar * diag_log_console_echo
CVar * app_extra_mod_path
CVar * gfx_shadow_type
CVar * gfx_skidmarks_mode
CVar * app_async_physics
@ CURR_VEHICLE_HEAD_ONLY
Only current vehicle, main lights.
@ ALL_VEHICLES_HEAD_ONLY
All vehicles, main lights.
@ NONE
None (fastest)
@ NO_LIGHTSOURCES
No light sources.
@ ALL_VEHICLES_ALL_LIGHTS
All vehicles, all lights.
LoaderType
< Search mode for ModCache::Query() & Operation mode for GUI::MainSelector
@ LT_DashBoard
void DrawGFloatBox(CVar *cvar, const char *label)
Definition GUIUtils.cpp:336
void DrawGTextEdit(CVar *cvar, const char *label, Str< 1000 > &buf)
Definition GUIUtils.cpp:345
void DrawGIntSlider(CVar *cvar, const char *label, int v_min, int v_max)
Definition GUIUtils.cpp:316
UiPreset
See UiPresets[] list in GUIManager.cpp (declared extern in GUIManager.h)
@ FULL_FAST
Reflection + refraction (speed optimized)
@ FULL_HQ
Reflection + refraction (quality optimized)
@ BASIC
Basic (fastest)
@ REFLECT
Reflection.
IoInputGrabMode
void DrawGIntBox(CVar *cvar, const char *label)
Definition GUIUtils.cpp:307
void ImTerminateComboboxString(std::string &target)
Definition GUIUtils.cpp:434
void ImAddItemToComboboxString(std::string &target, std::string const &item)
Definition GUIUtils.cpp:412
@ CAELUM
Caelum (best looking, slower)
@ SANDSTORM
Sandstorm (fastest)
@ SKYX
SkyX (best looking, slower)
void DrawGFloatSlider(CVar *cvar, const char *label, float v_min, float v_max)
Definition GUIUtils.cpp:326
UiPresetEntry UiPresets[]
Global list of UI Presets, selectable via Settings menu in TopMenubar.
bool DrawGCheckbox(CVar *cvar, const char *label)
Definition GUIUtils.cpp:287
CacheCategoryId
@ CID_DashboardsTruck
@ CID_DashboardsBoat
void DrawGIntCheck(CVar *cvar, const char *label)
Definition GUIUtils.cpp:298
bool DrawGCombo(CVar *cvar, const char *label, const char *values)
Definition GUIUtils.cpp:361
Unified game event system - all requests and state changes are reported using a message.
Definition GameContext.h:52