diff --git a/CentrED/Renderer/UIRenderer.cs b/CentrED/Renderer/UIRenderer.cs index 2dd9ef5..805a3eb 100644 --- a/CentrED/Renderer/UIRenderer.cs +++ b/CentrED/Renderer/UIRenderer.cs @@ -227,7 +227,7 @@ private unsafe void UpdateBuffers(ImDrawDataPtr drawData) for (int n = 0; n < drawData.CmdListsCount; n++) { - ImDrawListPtr cmdList = drawData.CmdListsRange[n]; + ImDrawListPtr cmdList = drawData.CmdLists[n]; fixed (void* vtxDstPtr = &_vertexData[vtxOffset * DrawVertDeclaration.Size]) fixed (void* idxDstPtr = &_indexData[idxOffset * sizeof(ushort)]) @@ -267,7 +267,7 @@ private unsafe void RenderCommandLists(ImDrawDataPtr drawData) for (int n = 0; n < drawData.CmdListsCount; n++) { - ImDrawListPtr cmdList = drawData.CmdListsRange[n]; + ImDrawListPtr cmdList = drawData.CmdLists[n]; for (int cmdi = 0; cmdi < cmdList.CmdBuffer.Size; cmdi++) { diff --git a/CentrED/UI/FilePicker.cs b/CentrED/UI/FilePicker.cs index 5451382..3c69692 100644 --- a/CentrED/UI/FilePicker.cs +++ b/CentrED/UI/FilePicker.cs @@ -64,7 +64,7 @@ public bool Draw() ImGui.Text("Current Folder: " + Path.GetFileName(RootFolder) + CurrentFolder.Replace(RootFolder, "")); bool result = false; - if (ImGui.BeginChildFrame(1, new Num.Vector2(400, 400))) + if (ImGui.BeginChild(1, new Num.Vector2(400, 400), ImGuiChildFlags.FrameStyle)) { var di = new DirectoryInfo(CurrentFolder); if (di.Exists) @@ -105,9 +105,8 @@ public bool Draw() } } } - ImGui.EndChildFrame(); - - + ImGui.EndChild(); + if (ImGui.Button("Cancel")) { result = false; diff --git a/CentrED/UI/Windows/HuesWindow.cs b/CentrED/UI/Windows/HuesWindow.cs index 5c5f8c6..27a6f90 100644 --- a/CentrED/UI/Windows/HuesWindow.cs +++ b/CentrED/UI/Windows/HuesWindow.cs @@ -72,7 +72,7 @@ public override void Draw() FilterHues(); } var huesPosY = ImGui.GetCursorPosY(); - ImGui.BeginChild("Hues", new Vector2(), false, ImGuiWindowFlags.Modal); + ImGui.BeginChild("Hues", new Vector2(), ImGuiChildFlags.None, ImGuiWindowFlags.Modal); if (ImGui.BeginTable("TilesTable", 2) && CEDClient.Initialized) { unsafe diff --git a/CentrED/UI/Windows/MinimapWindow.cs b/CentrED/UI/Windows/MinimapWindow.cs index f52190c..e0c1338 100644 --- a/CentrED/UI/Windows/MinimapWindow.cs +++ b/CentrED/UI/Windows/MinimapWindow.cs @@ -19,6 +19,8 @@ public class MinimapWindow : Window private string _inputFavoriteName = ""; private string _keyToDelete = ""; private string _coordsText = ""; + private bool _showError = true; + private bool _showConfirmation = true; public override void Draw() { if (!Show) return; @@ -27,16 +29,14 @@ public override void Draw() if (CEDGame.MapManager.Client.Initialized) { - ImGui.InputText("Favorite Name", ref _inputFavoriteName, 64); ImGui.SameLine(); - if (ImGui.Button("Add Favorite")) { - if (string.IsNullOrEmpty(_inputFavoriteName) || ProfileManager.ActiveProfile.RadarFavorites.ContainsKey(_inputFavoriteName)) { ImGui.OpenPopup("Error"); + _showError = true; } else { @@ -48,23 +48,16 @@ public override void Draw() ProfileManager.Save(ProfileManager.ActiveProfile); _inputFavoriteName = ""; } - } - - - - if (ImGui.BeginChild("ButtonGroup", new Vector2(RadarMap.Instance.Texture.Width, 100), true)) + + if (ImGui.BeginChild("Favorites", new Vector2(RadarMap.Instance.Texture.Width, 100))) { - - foreach (var (key, value) in ProfileManager.ActiveProfile.RadarFavorites) + foreach (var (name, coords) in ProfileManager.ActiveProfile.RadarFavorites) { - - if (key != ProfileManager.ActiveProfile.RadarFavorites.First().Key) + if (name != ProfileManager.ActiveProfile.RadarFavorites.First().Key) { ImGui.SameLine(); } - - if (ImGui.GetCursorPos().X + 75 >= RadarMap.Instance.Texture.Width) { ImGui.NewLine(); @@ -73,35 +66,27 @@ public override void Draw() var cursorPosition = ImGui.GetCursorPos(); //tooltip for button what shows the key - - - if (ImGui.Button($"{key}", new Vector2(75, 19))) + if (ImGui.Button($"{name}", new Vector2(75, 19))) { - CEDGame.MapManager.Position = new Point(value.X, value.Y); + CEDGame.MapManager.Position = new Point(coords.X, coords.Y); } - UIManager.Tooltip($"{key}\nX:{value.X} Y:{value.Y}"); + UIManager.Tooltip($"{name}\nX:{coords.X} Y:{coords.Y}"); ImGui.SetCursorPos(cursorPosition + new Vector2(ImGui.GetItemRectSize().X, 0)); - - + ImGui.PushStyleColor(ImGuiCol.Button, new Vector4(1, 0, 0, .2f)); ImGui.PushStyleColor(ImGuiCol.ButtonHovered, new Vector4(1, 0, 0, 1)); - if (ImGui.Button($"x##{key}")) + if (ImGui.Button($"x##{name}")) { - - _keyToDelete = key; + _keyToDelete = name; ImGui.OpenPopup("Confirmation"); - - + _showConfirmation = true; } ImGui.PopStyleColor(2); - - } - if (ImGui.BeginPopupModal("Confirmation", ref _show, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoTitleBar)) + if (ImGui.BeginPopupModal("Confirmation", ref _showConfirmation, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoTitleBar)) { ImGui.Text("Are you sure you want to delete this favorite?"); - if (ImGui.Button("Yes")) { if (!string.IsNullOrEmpty(_keyToDelete)) @@ -112,21 +97,17 @@ public override void Draw() } ImGui.CloseCurrentPopup(); } - ImGui.SameLine(); - if (ImGui.Button("No")) { ImGui.CloseCurrentPopup(); } - ImGui.EndPopup(); } ImGui.EndChild(); } - - - if (ImGui.BeginPopupModal("Error", ref _show, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoTitleBar)) + + if (ImGui.BeginPopupModal("Error", ref _showError, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoTitleBar)) { ImGui.TextColored(new Vector4(1.0f, .0f, .0f, 1.0f), "Name already exists or empty value!"); diff --git a/CentrED/UI/Windows/TilesWindow.cs b/CentrED/UI/Windows/TilesWindow.cs index 40b874f..18871d1 100644 --- a/CentrED/UI/Windows/TilesWindow.cs +++ b/CentrED/UI/Windows/TilesWindow.cs @@ -92,7 +92,7 @@ public override void Draw() ImGui.SameLine(); ImGui.Checkbox("Static", ref _staticVisible); - ImGui.BeginChild("Tiles", new Vector2(), false, ImGuiWindowFlags.Modal); + ImGui.BeginChild("Tiles", new Vector2(), ImGuiChildFlags.None, ImGuiWindowFlags.Modal); if (ImGui.IsKeyPressed(ImGuiKey.DownArrow)) { ImGui.SetScrollY(ImGui.GetScrollY() + 10);