Removed Label Jitter

fixed #1
This commit is contained in:
JacobTech 2023-01-05 14:33:52 -05:00
parent 78a79b4fd7
commit 3424cda24b
3 changed files with 4 additions and 7 deletions

View File

@ -10,7 +10,7 @@
<IncludeSymbols>False</IncludeSymbols>
<RepositoryUrl>https://git.jacobtech.com/JacobTech.com/GraphicsManager</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Version>1.0.0-alpha99999999996</Version>
<Version>1.0.0-alpha999999999992</Version>
</PropertyGroup>
<ItemGroup>

View File

@ -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;

View File

@ -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)