diff --git a/Content/Scenes/MainScene.scene b/Content/Scenes/MainScene.scene index 8e759c2..e70e40c 100644 --- a/Content/Scenes/MainScene.scene +++ b/Content/Scenes/MainScene.scene @@ -33,8 +33,8 @@ "V": { "Order": -999999999, "Size": { - "X": 1456.0, - "Y": 810.0 + "X": 829.0, + "Y": 450.0 } } }, @@ -43,6 +43,7 @@ "TypeName": "Cabrito.ConsoleScript", "ParentID": "a092422548695989fdb8eeb8bc89eacb", "V": { + "ConsoleHeight": 0.635, "ConsoleFont": "43f32bec443158643f53699f07b2e09c", "BackgroundColor": { "R": 0.0, @@ -59,13 +60,7 @@ "PrefabObjectID": "87a5405b4a75c2e317c0e99c737ed20c", "ParentID": "0733cc9b40d3d05366be64bbd9b59e21", "Name": "PlayerPrefab", - "Transform": { - "Translation": { - "X": -1112.9998779296876, - "Y": 92.40696716308594, - "Z": 1358.571044921875 - } - } + "Transform": {} }, { "ID": "15f3be084b5f8de5ef4332b0aeb2a994", @@ -101,8 +96,8 @@ }, "V": { "Size": { - "X": 1456.0, - "Y": 810.0 + "X": 829.0, + "Y": 450.0 } } }, @@ -122,13 +117,13 @@ "Transform": { "Translation": { "X": 0.0, - "Y": 730.0, + "Y": 370.0, "Z": 0.0 } }, "Control": "FlaxEngine.GUI.Label", "Data": { - "Text": "FPS: 120\nrFPS: 120\nCon: NaNms\nDirectX11\nGC memory: 9.143608MB", + "Text": "FPS: -2147483648\nrFPS: -2147483648\nCon: 0ms\nDirectX11\nGC memory: 19.46077MB", "TextColor": { "R": 1.0, "G": 1.0, @@ -174,9 +169,9 @@ }, "Offsets": { "Left": 0.0, - "Right": 143.0, + "Right": 151.999985, "Top": -80.0, - "Bottom": 80.0 + "Bottom": 78.0 }, "Scale": { "X": 1.0, diff --git a/Source/Game/Cabrito/Console/ConsoleContentTextBox.cs b/Source/Game/Cabrito/Console/ConsoleContentTextBox.cs index de1e71a..45550ae 100644 --- a/Source/Game/Cabrito/Console/ConsoleContentTextBox.cs +++ b/Source/Game/Cabrito/Console/ConsoleContentTextBox.cs @@ -68,7 +68,7 @@ namespace Cabrito if (font == null) return (int)Height; - return (int)Mathf.Round(LineSpacing * font.Height * Scale.Y); + return (int)Mathf.Round(LineSpacing * (font.Height / Platform.DpiScale) * Scale.Y); } struct LineInfo @@ -89,7 +89,7 @@ namespace Cabrito float fontWidth = (int)font.MeasureText("a").X; // hacky, but works for fixed-size fonts... int lineMaxChars = (int)(Width / fontWidth); - int lineMaxLines = (int)(Height / font.Height); + int lineMaxLines = (int)(Height / (font.Height / Platform.DpiScale)); // number of fully visible lines int numLines = 0; int lineIndex = lines.Count - 1; List lineInfos = new List(lineMaxLines); @@ -196,7 +196,8 @@ namespace Cabrito // Make sure lengthy lines are split CalculateVisibleLines(lines, out int startLine, out int lastLine, out LineInfo[] wrappedLines); - float lineHeight = font.Height; + + float lineHeight = font.Height / Platform.DpiScale; float accumHeight = wrappedLines.Length * lineHeight; int selectionLeftLine = selectionStartLine; @@ -351,10 +352,11 @@ namespace Cabrito CalculateVisibleLines(lines, out int startLine, out int lastLine, out LineInfo[] wrappedLines); TextLayoutOptions layout = _layout; - float lineHeight = font.Height; + float lineHeightNormalized = font.Height; + float lineHeight = lineHeightNormalized / Platform.DpiScale; float visibleHeight = wrappedLines.Length * lineHeight; - float top = layout.Bounds.Bottom - visibleHeight; - int lineMaxLines = (int)(Height / font.Height); + float top = (layout.Bounds.Bottom - visibleHeight) / Platform.DpiScale; // UI coordinate space remains normalized + int lineMaxLines = (int)(Height / lineHeight); int hiddenLines = 0; if (wrappedLines.Length > lineMaxLines) @@ -362,21 +364,23 @@ namespace Cabrito //if (top < layout.Bounds.Top) // hiddenLines = (int)Math.Ceiling((layout.Bounds.Top - top) / (float)lineHeight); - int hitWrappedLine = (int)((location.Y - top) / lineHeight) + hiddenLines; + int hitWrappedLine = (int)((location.Y - top) / lineHeight); //+ hiddenLines; if (hitWrappedLine < 0 || hitWrappedLine >= wrappedLines.Length) return false; hitLine = wrappedLines[hitWrappedLine].lineIndex; string line = lines.ElementAt(hitLine); - layout.Bounds.Y = top + ((hitWrappedLine) * lineHeight) + 22.5f; - layout.Bounds.Height = top + visibleHeight; + layout.Bounds.Y = top + ((hitWrappedLine) * lineHeight); + layout.Bounds.Height = top + 9999;//(visibleHeight / Platform.DpiScale); /*if (layout.Bounds.Y < 0) { layout.Bounds.Y = 1; }*/ hitChar = font.HitTestText(line, location, ref layout); + + FlaxEngine.Debug.Log(string.Format("hit line {0}/{1}, max lines {2}", hitWrappedLine, wrappedLines.Length, lineMaxLines)); return true; } diff --git a/Source/Game/Cabrito/Console/ConsoleScript.cs b/Source/Game/Cabrito/Console/ConsoleScript.cs index b12fc57..32a360b 100644 --- a/Source/Game/Cabrito/Console/ConsoleScript.cs +++ b/Source/Game/Cabrito/Console/ConsoleScript.cs @@ -231,12 +231,12 @@ namespace Cabrito private void OnSendLog(LogType level, string msg, FlaxEngine.Object obj, string stackTrace) { - Console.Print("[DEBUGs] " + msg); + //Console.Print("[DEBUG] " + msg); } private void OnSendExceptionLog(Exception exception, FlaxEngine.Object obj) { - Console.Print("[EXCEP] " + exception.Message); + //Console.Print("[EXCEP] " + exception.Message); } public override void OnDestroy()