# HG changeset patch # User Alys Brooks # Date 2022-02-05 09:35:58 # Node ID 5885087ddbe1630366b9a575b4e907c8d7eab4f6 # Parent 38a54d0f14dc688dcf3c33761413861a66163fe6 Add cancel button. diff --git a/isometric-park-fna/UI/NewGameWindow.cs b/isometric-park-fna/UI/NewGameWindow.cs --- a/isometric-park-fna/UI/NewGameWindow.cs +++ b/isometric-park-fna/UI/NewGameWindow.cs @@ -46,8 +46,6 @@ showModal = true; NewGameWindow.Reset(); - - } public static void Reset() { @@ -197,7 +195,6 @@ ImGui.RadioButton("Medium: Austerity", ref choice, ((int)DifficultyLevel.Medium)); ImGui.RadioButton("Hard: Libertarianism", ref choice, ((int)DifficultyLevel.Hard)); - if (ImGui.Button("Okay")) { @@ -220,13 +217,10 @@ NewGameWindow.Reset(); } - ImGui.End(); - StyleSets.defaultSet.pop(); ImGui.PopFont(); - } } } diff --git a/isometric-park-fna/UI/OptionsWindow.cs b/isometric-park-fna/UI/OptionsWindow.cs --- a/isometric-park-fna/UI/OptionsWindow.cs +++ b/isometric-park-fna/UI/OptionsWindow.cs @@ -16,6 +16,7 @@ { public static bool hadFocus = false; + public static bool newFullscreen; public static Vector2 newResolution; @@ -23,6 +24,14 @@ private static int fontSize = 15; private static ProfanityLevel profanityLevel = default; + + private static bool origFullscreen = OptionsWindow.newFullscreen; + private static Vector2 origResolution = OptionsWindow.newResolution; + + private static string origFontName = OptionsWindow.fontName; + private static int origFontSize = OptionsWindow.fontSize; + private static ProfanityLevel origProfanityLevel = OptionsWindow.profanityLevel; + public static void Initialize(Vector2 resolution, bool fullscreen, ProfanityLevel profanityLevel) { @@ -165,6 +174,13 @@ fontName = OptionsWindow.fontName }); + origFullscreen = OptionsWindow.newFullscreen; + origResolution = OptionsWindow.newResolution; + + origFontName = OptionsWindow.fontName; + origFontSize = OptionsWindow.fontSize; + origProfanityLevel = OptionsWindow.profanityLevel; + } ImGui.SameLine(); if (ImGui.Button("Apply")) @@ -177,8 +193,28 @@ fontSize = OptionsWindow.fontSize, fontName = OptionsWindow.fontName }); + + origFullscreen = OptionsWindow.newFullscreen; + origResolution = OptionsWindow.newResolution; + + origFontName = OptionsWindow.fontName; + origFontSize = OptionsWindow.fontSize; + origProfanityLevel = OptionsWindow.profanityLevel; + } + ImGui.SameLine(); + if (ImGui.Button("Cancel")) { + bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage {Window = Window.Options}); + + OptionsWindow.newFullscreen = origFullscreen; + OptionsWindow.newResolution = origResolution; + + OptionsWindow.fontName = origFontName; + OptionsWindow.fontSize = origFontSize; + OptionsWindow.profanityLevel = origProfanityLevel; + } + ImGui.End();