editor set mouse visibility

This commit is contained in:
Sri Sham Haran 2023-03-04 10:27:51 +08:00
parent 90dd589430
commit fff2c73994
2 changed files with 5 additions and 1 deletions

View File

@ -618,6 +618,7 @@ namespace SHADE
} }
else if (editorState == State::PAUSE) else if (editorState == State::PAUSE)
{ {
SHWindow::SetMouseVisible(prevMouseVisibility);
editorState = State::PLAY; editorState = State::PLAY;
} }
} }
@ -626,11 +627,13 @@ namespace SHADE
{ {
if (editorState == State::PAUSE) if (editorState == State::PAUSE)
return; return;
prevMouseVisibility = SHWindow::GetMouseVisible();
const SHEditorStateChangeEvent STATE_CHANGE_EVENT const SHEditorStateChangeEvent STATE_CHANGE_EVENT
{ {
.previousState = editorState .previousState = editorState
}; };
editorState = State::PAUSE; editorState = State::PAUSE;
SHWindow::SetMouseVisible(true);
SHEventManager::BroadcastEvent<SHEditorStateChangeEvent>(STATE_CHANGE_EVENT, SH_EDITOR_ON_PAUSE_EVENT); SHEventManager::BroadcastEvent<SHEditorStateChangeEvent>(STATE_CHANGE_EVENT, SH_EDITOR_ON_PAUSE_EVENT);
} }
@ -643,6 +646,7 @@ namespace SHADE
.previousState = editorState .previousState = editorState
}; };
editorState = SHEditor::State::STOP; editorState = SHEditor::State::STOP;
SHWindow::SetMouseVisible(true);
SHCommandManager::SwapStacks(); SHCommandManager::SwapStacks();
SHEventManager::BroadcastEvent<SHEditorStateChangeEvent>(STATE_CHANGE_EVENT, SH_EDITOR_ON_STOP_EVENT); SHEventManager::BroadcastEvent<SHEditorStateChangeEvent>(STATE_CHANGE_EVENT, SH_EDITOR_ON_STOP_EVENT);

View File

@ -154,7 +154,7 @@ namespace SHADE
SHEventHandle onEditorStateChanged(SHEventPtr eventPtr); SHEventHandle onEditorStateChanged(SHEventPtr eventPtr);
bool isUnsavedChangesPromptOpen = false; bool isUnsavedChangesPromptOpen = false;
bool prevMouseVisibility = true;
static constexpr std::string_view sceneNamePromptName = "Save scene as..."; static constexpr std::string_view sceneNamePromptName = "Save scene as...";
static constexpr std::string_view unsavedChangesPromptName = "Unsaved Changes"; static constexpr std::string_view unsavedChangesPromptName = "Unsaved Changes";