mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 00:49:19 +02:00
switch debugtoggle and pausetoggle to release, and logic fixes
This commit is contained in:
@@ -231,21 +231,15 @@ driver_ui::render_() {
|
|||||||
if( ( ImGui::Button( STR_C("Resume"), ImVec2( 150, 0 ) ) )
|
if( ( ImGui::Button( STR_C("Resume"), ImVec2( 150, 0 ) ) )
|
||||||
|| ( ImGui::IsKeyReleased( ImGui::GetKeyIndex( ImGuiKey_Escape ) ) ) )
|
|| ( ImGui::IsKeyReleased( ImGui::GetKeyIndex( ImGuiKey_Escape ) ) ) )
|
||||||
{
|
{
|
||||||
m_relay.post(user_command::pausetoggle, 0.0, 0.0, GLFW_PRESS, 0);
|
m_relay.post(user_command::pausetoggle, 0.0, 0.0, GLFW_RELEASE, 0);
|
||||||
}
|
}
|
||||||
if( ImGui::Button( STR_C("Quit"), ImVec2( 150, 0 ) ) ) {
|
if( ImGui::Button( STR_C("Quit"), ImVec2( 150, 0 ) ) ) {
|
||||||
Application.queue_quit(false);
|
Application.queue_quit(false);
|
||||||
}
|
}
|
||||||
if (!m_paused)
|
if (!m_paused)
|
||||||
{
|
|
||||||
m_pause_modal_opened = false;
|
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
} else if (m_paused) {
|
||||||
if (m_paused && !m_pause_modal_opened)
|
|
||||||
{
|
|
||||||
m_pause_modal_opened = true;
|
|
||||||
ImGui::OpenPopup(popupheader);
|
ImGui::OpenPopup(popupheader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ private:
|
|||||||
trainingcard_panel m_trainingcardpanel;
|
trainingcard_panel m_trainingcardpanel;
|
||||||
perfgraph_panel m_perfgraphpanel;
|
perfgraph_panel m_perfgraphpanel;
|
||||||
bool m_paused { false };
|
bool m_paused { false };
|
||||||
bool m_pause_modal_opened { false };
|
|
||||||
|
|
||||||
command_relay m_relay;
|
command_relay m_relay;
|
||||||
ui::vehiclelist_panel m_vehiclelist { ui::vehiclelist_panel(*this) };
|
ui::vehiclelist_panel m_vehiclelist { ui::vehiclelist_panel(*this) };
|
||||||
|
|||||||
@@ -634,7 +634,11 @@ debug_panel::render() {
|
|||||||
#endif
|
#endif
|
||||||
// toggles
|
// toggles
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::Checkbox( "Debug Mode", &DebugModeFlag );
|
bool flag = DebugModeFlag;
|
||||||
|
if (ImGui::Checkbox("Debug Mode", &flag)) {
|
||||||
|
command_relay relay;
|
||||||
|
relay.post(user_command::debugtoggle, 0.0, 0.0, GLFW_RELEASE, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|||||||
@@ -197,9 +197,7 @@ void state_manager::process_commands() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commanddata.action == GLFW_RELEASE)
|
if (commanddata.action == GLFW_RELEASE) {
|
||||||
continue;
|
|
||||||
|
|
||||||
if (commanddata.command == user_command::debugtoggle)
|
if (commanddata.command == user_command::debugtoggle)
|
||||||
DebugModeFlag = !DebugModeFlag;
|
DebugModeFlag = !DebugModeFlag;
|
||||||
|
|
||||||
@@ -213,6 +211,8 @@ void state_manager::process_commands() {
|
|||||||
Global.iPause ^= 2; // zmiana stanu zapauzowania
|
Global.iPause ^= 2; // zmiana stanu zapauzowania
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (commanddata.command == user_command::focuspauseset) {
|
if (commanddata.command == user_command::focuspauseset) {
|
||||||
if( commanddata.param1 == 1.0 )
|
if( commanddata.param1 == 1.0 )
|
||||||
|
|||||||
@@ -465,7 +465,11 @@ void ui_layer::render_menu_contents()
|
|||||||
{
|
{
|
||||||
if (ImGui::BeginMenu(STR_C("General")))
|
if (ImGui::BeginMenu(STR_C("General")))
|
||||||
{
|
{
|
||||||
ImGui::MenuItem(STR_C("Debug mode"), nullptr, &DebugModeFlag);
|
bool flag = DebugModeFlag;
|
||||||
|
if (ImGui::MenuItem(STR_C("Debug mode"), nullptr, &flag)) {
|
||||||
|
command_relay relay;
|
||||||
|
relay.post(user_command::debugtoggle, 0.0, 0.0, GLFW_RELEASE, 0);
|
||||||
|
}
|
||||||
ImGui::MenuItem(STR_C("Quit"), "F10", &m_quit_active);
|
ImGui::MenuItem(STR_C("Quit"), "F10", &m_quit_active);
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user