# HG changeset patch # User Alys Brooks # Date 2021-10-23 05:07:05 # Node ID e5705ba6ec367d269024cd4f282883c24eb31b2e # Parent b8388bb70514a02e554a132d673617a5a9c43274 Reorganize debug window. diff --git a/isometric-park-fna/Engines/Spawners/DialogSpawner.cs b/isometric-park-fna/Engines/Spawners/DialogSpawner.cs --- a/isometric-park-fna/Engines/Spawners/DialogSpawner.cs +++ b/isometric-park-fna/Engines/Spawners/DialogSpawner.cs @@ -102,7 +102,7 @@ AddComponent(newDialog, new VisibilityComponent{ visible = true}); - index = GetSpeakerImageIndex(this.Grammar, this.Random, speaker, 1); + index = GetSpeakerImageIndex(this.Grammar, this.Random, speaker); AddComponent(newDialog, new ImageComponent { ImageIndex = index}); diff --git a/isometric-park-fna/UI/DebugWindow.cs b/isometric-park-fna/UI/DebugWindow.cs --- a/isometric-park-fna/UI/DebugWindow.cs +++ b/isometric-park-fna/UI/DebugWindow.cs @@ -210,79 +210,95 @@ if (show) { ImGui.Begin("Debug", ref show); - ImGui.Text(string.Format("fps: {0:F3}", debugInfo.fps)); - ImGui.Text(string.Format("Draw Time: {0:F3}", debugInfo.drawTime.TotalMilliseconds.ToString())); - ImGui.Text(string.Format("Update Time: {0:F3}", debugInfo.updateTime.TotalMilliseconds.ToString())); - ImGui.Text(string.Format("Tiles Drawn: {0:F}", debugInfo.tilesDrawn)); + + if (ImGui.BeginTabBar("DebugTabs")) + { + if(ImGui.BeginTabItem("Debug")) + { + + ImGui.Text(string.Format("fps: {0:F3}", debugInfo.fps)); + ImGui.Text(string.Format("Draw Time: {0:F3}", debugInfo.drawTime.TotalMilliseconds.ToString())); + ImGui.Text(string.Format("Update Time: {0:F3}", debugInfo.updateTime.TotalMilliseconds.ToString())); + ImGui.Text(string.Format("Tiles Drawn: {0:F}", debugInfo.tilesDrawn)); - ImGui.Text(string.Format("\nCamera Position: {0}", debugInfo.cameraPosition.ToString())); - ImGui.Text(string.Format("\nGrid Position: {0} (has tree: {1})", debugInfo.mouseGrid.ToString(), debugInfo.hasTree)); + ImGui.Text(string.Format("\nCamera Position: {0}", debugInfo.cameraPosition.ToString())); + ImGui.Text(string.Format("\nGrid Position: {0} (has tree: {1})", debugInfo.mouseGrid.ToString(), debugInfo.hasTree)); - ImGui.Text(string.Format("Application average {0:F3} ms/frame ({1:F1} FPS", 1000f / ImGui.GetIO().Framerate, ImGui.GetIO().Framerate)); + ImGui.Text(string.Format("Application average {0:F3} ms/frame ({1:F1} FPS", 1000f / ImGui.GetIO().Framerate, ImGui.GetIO().Framerate)); - if (ImGui.Button("Test Window")) - { - this.show_test_window = !this.show_test_window; - } + if (ImGui.Button("Test Window")) + { + this.show_test_window = !this.show_test_window; + } - if (ImGui.Button("Test Logging")) - { - Logging.Log(LogLevel.Critical, "Test"); - Logging.Log(LogLevel.Error, "Test"); - Logging.Log(LogLevel.Warning, "Test"); - Logging.Log(LogLevel.Info, "Test"); - Logging.Log(LogLevel.Debug, "Test"); - Logging.Log(LogLevel.Trace, "Test"); + if (ImGui.Button("Test Logging")) + { + Logging.Log(LogLevel.Critical, "Test"); + Logging.Log(LogLevel.Error, "Test"); + Logging.Log(LogLevel.Warning, "Test"); + Logging.Log(LogLevel.Info, "Test"); + Logging.Log(LogLevel.Debug, "Test"); + Logging.Log(LogLevel.Trace, "Test"); - Logging.Critical("Test"); - Logging.Error("Test"); - Logging.Warning("Test"); - Logging.Success("Test"); - Logging.Info("Test"); - Logging.Debug("Test"); - Logging.Trace("Test"); + Logging.Critical("Test"); + Logging.Error("Test"); + Logging.Warning("Test"); + Logging.Success("Test"); + Logging.Info("Test"); + Logging.Debug("Test"); + Logging.Trace("Test"); + // var t = (testa: 1, testb: 2); + //Logging.Log(LogLevel.Critical, "Test", t); + Logging.Log(LogLevel.Critical, "test", new{test=9.0f}); + //Logging.Log(LogLevel.Critical, "{0}", 0, null, "", 9.0f); - // var t = (testa: 1, testb: 2); - //Logging.Log(LogLevel.Critical, "Test", t); - Logging.Log(LogLevel.Critical, "test", new{test=9.0f}); - //Logging.Log(LogLevel.Critical, "{0}", 0, null, "", 9.0f); + Logging.Spy(new {debugInfo.cameraPosition, debugInfo.updateTime, test = 9.0f /2}); - Logging.Spy(new {debugInfo.cameraPosition, debugInfo.updateTime, test = 9.0f /2}); + } - } - - if (ImGui.BeginCombo("Log Level", Logging.minimumConsoleLevel.ToString())) - { - foreach(LogLevel level in LogLevel.GetValues(typeof(LogLevel))) - { - if(ImGui.Selectable(level.ToString())) - { - Logging.minimumConsoleLevel = level; - } - } - ImGui.EndCombo(); - } + if (ImGui.BeginCombo("Log Level", Logging.minimumConsoleLevel.ToString())) + { + foreach(LogLevel level in LogLevel.GetValues(typeof(LogLevel))) + { + if(ImGui.Selectable(level.ToString())) + { + Logging.minimumConsoleLevel = level; + } + } + ImGui.EndCombo(); + } - if (debugInfo.pastFps.Length >= 1) - { - ImGui.PlotLines("Frame Rate", ref debugInfo.pastFps[0], debugInfo.pastFps.Length); - } - + if (debugInfo.pastFps.Length >= 1) + { + ImGui.PlotLines("Frame Rate", ref debugInfo.pastFps[0], debugInfo.pastFps.Length); + } + ImGui.EndTabItem(); + } + if(ImGui.BeginTabItem("Additional Info")) + { + foreach (string k in additionalInfo.Keys) + { + ImGui.Text(string.Format("{0}: {1}", k, additionalInfo[k])); + } - foreach (string k in additionalInfo.Keys) - { - ImGui.Text(string.Format("{0}: {1}", k, additionalInfo[k])); - } + ImGui.EndTabItem(); + } + + if(ImGui.BeginTabItem("Texture Samples")) + { - ImGui.Text("Texture sample"); - ImGui.Image(_imGuiTexture, new Num.Vector2(250, 200), map.GetSourceUVStart(1), map.GetSourceUVEnd(1), Num.Vector4.One, Num.Vector4.One); // Here, the previously loaded texture is used - ImGui.Image(_imGuiTexture, new Num.Vector2(250, 200), map.GetSourceUVStart(4), map.GetSourceUVEnd(4), Num.Vector4.One, Num.Vector4.One); // Here, the previously loaded texture is used + ImGui.Text("Texture sample"); + ImGui.Image(_imGuiTexture, new Num.Vector2(250, 200), map.GetSourceUVStart(1), map.GetSourceUVEnd(1), Num.Vector4.One, Num.Vector4.One); // Here, the previously loaded texture is used + ImGui.Image(_imGuiTexture, new Num.Vector2(250, 200), map.GetSourceUVStart(4), map.GetSourceUVEnd(4), Num.Vector4.One, Num.Vector4.One); // Here, the previously loaded texture is used - ImGui.End(); + ImGui.EndTabItem(); + } + ImGui.EndTabBar(); + ImGui.End(); } if (this.show_test_window) @@ -290,7 +306,9 @@ ImGui.SetNextWindowPos(new Num.Vector2(650, 20), ImGuiCond.FirstUseEver); ImGui.ShowDemoWindow(ref show_test_window); } + } + } } } diff --git a/isometric-park-fna/UI/Dialog.cs b/isometric-park-fna/UI/Dialog.cs --- a/isometric-park-fna/UI/Dialog.cs +++ b/isometric-park-fna/UI/Dialog.cs @@ -157,6 +157,9 @@ ImGui.Columns(2); ImGui.SetColumnWidth(0, 120); + var metadata = DialogInterface.map.Metadata[imageIndex]; + String Tooltip = String.Format("{0}\n\nSource: {1}", metadata.Description, metadata.Source); + Widgets.MapImageTooltip(DialogInterface.map, new Num.Vector2(111, 148), imageIndex, DialogInterface.map.Metadata[imageIndex].Description); ImGui.NextColumn();