diff --git a/OpenKh.Tools.BbsMapStudio/OpenKh.Tools.BbsMapStudio.csproj b/OpenKh.Tools.BbsMapStudio/OpenKh.Tools.BbsMapStudio.csproj index 1a0e4a5fd..5cb0d0614 100644 --- a/OpenKh.Tools.BbsMapStudio/OpenKh.Tools.BbsMapStudio.csproj +++ b/OpenKh.Tools.BbsMapStudio/OpenKh.Tools.BbsMapStudio.csproj @@ -23,7 +23,7 @@ - + diff --git a/OpenKh.Tools.Common.CustomImGui/ImGuiEx.cs b/OpenKh.Tools.Common.CustomImGui/ImGuiEx.cs index 169cfc6e0..28944ac85 100644 --- a/OpenKh.Tools.Common.CustomImGui/ImGuiEx.cs +++ b/OpenKh.Tools.Common.CustomImGui/ImGuiEx.cs @@ -297,7 +297,7 @@ public static void ForMenuCheck(string name, Func getter, Action set public static bool ForChild(string name, float w, float h, bool border, Action action) { - var ret = ImGui.BeginChild(name, new Vector2(w, h), border); + var ret = ImGui.BeginChild(name, new Vector2(w, h), border ? ImGuiChildFlags.Border : ImGuiChildFlags.None); action(); ImGui.EndChild(); diff --git a/OpenKh.Tools.Common.CustomImGui/MonoGameImGui.cs b/OpenKh.Tools.Common.CustomImGui/MonoGameImGui.cs index 4354feeb6..e4266bf9d 100644 --- a/OpenKh.Tools.Common.CustomImGui/MonoGameImGui.cs +++ b/OpenKh.Tools.Common.CustomImGui/MonoGameImGui.cs @@ -62,7 +62,7 @@ static DrawVertDeclaration() // Input private int _scrollWheelValue; - private List _keys = new List(); + private List<(ImGuiKey ImGuiKey, Keys XnaKey)> _keys = new List<(ImGuiKey ImGuiKey, Keys XnaKey)>(); public bool ImGuiWantCaptureKeyboard => ImGui.GetIO().WantCaptureKeyboard; public bool ImGuiWantCaptureMouse => ImGui.GetIO().WantCaptureMouse; @@ -102,6 +102,26 @@ public MonoGameImGui(Game game) }; }; + _keys.Add((ImGuiKey.Tab, Keys.Tab)); + _keys.Add((ImGuiKey.LeftArrow, Keys.Left)); + _keys.Add((ImGuiKey.RightArrow, Keys.Right)); + _keys.Add((ImGuiKey.UpArrow, Keys.Up)); + _keys.Add((ImGuiKey.DownArrow, Keys.Down)); + _keys.Add((ImGuiKey.PageUp, Keys.PageUp)); + _keys.Add((ImGuiKey.PageDown, Keys.PageDown)); + _keys.Add((ImGuiKey.Home, Keys.Home)); + _keys.Add((ImGuiKey.End, Keys.End)); + _keys.Add((ImGuiKey.Delete, Keys.Delete)); + _keys.Add((ImGuiKey.Backspace, Keys.Back)); + _keys.Add((ImGuiKey.Enter, Keys.Enter)); + _keys.Add((ImGuiKey.Escape, Keys.Escape)); + _keys.Add((ImGuiKey.A, Keys.A)); + _keys.Add((ImGuiKey.C, Keys.C)); + _keys.Add((ImGuiKey.V, Keys.V)); + _keys.Add((ImGuiKey.X, Keys.X)); + _keys.Add((ImGuiKey.Y, Keys.Y)); + _keys.Add((ImGuiKey.Z, Keys.Z)); + SetupInput(); } @@ -197,26 +217,6 @@ protected virtual void SetupInput() { var io = ImGui.GetIO(); - _keys.Add(io.KeyMap[(int)ImGuiKey.Tab] = (int)Keys.Tab); - _keys.Add(io.KeyMap[(int)ImGuiKey.LeftArrow] = (int)Keys.Left); - _keys.Add(io.KeyMap[(int)ImGuiKey.RightArrow] = (int)Keys.Right); - _keys.Add(io.KeyMap[(int)ImGuiKey.UpArrow] = (int)Keys.Up); - _keys.Add(io.KeyMap[(int)ImGuiKey.DownArrow] = (int)Keys.Down); - _keys.Add(io.KeyMap[(int)ImGuiKey.PageUp] = (int)Keys.PageUp); - _keys.Add(io.KeyMap[(int)ImGuiKey.PageDown] = (int)Keys.PageDown); - _keys.Add(io.KeyMap[(int)ImGuiKey.Home] = (int)Keys.Home); - _keys.Add(io.KeyMap[(int)ImGuiKey.End] = (int)Keys.End); - _keys.Add(io.KeyMap[(int)ImGuiKey.Delete] = (int)Keys.Delete); - _keys.Add(io.KeyMap[(int)ImGuiKey.Backspace] = (int)Keys.Back); - _keys.Add(io.KeyMap[(int)ImGuiKey.Enter] = (int)Keys.Enter); - _keys.Add(io.KeyMap[(int)ImGuiKey.Escape] = (int)Keys.Escape); - _keys.Add(io.KeyMap[(int)ImGuiKey.A] = (int)Keys.A); - _keys.Add(io.KeyMap[(int)ImGuiKey.C] = (int)Keys.C); - _keys.Add(io.KeyMap[(int)ImGuiKey.V] = (int)Keys.V); - _keys.Add(io.KeyMap[(int)ImGuiKey.X] = (int)Keys.X); - _keys.Add(io.KeyMap[(int)ImGuiKey.Y] = (int)Keys.Y); - _keys.Add(io.KeyMap[(int)ImGuiKey.Z] = (int)Keys.Z); - // MonoGame-specific ////////////////////// _game.Window.TextInput += (s, a) => { @@ -276,9 +276,9 @@ protected virtual void UpdateInput() var mouse = Mouse.GetState(); var keyboard = Keyboard.GetState(); - for (int i = 0; i < _keys.Count; i++) + foreach (var pair in _keys) { - io.KeysDown[_keys[i]] = keyboard.IsKeyDown((Keys)_keys[i]); + io.AddKeyEvent(pair.ImGuiKey, keyboard.IsKeyDown(pair.XnaKey)); } io.KeyShift = keyboard.IsKeyDown(Keys.LeftShift) || keyboard.IsKeyDown(Keys.RightShift); diff --git a/OpenKh.Tools.Common.CustomImGui/OpenKh.Tools.Common.CustomImGui.csproj b/OpenKh.Tools.Common.CustomImGui/OpenKh.Tools.Common.CustomImGui.csproj index 0d41a3ba1..72d1262a8 100644 --- a/OpenKh.Tools.Common.CustomImGui/OpenKh.Tools.Common.CustomImGui.csproj +++ b/OpenKh.Tools.Common.CustomImGui/OpenKh.Tools.Common.CustomImGui.csproj @@ -7,7 +7,7 @@ - + diff --git a/OpenKh.Tools.Kh2MapStudio/OpenKh.Tools.Kh2MapStudio.csproj b/OpenKh.Tools.Kh2MapStudio/OpenKh.Tools.Kh2MapStudio.csproj index e4b656c6d..afaae340a 100644 --- a/OpenKh.Tools.Kh2MapStudio/OpenKh.Tools.Kh2MapStudio.csproj +++ b/OpenKh.Tools.Kh2MapStudio/OpenKh.Tools.Kh2MapStudio.csproj @@ -23,7 +23,7 @@ - + diff --git a/OpenKh.Tools.Kh2MsetMotionEditor/OpenKh.Tools.Kh2MsetMotionEditor.csproj b/OpenKh.Tools.Kh2MsetMotionEditor/OpenKh.Tools.Kh2MsetMotionEditor.csproj index d1e9ef9e9..08211f6c5 100644 --- a/OpenKh.Tools.Kh2MsetMotionEditor/OpenKh.Tools.Kh2MsetMotionEditor.csproj +++ b/OpenKh.Tools.Kh2MsetMotionEditor/OpenKh.Tools.Kh2MsetMotionEditor.csproj @@ -24,7 +24,7 @@ - + diff --git a/OpenKh.Tools.LayoutEditor/Controls/ImSequencer.cs b/OpenKh.Tools.LayoutEditor/Controls/ImSequencer.cs index b82de321f..f06175d63 100644 --- a/OpenKh.Tools.LayoutEditor/Controls/ImSequencer.cs +++ b/OpenKh.Tools.LayoutEditor/Controls/ImSequencer.cs @@ -191,7 +191,6 @@ private static void Tooltip(string description) bool isOpen = false; ImGui.Begin("Child Tooltip?", ref isOpen, ImGuiWindowFlags.Tooltip | ImGuiWindowFlags.NoTitleBar | - ImGuiWindowFlags.AlwaysUseWindowPadding | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoResize); ImGui.Text(description); @@ -288,7 +287,7 @@ public static bool Sequencer(SequenceInterface sequence, ref int currentFrame, r Vector2 childFramePos = ImGui.GetCursorScreenPos(); var childFrameSize = new Vector2(canvas_size.X, canvas_size.Y - 8f - headerSize.Y - (hasScrollBar ? scrollBarSize.Y : 0)); ImGui.PushStyleColor(ImGuiCol.FrameBg, 0); - ImGui.BeginChildFrame(889, childFrameSize); + ImGui.BeginChild(889, childFrameSize, ImGuiChildFlags.FrameStyle); sequence.focused = ImGui.IsWindowFocused(); ImGui.InvisibleButton("contentBar", new Vector2(canvas_size.X, (float)(controlHeight))); Vector2 contentMin = ImGui.GetItemRectMin(); @@ -709,7 +708,7 @@ public static bool Sequencer(SequenceInterface sequence, ref int currentFrame, r } // - ImGui.EndChildFrame(); + ImGui.EndChild(); ImGui.PopStyleColor(); if (hasScrollBar) { diff --git a/OpenKh.Tools.LayoutEditor/OpenKh.Tools.LayoutEditor.csproj b/OpenKh.Tools.LayoutEditor/OpenKh.Tools.LayoutEditor.csproj index a1bd80558..3ec5c7d41 100644 --- a/OpenKh.Tools.LayoutEditor/OpenKh.Tools.LayoutEditor.csproj +++ b/OpenKh.Tools.LayoutEditor/OpenKh.Tools.LayoutEditor.csproj @@ -23,7 +23,7 @@ - +