RigsofRods
Soft-body Physics Simulation
AppContext.cpp
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 
22 #include "AppContext.h"
23 
24 #include "AdvancedScreen.h"
25 #include "Actor.h"
26 #include "CameraManager.h"
27 #include "ChatSystem.h"
28 #include "Console.h"
29 #include "ContentManager.h"
30 #include "DashBoardManager.h"
31 #include "ErrorUtils.h"
32 #include "GameContext.h"
33 #include "GUIManager.h"
34 #include "GUI_LoadingWindow.h"
35 #include "GUI_MainSelector.h"
38 #include "InputEngine.h"
39 #include "Language.h"
40 #include "PlatformUtils.h"
41 #include "RoRVersion.h"
42 #include "OverlayWrapper.h"
43 
44 #ifdef USE_ANGELSCRIPT
45 # include "ScriptEngine.h"
46 #endif
47 
48 #ifdef _WIN32
49 # include <windows.h>
50 #endif
51 
52 #include <iomanip>
53 #include <sstream>
54 #include <string>
55 #include <ctime>
56 
57 using namespace RoR;
58 
59 // --------------------------
60 // Input handling
61 
63 {
68 
69  if (App::io_ffb_enabled->getBool())
70  {
72  }
73  return true;
74 }
75 
76 bool AppContext::mouseMoved(const OIS::MouseEvent& arg) // overrides OIS::MouseListener
77 {
80 
81  if (!ImGui::GetIO().WantCaptureMouse) // true if mouse is over any window
82  {
83  bool handled = false;
85  {
86  handled = App::GetOverlayWrapper()->mouseMoved(arg); // update the old airplane / autopilot gui
87  }
88  if (!handled)
89  {
90  if (!App::GetCameraManager()->mouseMoved(arg))
91  {
93  }
94  }
95  }
96 
97  return true;
98 }
99 
100 bool AppContext::mousePressed(const OIS::MouseEvent& arg, OIS::MouseButtonID _id) // overrides OIS::MouseListener
101 {
104 
105  if (!ImGui::GetIO().WantCaptureMouse) // true if mouse is over any window
106  {
107  bool handled = false;
109  {
110  handled = App::GetOverlayWrapper()->mousePressed(arg, _id); // update the old airplane / autopilot gui
111  }
112 
113  if (!handled && App::app_state->getEnum<AppState>() == AppState::SIMULATION)
114  {
116  App::GetCameraManager()->mousePressed(arg, _id);
117  }
118  }
119  else
120  {
122  }
123 
124  return true;
125 }
126 
127 bool AppContext::mouseReleased(const OIS::MouseEvent& arg, OIS::MouseButtonID _id) // overrides OIS::MouseListener
128 {
131 
132  if (!ImGui::GetIO().WantCaptureMouse) // true if mouse is over any window
133  {
134  bool handled = false;
136  {
137  handled = App::GetOverlayWrapper()->mouseReleased(arg, _id); // update the old airplane / autopilot gui
138  }
139  if (!handled && App::app_state->getEnum<AppState>() == AppState::SIMULATION)
140  {
142  }
143  }
144  else
145  {
147  }
148 
149  return true;
150 }
151 
152 bool AppContext::keyPressed(const OIS::KeyEvent& arg)
153 {
155 
156  if (!App::GetGuiManager()->IsGuiCaptureKeyboardRequested() &&
157  !ImGui::GetIO().WantCaptureKeyboard)
158  {
160  }
161 
162  return true;
163 }
164 
165 bool AppContext::keyReleased(const OIS::KeyEvent& arg)
166 {
168 
169  if (!App::GetGuiManager()->IsGuiCaptureKeyboardRequested() &&
170  !ImGui::GetIO().WantCaptureKeyboard)
171  {
173  }
174  else if (App::GetInputEngine()->isKeyDownEffective(arg.key))
175  {
176  // If capturing is requested, still pass release events for already-pressed keys.
178  }
179 
180  return true;
181 }
182 
183 bool AppContext::buttonPressed(const OIS::JoyStickEvent& arg, int) { App::GetInputEngine()->ProcessJoystickEvent(arg); return true; }
184 bool AppContext::buttonReleased(const OIS::JoyStickEvent& arg, int) { App::GetInputEngine()->ProcessJoystickEvent(arg); return true; }
185 bool AppContext::axisMoved(const OIS::JoyStickEvent& arg, int) { App::GetInputEngine()->ProcessJoystickEvent(arg); return true; }
186 bool AppContext::sliderMoved(const OIS::JoyStickEvent& arg, int) { App::GetInputEngine()->ProcessJoystickEvent(arg); return true; }
187 bool AppContext::povMoved(const OIS::JoyStickEvent& arg, int) { App::GetInputEngine()->ProcessJoystickEvent(arg); return true; }
188 
189 void AppContext::windowResized(Ogre::RenderWindow* rw)
190 {
191  App::GetInputEngine()->windowResized(rw); // Update mouse area
193  if (App::sim_state->getEnum<AppState>() == RoR::AppState::SIMULATION)
194  {
195  for (ActorPtr& actor: App::GetGameContext()->GetActorManager()->GetActors())
196  {
197  actor->ar_dashboard->windowResized();
198  }
199  }
200 }
201 
202 void AppContext::windowFocusChange(Ogre::RenderWindow* rw)
203 {
205 }
206 
207 // --------------------------
208 // Rendering
209 
210 void AppContext::SetRenderWindowIcon(Ogre::RenderWindow* rw)
211 {
212 #ifdef _WIN32
213  size_t hWnd = 0;
214  rw->getCustomAttribute("WINDOW", &hWnd);
215 
216  char buf[MAX_PATH];
217  ::GetModuleFileNameA(0, (LPCH)&buf, MAX_PATH);
218 
219  HINSTANCE instance = ::GetModuleHandleA(buf);
220  HICON hIcon = ::LoadIconA(instance, MAKEINTRESOURCEA(101));
221  if (hIcon)
222  {
223  ::SendMessageA((HWND)hWnd, WM_SETICON, 1, (LPARAM)hIcon);
224  ::SendMessageA((HWND)hWnd, WM_SETICON, 0, (LPARAM)hIcon);
225  }
226 #endif // _WIN32
227 }
228 
230 {
231  // Create 'OGRE root' facade
232  // * leave 'plugins' param empty, we load manually below
233  // * note file 'ogre.cfg' isn't read immediatelly but only after calling 'restoreConfig()' below.
234  std::string log_filepath = PathCombine(App::sys_logs_dir->getStr(), "RoR.log");
235  std::string cfg_filepath = PathCombine(App::sys_config_dir->getStr(), "ogre.cfg");
236  LOG(fmt::format("[RoR|Startup|Rendering] Creating OGRE renderer Root object, config='{}'", cfg_filepath));
237  m_ogre_root = new Ogre::Root("", cfg_filepath, log_filepath);
238 
239  // load OGRE plugins manually
240 #ifdef _DEBUG
241  std::string plugins_path = PathCombine(RoR::App::sys_process_dir->getStr(), "plugins_d.cfg");
242 #else
243  std::string plugins_path = PathCombine(RoR::App::sys_process_dir->getStr(), "plugins.cfg");
244 #endif
245  LOG(fmt::format("[RoR|Startup|Rendering] Loading OGRE renderer plugins config '{}'.", plugins_path));
246  try
247  {
248  Ogre::ConfigFile cfg;
249  cfg.load(plugins_path);
250  std::string plugin_dir = cfg.getSetting("PluginFolder", /*section=*/"", /*default=*/App::sys_process_dir->getStr());
251  Ogre::StringVector plugins = cfg.getMultiSetting("Plugin");
252  for (Ogre::String plugin_filename: plugins)
253  {
254  try
255  {
256  m_ogre_root->loadPlugin(PathCombine(plugin_dir, plugin_filename));
257  }
258  catch (Ogre::Exception&) {} // Logged by OGRE
259  }
260  }
261  catch (Ogre::Exception& e)
262  {
264  _L("Startup error"),
265  fmt::format(_L("Could not load file '{}' - make sure the game is installed correctly.\n\nDetailed info: {}"), plugins_path, e.getDescription()));
266  return false;
267  }
268 
269  // Load renderer configuration
270  if (!m_ogre_root->restoreConfig())
271  {
272  LOG(fmt::format("[RoR|Startup|Rendering] WARNING - invalid 'ogre.cfg', selecting render plugin manually..."));
273 
274  const auto render_systems = App::GetAppContext()->GetOgreRoot()->getAvailableRenderers();
275  if (!render_systems.empty())
276  {
277  LOG(fmt::format("[RoR|Startup|Rendering] Auto-selected renderer plugin '{}'", render_systems.front()->getName()));
278  m_ogre_root->setRenderSystem(render_systems.front());
279  }
280  else
281  {
282  ErrorUtils::ShowError (_L("Startup error"), _L("No render system plugin available. Check your plugins.cfg"));
283  return false;
284  }
285  }
286 
287  const auto rs = m_ogre_root->getRenderSystemByName(App::app_rendersys_override->getStr());
288  if (rs != nullptr && rs != m_ogre_root->getRenderSystem())
289  {
290  LOG(fmt::format("[RoR|Startup|Rendering] Setting renderer '{}' on behalf of 'app_rendersys_override' (user selection via Settings UI)", rs->getName()));
291  // The user has selected a different render system during the previous session.
292  m_ogre_root->setRenderSystem(rs);
293  m_ogre_root->saveConfig();
294  }
296 
297  // Start the renderer
298  LOG(fmt::format("[RoR|Startup|Rendering] Starting renderer '{}' (without auto-creating render window)", m_ogre_root->getRenderSystem()->getName()));
299  m_ogre_root->initialise(/*createWindow=*/false);
300 
301  // Review configuration options
302  Ogre::ConfigOptionMap ropts = m_ogre_root->getRenderSystem()->getConfigOptions();
303  std::stringstream ropts_log;
304  for (auto& pair: ropts)
305  {
306  ropts_log << " " << pair.first << " = " << pair.second.currentValue << " (";
307  for (auto& val: pair.second.possibleValues)
308  {
309  ropts_log << val << ", ";
310  }
311  ropts_log << ")\n";
312  }
313  LOG(fmt::format("[RoR|Startup|Rendering] Renderer options as reported by OGRE:\n{}", ropts_log.str()));
314 
315  // Configure the render window
316  Ogre::NameValuePairList miscParams;
317  miscParams["FSAA"] = ropts["FSAA"].currentValue;
318  miscParams["vsync"] = ropts["VSync"].currentValue;
319  miscParams["gamma"] = ropts["sRGB Gamma Conversion"].currentValue;
320  if (!App::diag_allow_window_resize->getBool())
321  {
322  miscParams["border"] = "fixed";
323  }
324 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
325  const auto rd = ropts["Rendering Device"];
326  const auto it = std::find(rd.possibleValues.begin(), rd.possibleValues.end(), rd.currentValue);
327  const int idx = std::distance(rd.possibleValues.begin(), it);
328  miscParams["monitorIndex"] = Ogre::StringConverter::toString(idx);
329  miscParams["windowProc"] = Ogre::StringConverter::toString((size_t)OgreBites::WindowEventUtilities::_WndProc);
330 #endif
331 
332  // Validate rendering resolution
333  Ogre::uint32 width, height;
334  std::istringstream mode (ropts["Video Mode"].currentValue);
335  Ogre::String token;
336  mode >> width;
337  mode >> token; // 'x' as seperator between width and height
338  mode >> height;
339 
340  if(width < 800) width = 800;
341  if(height < 600) height = 600;
342 
343  // Review render window settings
344  std::stringstream miscParams_log;
345  for (auto& pair: miscParams)
346  {
347  miscParams_log << " " << pair.first << " = " << pair.second << "\n";
348  }
349  LOG(fmt::format("[RoR|Startup|Rendering] Creating render window with settings:\n{}", miscParams_log.str()));
350 
351  // Create render window
352  m_render_window = Ogre::Root::getSingleton().createRenderWindow (
353  "Rigs of Rods version " + Ogre::String (ROR_VERSION_STRING),
354  width, height, ropts["Full Screen"].currentValue == "Yes", &miscParams);
355  OgreBites::WindowEventUtilities::_addRenderWindow(m_render_window);
356 
358  m_render_window->setActive(true);
359 
360  // Create viewport (without camera)
361  m_viewport = m_render_window->addViewport(/*camera=*/nullptr);
362  m_viewport->setBackgroundColour(Ogre::ColourValue::Black);
363 
364  return true;
365 }
366 
367 Ogre::RenderWindow* AppContext::CreateCustomRenderWindow(std::string const& window_name, int width, int height)
368 {
369  Ogre::NameValuePairList misc;
370  Ogre::ConfigOptionMap ropts = m_ogre_root->getRenderSystem()->getConfigOptions();
371  misc["FSAA"] = Ogre::StringConverter::parseInt(ropts["FSAA"].currentValue, 0);
372 
373  Ogre::RenderWindow* rw = Ogre::Root::getSingleton().createRenderWindow(window_name, width, height, false, &misc);
374  return rw;
375 }
376 
378 {
379  const std::time_t time = std::time(nullptr);
380  const int index = (time == m_prev_screenshot_time) ? m_prev_screenshot_index+1 : 1;
381 
382  std::stringstream stamp;
383  stamp << std::put_time(std::localtime(&time), "%Y-%m-%d_%H-%M-%S") << "_" << index
384  << "." << App::app_screenshot_format->getStr();
385  std::string path = PathCombine(App::sys_screenshot_dir->getStr(), "screenshot_") + stamp.str();
386 
387  if (App::app_screenshot_format->getStr() == "png")
388  {
389  AdvancedScreen png(m_render_window, path);
390 
391  png.addData("User_NickName", App::mp_player_name->getStr());
392  png.addData("User_Language", App::app_language->getStr());
393 
394  if (App::app_state->getEnum<AppState>() == AppState::SIMULATION &&
395  App::GetGameContext()->GetPlayerActor())
396  {
397  png.addData("Truck_file", App::GetGameContext()->GetPlayerActor()->ar_filename);
398  png.addData("Truck_name", App::GetGameContext()->GetPlayerActor()->getTruckName());
399  }
400  if (App::GetGameContext()->GetTerrain())
401  {
402  png.addData("Terrn_file", App::sim_terrain_name->getStr());
403  png.addData("Terrn_name", App::sim_terrain_gui_name->getStr());
404  }
405  if (App::mp_state->getEnum<MpState>() == MpState::CONNECTED)
406  {
407  png.addData("MP_ServerName", App::mp_server_host->getStr());
408  }
409 
410  png.write();
411  }
412  else
413  {
414  m_render_window->writeContentsToFile(path);
415  }
416 
418  _L("Screenshot: ") + stamp.str());
419 
420  m_prev_screenshot_time = time;
421  m_prev_screenshot_index = index;
422 }
423 
425 {
426  if (!val && !m_windowed_fix)
427  {
428  // Workaround OGRE glitch - badly aligned viewport after first full->window switch
429  // Observed on Win10/OpenGL (GeForce GTX 660)
430  m_render_window->setFullscreen(false, m_render_window->getWidth()-1, m_render_window->getHeight()-1);
431  m_render_window->setFullscreen(false, m_render_window->getWidth()+1, m_render_window->getHeight()+1);
432  }
433  else
434  {
435  m_render_window->setFullscreen(val, m_render_window->getWidth(), m_render_window->getHeight());
436  }
437 }
438 
439 // --------------------------
440 // Program paths and logging
441 
443 {
444  // Process directory
445  std::string exe_path = RoR::GetExecutablePath();
446  if (exe_path.empty())
447  {
448  ErrorUtils::ShowError(_L("Startup error"), _L("Error while retrieving program directory path"));
449  return false;
450  }
451  App::sys_process_dir->setStr(RoR::GetParentDirectory(exe_path.c_str()).c_str());
452 
453  // RoR's home directory
454  std::string local_userdir = PathCombine(App::sys_process_dir->getStr(), "config"); // TODO: Think of a better name, this is ambiguious with ~/.rigsofrods/config which stores configfiles! ~ only_a_ptr, 02/2018
455  if (FolderExists(local_userdir))
456  {
457  // It's a portable installation
458  App::sys_user_dir->setStr(local_userdir.c_str());
459  }
460  else
461  {
462  // Default location - user's home directory
463  std::string user_home = RoR::GetUserHomeDirectory();
464  if (user_home.empty())
465  {
466  ErrorUtils::ShowError(_L("Startup error"), _L("Error while retrieving user directory path"));
467  return false;
468  }
469  RoR::Str<500> ror_homedir;
470 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
471  ror_homedir << user_home << PATH_SLASH << "My Games";
472  CreateFolder(ror_homedir.ToCStr());
473  ror_homedir << PATH_SLASH << "Rigs of Rods";
474 #elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX
475  char* env_SNAP = getenv("SNAP_USER_COMMON");
476  if(env_SNAP)
477  ror_homedir = env_SNAP;
478  else
479  ror_homedir << user_home << PATH_SLASH << ".rigsofrods";
480 #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
481  ror_homedir << user_home << PATH_SLASH << "RigsOfRods";
482 #endif
483  CreateFolder(ror_homedir.ToCStr ());
484  App::sys_user_dir->setStr(ror_homedir.ToCStr ());
485  }
486 
487  return true;
488 }
489 
491 {
492  std::string logs_dir = PathCombine(App::sys_user_dir->getStr(), "logs");
493  CreateFolder(logs_dir);
494  App::sys_logs_dir->setStr(logs_dir.c_str());
495 
496  auto ogre_log_manager = OGRE_NEW Ogre::LogManager();
497  std::string rorlog_path = PathCombine(logs_dir, "RoR.log");
498  Ogre::Log* rorlog = ogre_log_manager->createLog(rorlog_path, true, true);
499  rorlog->stream() << "[RoR] Rigs of Rods (www.rigsofrods.org) version " << ROR_VERSION_STRING;
500  std::time_t t = std::time(nullptr);
501  rorlog->stream() << "[RoR] Current date: " << std::put_time(std::localtime(&t), "%Y-%m-%d");
502 
503  rorlog->addListener(App::GetConsole()); // Allow console to intercept log messages
504 }
505 
507 {
508  std::string process_dir = PathCombine(App::sys_process_dir->getStr(), "resources");
509 #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
510  if (!FolderExists(process_dir))
511  {
512  process_dir = "/usr/share/rigsofrods/resources/";
513  }
514 #endif
515  if (!FolderExists(process_dir))
516  {
517  ErrorUtils::ShowError(_L("Startup error"), _L("Resources folder not found. Check if correctly installed."));
518  return false;
519  }
520  App::sys_resources_dir->setStr(process_dir);
521  return true;
522 }
523 
525 {
526  Ogre::String src_path = PathCombine(App::sys_resources_dir->getStr(), "skeleton.zip");
527  Ogre::ResourceGroupManager::getSingleton().addResourceLocation(src_path, "Zip", "SrcRG");
528  Ogre::FileInfoListPtr fl = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("SrcRG", "*", true);
529  if (fl->empty())
530  {
531  ErrorUtils::ShowError(_L("Startup error"), _L("Faulty resource folder. Check if correctly installed."));
532  return false;
533  }
534  Ogre::String dst_path = PathCombine(App::sys_user_dir->getStr(), "");
535  for (auto file : *fl)
536  {
537  CreateFolder(dst_path + file.basename);
538  }
539  fl = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("SrcRG", "*");
540  if (fl->empty())
541  {
542  ErrorUtils::ShowError(_L("Startup error"), _L("Faulty resource folder. Check if correctly installed."));
543  return false;
544  }
545  Ogre::ResourceGroupManager::getSingleton().addResourceLocation(dst_path, "FileSystem", "DstRG", false, false);
546  for (auto file : *fl)
547  {
548  if (file.uncompressedSize == 0)
549  continue;
550  Ogre::String path = file.path + file.basename;
551  if (!Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("DstRG", path)->empty())
552  continue;
553  Ogre::DataStreamPtr src_ds = Ogre::ResourceGroupManager::getSingleton().openResource(path, "SrcRG");
554  Ogre::DataStreamPtr dst_ds = Ogre::ResourceGroupManager::getSingleton().createResource(path, "DstRG");
555  std::vector<char> buf(src_ds->size());
556  size_t read = src_ds->read(buf.data(), src_ds->size());
557  if (read > 0)
558  {
559  dst_ds->write(buf.data(), read);
560  }
561  }
562  Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup("SrcRG");
563  Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup("DstRG");
564 
565  return true;
566 }
567 
569 {
570 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
571  Ogre::String old_ror_homedir = Ogre::StringUtil::format("%s\\Rigs of Rods 0.4", RoR::GetUserHomeDirectory().c_str());
572  if(FolderExists(old_ror_homedir))
573  {
574  if (!FileExists(Ogre::StringUtil::format("%s\\OBSOLETE_FOLDER.txt", old_ror_homedir.c_str())))
575  {
576  Ogre::String obsoleteMessage = Ogre::StringUtil::format("This folder is obsolete, please move your mods to %s", App::sys_user_dir->getStr());
577  try
578  {
579  Ogre::ResourceGroupManager::getSingleton().addResourceLocation(old_ror_homedir, "FileSystem", "homedir", false, false);
580  Ogre::DataStreamPtr stream = Ogre::ResourceGroupManager::getSingleton().createResource("OBSOLETE_FOLDER.txt", "homedir");
581  stream->write(obsoleteMessage.c_str(), obsoleteMessage.length());
582  Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup("homedir");
583  }
584  catch (std::exception & e)
585  {
586  RoR::LogFormat("Error writing to %s, message: '%s'", old_ror_homedir.c_str(), e.what());
587  }
588  Ogre::String message = Ogre::StringUtil::format(
589  "Welcome to Rigs of Rods %s\nPlease note that the mods folder has moved to:\n\"%s\"\nPlease move your mods to the new folder to continue using them",
591  App::sys_user_dir->getStr()
592  );
593 
594  RoR::App::GetGuiManager()->ShowMessageBox("Obsolete folder detected", message.c_str());
595  }
596  }
597 #endif // OGRE_PLATFORM_WIN32
598 }
599 
601 {
602  m_mainthread_id = std::this_thread::get_id();
603 
604  // This cannot be done earlier as it uses the above thread ID to assert() against invalid access.
606 }
RoR::App::sys_user_dir
CVar * sys_user_dir
Definition: Application.cpp:163
GameContext.h
Game state manager and message-queue provider.
RoR::AppContext::SetUpProgramPaths
bool SetUpProgramPaths()
Definition: AppContext.cpp:442
RoR::AppContext::mousePressed
virtual bool mousePressed(const OIS::MouseEvent &arg, OIS::MouseButtonID id) override
Definition: AppContext.cpp:100
GUI_MultiplayerClientList.h
RoR::SceneMouse::mousePressed
bool mousePressed(const OIS::MouseEvent &_arg, OIS::MouseButtonID _id)
Definition: SceneMouse.cpp:228
RoR::AppContext::m_viewport
Ogre::Viewport * m_viewport
Definition: AppContext.h:99
RoR::SceneMouse::mouseMoved
bool mouseMoved(const OIS::MouseEvent &_arg)
Definition: SceneMouse.cpp:114
RoR::InputEngine::resetKeys
void resetKeys()
Definition: InputEngine.cpp:692
RoR::AppContext::m_windowed_fix
bool m_windowed_fix
Workaround OGRE glitch when switching from fullscreen.
Definition: AppContext.h:100
OverlayWrapper.h
OgreImGui::InjectMousePressed
void InjectMousePressed(const OIS::MouseEvent &arg, OIS::MouseButtonID id)
Definition: OgreImGui.cpp:99
RoR::GUIManager::WakeUpGUI
void WakeUpGUI()
Definition: GUIManager.cpp:455
RoR::MpState::CONNECTED
@ CONNECTED
RoR::App::sys_resources_dir
CVar * sys_resources_dir
Definition: Application.cpp:168
RoR::AppContext::CreateCustomRenderWindow
Ogre::RenderWindow * CreateCustomRenderWindow(std::string const &name, int width, int height)
Definition: AppContext.cpp:367
RoR::AppContext::mouseReleased
virtual bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id) override
Definition: AppContext.cpp:127
RoR::App::GetCameraManager
CameraManager * GetCameraManager()
Definition: Application.cpp:275
RoR::App::GetGuiManager
GUIManager * GetGuiManager()
Definition: Application.cpp:269
RoR::AppContext::m_prev_screenshot_index
int m_prev_screenshot_index
Definition: AppContext.h:103
DashBoardManager.h
file
This is a raw Ogre binding for Imgui No project cmake file
Definition: README-OgreImGui.txt:3
RoR::App::mp_player_name
CVar * mp_player_name
Definition: Application.cpp:124
RoR::AppContext::keyPressed
virtual bool keyPressed(const OIS::KeyEvent &arg) override
Definition: AppContext.cpp:152
ContentManager.h
RoR::App::GetAppContext
AppContext * GetAppContext()
Definition: Application.cpp:266
format
Truck file format(technical spec)
RoR::App::app_language
CVar * app_language
Definition: Application.cpp:80
AdvancedScreen::write
void write()
Definition: AdvancedScreen.h:68
RoR::App::CreateInputEngine
void CreateInputEngine()
Definition: Application.cpp:302
RoR::AppContext::SetUpRendering
bool SetUpRendering()
Definition: AppContext.cpp:229
RoR::App::GetOverlayWrapper
OverlayWrapper * GetOverlayWrapper()
Definition: Application.cpp:268
RoR::InputEngine::SetJoystickListener
void SetJoystickListener(OIS::JoyStickListener *obj)
Definition: InputEngine.cpp:657
OgreImGui::InjectKeyReleased
void InjectKeyReleased(const OIS::KeyEvent &arg)
Definition: OgreImGui.cpp:128
CameraManager.h
RoR::LogFormat
void LogFormat(const char *format,...)
Improved logging utility. Uses fixed 2Kb buffer.
Definition: Application.cpp:418
RoR::App::app_rendersys_override
CVar * app_rendersys_override
Definition: Application.cpp:86
AppContext.h
System integration layer; inspired by OgreBites::ApplicationContext.
Console.h
RoR::Console::putMessage
void putMessage(MessageArea area, MessageType type, std::string const &msg, std::string icon="")
Definition: Console.cpp:97
RoR::AppContext::buttonReleased
virtual bool buttonReleased(const OIS::JoyStickEvent &arg, int button) override
Definition: AppContext.cpp:184
AdvancedScreen.h
RoR::App::io_ffb_enabled
CVar * io_ffb_enabled
Definition: Application.cpp:192
RoR::FolderExists
bool FolderExists(const char *path)
Path must be UTF-8 encoded.
Definition: PlatformUtils.cpp:169
RoR::AppContext::SetUpResourcesDir
bool SetUpResourcesDir()
Definition: AppContext.cpp:506
RoR::App::sim_state
CVar * sim_state
Definition: Application.cpp:96
RoR::App::sys_logs_dir
CVar * sys_logs_dir
Definition: Application.cpp:167
OgreImGui::InjectMouseReleased
void InjectMouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id)
Definition: OgreImGui.cpp:108
RoR::AppContext::SetUpConfigSkeleton
bool SetUpConfigSkeleton()
Definition: AppContext.cpp:524
Language.h
RefCountingObjectPtr< Actor >
GUI_MultiplayerSelector.h
GUIManager.h
Actor.h
RoR::Console::CONSOLE_SYSTEM_NOTICE
@ CONSOLE_SYSTEM_NOTICE
Definition: Console.h:51
RoR::App::mp_state
CVar * mp_state
Definition: Application.cpp:115
RoR::PATH_SLASH
char PATH_SLASH
Definition: PlatformUtils.cpp:161
RoR::AppContext::buttonPressed
virtual bool buttonPressed(const OIS::JoyStickEvent &arg, int button) override
Definition: AppContext.cpp:183
RoR::AppContext::m_render_window
Ogre::RenderWindow * m_render_window
Definition: AppContext.h:98
RoR::GUIManager::GetImGui
OgreImGui & GetImGui()
Definition: GUIManager.h:157
RoR::InputEngine::windowResized
void windowResized(Ogre::RenderWindow *rw)
Definition: InputEngine.cpp:634
RoR::AppContext::keyReleased
virtual bool keyReleased(const OIS::KeyEvent &arg) override
Definition: AppContext.cpp:165
RoR::GameContext::GetSceneMouse
SceneMouse & GetSceneMouse()
Definition: GameContext.h:170
RoR::CVar::getStr
std::string const & getStr() const
Definition: CVar.h:95
RoR::ForceFeedback::Setup
void Setup()
Definition: ForceFeedback.cpp:35
RoR::Str< 500 >
OgreImGui::InjectMouseMoved
void InjectMouseMoved(const OIS::MouseEvent &arg)
Definition: OgreImGui.cpp:89
RoR::PathCombine
std::string PathCombine(std::string a, std::string b)
Definition: PlatformUtils.h:48
GUI_LoadingWindow.h
RoR::AppContext::mouseMoved
virtual bool mouseMoved(const OIS::MouseEvent &arg) override
Definition: AppContext.cpp:76
RoR::InputEngine::ProcessMouseEvent
void ProcessMouseEvent(const OIS::MouseEvent &arg)
Definition: InputEngine.cpp:686
ErrorUtils.h
GUI_MainSelector.h
RoR::AppContext::SetRenderWindowIcon
void SetRenderWindowIcon(Ogre::RenderWindow *rw)
Definition: AppContext.cpp:210
ScriptEngine.h
RoR::AppContext::m_mainthread_id
std::thread::id m_mainthread_id
Definition: AppContext.h:107
RoR::App::app_state
CVar * app_state
Definition: Application.cpp:79
RoR::InputEngine::ProcessKeyRelease
void ProcessKeyRelease(const OIS::KeyEvent &arg)
Definition: InputEngine.cpp:680
ChatSystem.h
RoR::Str::ToCStr
const char * ToCStr() const
Definition: Str.h:46
RoR::App::sim_terrain_name
CVar * sim_terrain_name
Definition: Application.cpp:97
RoR::AppContext::m_prev_screenshot_time
std::time_t m_prev_screenshot_time
Definition: AppContext.h:102
RoR::CreateFolder
void CreateFolder(const char *path)
Path must be UTF-8 encoded.
Definition: PlatformUtils.cpp:175
OgreImGui::InjectKeyPressed
void InjectKeyPressed(const OIS::KeyEvent &arg)
Definition: OgreImGui.cpp:117
RoR::OverlayWrapper::mouseMoved
bool mouseMoved(const OIS::MouseEvent &_arg)
Definition: OverlayWrapper.cpp:493
PlatformUtils.h
Platform-specific utilities. We use narrow UTF-8 encoded strings as paths. Inspired by http://utf8eve...
RoR::CameraManager::mousePressed
bool mousePressed(const OIS::MouseEvent &_arg, OIS::MouseButtonID _id)
Definition: CameraManager.cpp:589
RoR::GetUserHomeDirectory
std::string GetUserHomeDirectory()
Returns UTF-8 path or empty string on error.
Definition: PlatformUtils.cpp:180
RoR::App::GetConsole
Console * GetConsole()
Definition: Application.cpp:270
RoR::AppContext::axisMoved
virtual bool axisMoved(const OIS::JoyStickEvent &arg, int axis) override
Definition: AppContext.cpp:185
RoR::App::GetGameContext
GameContext * GetGameContext()
Definition: Application.cpp:280
RoR::CacheEntry
Definition: CacheSystem.h:55
RoR::InputEngine::ProcessJoystickEvent
void ProcessJoystickEvent(const OIS::JoyStickEvent &arg)
Definition: InputEngine.cpp:666
RoR::AppState::SIMULATION
@ SIMULATION
RoRVersion.h
RoR::AppContext::CaptureScreenshot
void CaptureScreenshot()
Definition: AppContext.cpp:377
ROR_VERSION_STRING
const char *const ROR_VERSION_STRING
RoR::OverlayWrapper::mousePressed
bool mousePressed(const OIS::MouseEvent &_arg, OIS::MouseButtonID _id)
Definition: OverlayWrapper.cpp:633
RoR::App::sys_config_dir
CVar * sys_config_dir
Definition: Application.cpp:164
RoR::AppContext::SetUpLogging
void SetUpLogging()
Definition: AppContext.cpp:490
RoR::AppContext::SetUpThreads
void SetUpThreads()
Definition: AppContext.cpp:600
RoR::OverlayWrapper::windowResized
void windowResized()
Definition: OverlayWrapper.cpp:129
RoR::AppContext::ActivateFullscreen
void ActivateFullscreen(bool val)
Definition: AppContext.cpp:424
RoR::AppContext::SetUpObsoleteConfMarker
void SetUpObsoleteConfMarker()
Definition: AppContext.cpp:568
AdvancedScreen
Definition: AdvancedScreen.h:47
instance
or anywhere else will not be considered a but parsed as regular data ! Each line is treated as values separated by separators Possible i e animators Multiline description Single instance
Definition: ReadMe.txt:53
RoR::App::app_screenshot_format
CVar * app_screenshot_format
Definition: Application.cpp:85
RoR::AppContext::povMoved
virtual bool povMoved(const OIS::JoyStickEvent &arg, int) override
Definition: AppContext.cpp:187
RoR::AppContext::m_ogre_root
Ogre::Root * m_ogre_root
Definition: AppContext.h:97
RoR::App::mp_server_host
CVar * mp_server_host
Definition: Application.cpp:121
RoR::GetExecutablePath
std::string GetExecutablePath()
Returns UTF-8 path or empty string on error.
Definition: PlatformUtils.cpp:185
RoR::GetParentDirectory
std::string GetParentDirectory(const char *src_buff)
Returns UTF-8 path without trailing slash.
Definition: PlatformUtils.cpp:209
_L
#define _L
Definition: ErrorUtils.cpp:34
RoR::GUIManager::ShowMessageBox
void ShowMessageBox(const char *title, const char *text, bool allow_close=true, const char *btn1_text="OK", const char *btn2_text=nullptr)
Definition: GUIManager.cpp:440
RoR::App::GetInputEngine
InputEngine * GetInputEngine()
Definition: Application.cpp:271
RoR::App::diag_allow_window_resize
CVar * diag_allow_window_resize
Definition: Application.cpp:159
RoR::AppContext::windowFocusChange
virtual void windowFocusChange(Ogre::RenderWindow *rw) override
Definition: AppContext.cpp:202
RoR::SceneMouse::mouseReleased
bool mouseReleased(const OIS::MouseEvent &_arg, OIS::MouseButtonID _id)
Definition: SceneMouse.cpp:304
RoR::AppContext::GetOgreRoot
Ogre::Root * GetOgreRoot()
Definition: AppContext.h:65
InputEngine.h
Handles controller inputs from player. Defines input events and binding mechanism,...
RoR::InputEngine::SetMouseListener
void SetMouseListener(OIS::MouseListener *obj)
Definition: InputEngine.cpp:651
AdvancedScreen::addData
void addData(Ogre::String name, Ogre::String value)
Definition: AdvancedScreen.h:61
RoR::OverlayWrapper::mouseReleased
bool mouseReleased(const OIS::MouseEvent &_arg, OIS::MouseButtonID _id)
Definition: OverlayWrapper.cpp:638
RoR::App::sys_process_dir
CVar * sys_process_dir
Definition: Application.cpp:162
RoR::AppContext::windowResized
virtual void windowResized(Ogre::RenderWindow *rw) override
Definition: AppContext.cpp:189
RoR::Console::CONSOLE_MSGTYPE_INFO
@ CONSOLE_MSGTYPE_INFO
Generic message.
Definition: Console.h:60
RoR::App::sim_terrain_gui_name
CVar * sim_terrain_gui_name
Definition: Application.cpp:98
RoR::GameContext::m_dummy_cache_selection
CacheEntryPtr m_dummy_cache_selection
Definition: GameContext.h:202
RoR::App::sys_screenshot_dir
CVar * sys_screenshot_dir
Definition: Application.cpp:171
RoR::AppContext::m_force_feedback
RoR::ForceFeedback m_force_feedback
Definition: AppContext.h:105
RoR::AppContext::SetUpInput
bool SetUpInput()
Definition: AppContext.cpp:62
ErrorUtils::ShowError
static int ShowError(Ogre::UTFString title, Ogre::UTFString message)
shows a simple error message box
Definition: ErrorUtils.cpp:43
RoR::AppContext::sliderMoved
virtual bool sliderMoved(const OIS::JoyStickEvent &arg, int) override
Definition: AppContext.cpp:186
RoR
Definition: AppContext.h:36
RoR::InputEngine::ProcessKeyPress
void ProcessKeyPress(const OIS::KeyEvent &arg)
Definition: InputEngine.cpp:675
Log
quaternion Log() const
RoR::CVar::setStr
void setStr(std::string const &str)
Definition: CVar.h:83
ROR_VERSION_STRING_SHORT
const char *const ROR_VERSION_STRING_SHORT
RoR::FileExists
bool FileExists(const char *path)
Path must be UTF-8 encoded.
Definition: PlatformUtils.cpp:163
RoR::InputEngine::SetKeyboardListener
void SetKeyboardListener(OIS::KeyListener *obj)
Definition: InputEngine.cpp:645