From fff2c739943e95e70d81996e01ae475ed27abe10 Mon Sep 17 00:00:00 2001 From: Sri Sham Haran Date: Sat, 4 Mar 2023 10:27:51 +0800 Subject: [PATCH] editor set mouse visibility --- SHADE_Engine/src/Editor/SHEditor.cpp | 4 ++++ SHADE_Engine/src/Editor/SHEditor.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/SHADE_Engine/src/Editor/SHEditor.cpp b/SHADE_Engine/src/Editor/SHEditor.cpp index 6d71f98d..cfdfbbd9 100644 --- a/SHADE_Engine/src/Editor/SHEditor.cpp +++ b/SHADE_Engine/src/Editor/SHEditor.cpp @@ -618,6 +618,7 @@ namespace SHADE } else if (editorState == State::PAUSE) { + SHWindow::SetMouseVisible(prevMouseVisibility); editorState = State::PLAY; } } @@ -626,11 +627,13 @@ namespace SHADE { if (editorState == State::PAUSE) return; + prevMouseVisibility = SHWindow::GetMouseVisible(); const SHEditorStateChangeEvent STATE_CHANGE_EVENT { .previousState = editorState }; editorState = State::PAUSE; + SHWindow::SetMouseVisible(true); SHEventManager::BroadcastEvent(STATE_CHANGE_EVENT, SH_EDITOR_ON_PAUSE_EVENT); } @@ -643,6 +646,7 @@ namespace SHADE .previousState = editorState }; editorState = SHEditor::State::STOP; + SHWindow::SetMouseVisible(true); SHCommandManager::SwapStacks(); SHEventManager::BroadcastEvent(STATE_CHANGE_EVENT, SH_EDITOR_ON_STOP_EVENT); diff --git a/SHADE_Engine/src/Editor/SHEditor.h b/SHADE_Engine/src/Editor/SHEditor.h index 1cbc4f9d..960415fb 100644 --- a/SHADE_Engine/src/Editor/SHEditor.h +++ b/SHADE_Engine/src/Editor/SHEditor.h @@ -154,7 +154,7 @@ namespace SHADE SHEventHandle onEditorStateChanged(SHEventPtr eventPtr); bool isUnsavedChangesPromptOpen = false; - + bool prevMouseVisibility = true; static constexpr std::string_view sceneNamePromptName = "Save scene as..."; static constexpr std::string_view unsavedChangesPromptName = "Unsaved Changes";