16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-19 05:29:17 +02:00
This commit is contained in:
milek7
2019-07-02 01:00:42 +02:00
parent 684ff24087
commit d039207b03
18 changed files with 529 additions and 111 deletions

View File

@@ -12,6 +12,7 @@ http://mozilla.org/MPL/2.0/.
#include "drivermode.h"
#include "editormode.h"
#include "scenarioloadermode.h"
#include "launcher/launchermode.h"
#include "Globals.h"
#include "simulation.h"
@@ -164,6 +165,8 @@ eu07_application::run() {
Timer::subsystem.mainloop_total.start();
glfwPollEvents();
begin_ui_frame();
// -------------------------------------------------------------------
// multiplayer command relaying logic can seem a bit complex
//
@@ -367,6 +370,13 @@ eu07_application::render_ui() {
m_modes[ m_modestack.top() ]->render_ui();
}
void eu07_application::begin_ui_frame() {
if( m_modestack.empty() ) { return; }
m_modes[ m_modestack.top() ]->begin_ui_frame();
}
bool
eu07_application::pop_mode() {
if( m_modestack.empty() ) { return false; }
@@ -761,6 +771,7 @@ eu07_application::init_modes() {
// but doing it in one go at the start saves us some error checking headache down the road
// create all application behaviour modes
m_modes[ mode::launcher ] = std::make_shared<launcher_mode>();
m_modes[ mode::scenarioloader ] = std::make_shared<scenarioloader_mode>();
m_modes[ mode::driver ] = std::make_shared<driver_mode>();
m_modes[ mode::editor ] = std::make_shared<editor_mode>();
@@ -771,7 +782,10 @@ eu07_application::init_modes() {
}
}
// activate the default mode
push_mode( mode::scenarioloader );
if (Global.SceneryFile.empty())
push_mode( mode::launcher );
else
push_mode( mode::scenarioloader );
return 0;
}