milek7/sim branch network code import

This commit is contained in:
tmj-fstate
2020-02-16 03:03:17 +01:00
parent 2ce3091e8f
commit 7a0c89f508
56 changed files with 2609 additions and 426 deletions

View File

@@ -47,22 +47,6 @@ driver_ui::driver_ui() {
bool
driver_ui::on_key_( int const Key, int const Scancode, int const Action, int const Mods ) {
if( Key == GLFW_KEY_ESCAPE ) {
// toggle pause
if( Action != GLFW_PRESS ) { return true; } // recognized, but ignored
if( Global.iPause & 1 ) {
// jeśli pauza startowa
// odpauzowanie, gdy po wczytaniu miało nie startować
Global.iPause ^= 1;
}
else if( ( Global.iMultiplayer & 2 ) == 0 ) {
// w multiplayerze pauza nie ma sensu
Global.iPause ^= 2; // zmiana stanu zapauzowania
}
return true;
}
// if the pause is on ignore block other input
if( m_paused ) { return true; }
@@ -192,12 +176,13 @@ driver_ui::render_() {
auto const popupwidth{ locale::strings[ locale::string::driver_pause_header ].size() * 7 };
if( ImGui::Button( locale::strings[ locale::string::driver_pause_resume ].c_str(), ImVec2( popupwidth, 0 ) ) ) {
ImGui::CloseCurrentPopup();
auto const pausemask { 1 | 2 };
Global.iPause &= ~pausemask;
command_relay commandrelay;
commandrelay.post(user_command::pausetoggle, 0.0, 0.0, GLFW_PRESS, 0);
}
if( ImGui::Button( locale::strings[ locale::string::driver_pause_quit ].c_str(), ImVec2( popupwidth, 0 ) ) ) {
ImGui::CloseCurrentPopup();
glfwSetWindowShouldClose( m_window, 1 );
command_relay commandrelay;
commandrelay.post(user_command::quitsimulation, 0.0, 0.0, GLFW_PRESS, 0);
}
ImGui::EndPopup();
}