From 3348f584dadcc33a7caaeb9b6711f86e97055185 Mon Sep 17 00:00:00 2001 From: shibbo Date: Tue, 7 Nov 2023 00:33:15 -0500 Subject: [PATCH] Make the Add Actor window closable incase the user wishes to no longer add an actor --- Fushigi/ui/widgets/CourseScene.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Fushigi/ui/widgets/CourseScene.cs b/Fushigi/ui/widgets/CourseScene.cs index 3fe215ee..5291816b 100644 --- a/Fushigi/ui/widgets/CourseScene.cs +++ b/Fushigi/ui/widgets/CourseScene.cs @@ -206,7 +206,8 @@ public void Save() private void SelectActor() { - bool status = ImGui.Begin("Add Actor"); + bool button = true; + bool status = ImGui.Begin("Add Actor", ref button); ImGui.BeginListBox("Select the actor you want to add.", ImGui.GetContentRegionAvail()); @@ -224,6 +225,17 @@ private void SelectActor() ImGui.EndListBox(); + if (ImGui.IsKeyDown(ImGuiKey.Escape)) + { + button = false; + } + + if (!button) + { + activeViewport.mEditorState = LevelViewport.EditorState.Selecting; + mShowAddActor = false; + } + if (status) { ImGui.End();