From 3424cda24b443584207fe3cab088f5fc5cd16811 Mon Sep 17 00:00:00 2001 From: JacobTech Date: Thu, 5 Jan 2023 14:33:52 -0500 Subject: [PATCH] Removed Label Jitter fixed #1 --- GraphicsManager/GraphicsManager.csproj | 2 +- GraphicsManager/Objects/Label.cs | 5 +---- GraphicsManager/Window.cs | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/GraphicsManager/GraphicsManager.csproj b/GraphicsManager/GraphicsManager.csproj index 09ded1c..2a12cfe 100644 --- a/GraphicsManager/GraphicsManager.csproj +++ b/GraphicsManager/GraphicsManager.csproj @@ -10,7 +10,7 @@ False https://git.jacobtech.com/JacobTech.com/GraphicsManager git - 1.0.0-alpha99999999996 + 1.0.0-alpha999999999992 diff --git a/GraphicsManager/Objects/Label.cs b/GraphicsManager/Objects/Label.cs index 422d6e7..8dda3ba 100755 --- a/GraphicsManager/Objects/Label.cs +++ b/GraphicsManager/Objects/Label.cs @@ -95,7 +95,6 @@ public class Label : IRenderObject public Color4 Color { get; set; } = new Color4(255, 255, 255, 255); public Vector2i Distance { get; private set; } private Vector2i loc_ = new(); - private Vector2i locc_ = new(); public Vector2i Location { get @@ -106,8 +105,6 @@ public class Label : IRenderObject { loc_ = value; if (Window is null || Parent is null) return; - Console.WriteLine(value.X); - locc_ = new((int)Window.FloatToInt(Parent.IntToFloat(value.X)), (int)Window.FloatToInt(Parent.IntToFloat(value.Y + (int)Font.PixelHeight, true), true)); if (Window.CanControleUpdate && Loaded) Parent!.TryDraw(); } } @@ -134,7 +131,7 @@ public class Label : IRenderObject float angle_rad = (float)Math.Atan2(DIR.Y, DIR.X); Matrix4 rotateM = Matrix4.CreateRotationZ(angle_rad); - Matrix4 transOriginM = Matrix4.CreateTranslation(new Vector3(locc_.X, locc_.Y, 0f)); + Matrix4 transOriginM = Matrix4.CreateTranslation(new Vector3(loc_.X + Window.FloatToInt(Parent!.IntToFloat(0)), loc_.Y + Font.PixelHeight + Window.FloatToInt(Parent!.IntToFloat(0, true), true), 0f)); float char_x = 0.0f; diff --git a/GraphicsManager/Window.cs b/GraphicsManager/Window.cs index 5dd5b75..6f15c74 100755 --- a/GraphicsManager/Window.cs +++ b/GraphicsManager/Window.cs @@ -65,7 +65,7 @@ public class Window : NativeWindow , IParent public float IntToFloat(float p, bool Invert = false) { - double Size = (Invert ? this.Size.Y : this.Size.X); + float Size = (Invert ? this.Size.Y : this.Size.X); double half = Math.Round((double)Size / (double)2, 1); double Per = Math.Round((double)1 / half, 15); if (p == half) return 0.0f; @@ -83,7 +83,7 @@ public class Window : NativeWindow , IParent public float FloatToInt(float p, bool Invert = false) { - double Size = (Invert ? this.Size.Y : this.Size.X); + float Size = (Invert ? this.Size.Y : this.Size.X); double half = Math.Round((double)Size / (double)2, 15); if (p == 0) return (int)half; if (Invert)