Many refactors and minor changes. idk.
This commit is contained in:
@@ -24,12 +24,12 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
|
||||
/// <summary>
|
||||
/// Scale of of the X axis.
|
||||
/// </summary>
|
||||
public float ScaleX { get { return (float)situation.Width / texture.Width; } set { situation.Width = (int)(texture.Width * value); } }
|
||||
public float ScaleX { get { return (float)Width / texture.Width; } set { Width = (int)(texture.Width * value); } }
|
||||
|
||||
/// <summary>
|
||||
/// Scale of the Y axis.
|
||||
/// </summary>
|
||||
public float ScaleY { get { return (float)situation.Height / texture.Height; } set { situation.Height = (int)(texture.Height * value); } }
|
||||
public float ScaleY { get { return (float)Height / texture.Height; } set { Height = (int)(texture.Height * value); } }
|
||||
|
||||
/// <summary>
|
||||
/// Sets scale of X and Y.
|
||||
@@ -43,7 +43,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
|
||||
public Image(Texture2D texture)
|
||||
{
|
||||
this.texture = texture ?? throw new ArgumentException("Image requires a texture.");
|
||||
situation = texture.Bounds;
|
||||
SetPositionAndDimensions(texture.Bounds);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -52,7 +52,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
|
||||
/// <param name="batch">The batch to use.</param>
|
||||
public override void Draw(ConsistentSpriteBatch batch)
|
||||
{
|
||||
batch.Draw(texture, situation, null, color, rotation, origin, SpriteEffects.None, 0f);
|
||||
batch.Draw(texture, new Rectangle(X, Y, Width, Height), null, color, rotation, origin, SpriteEffects.None, 0f);
|
||||
base.Draw(batch);
|
||||
}
|
||||
|
||||
@@ -69,8 +69,17 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
|
||||
this.color = color;
|
||||
this.rotation = rotation;
|
||||
this.origin = origin;
|
||||
situation = destination;
|
||||
SetPositionAndDimensions(destination);
|
||||
Draw(spriteBatch);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Center's the origin to the middle of the dimensions of the texture.
|
||||
/// </summary>
|
||||
public override void CenterOrigin()
|
||||
{
|
||||
origin.X = texture.Bounds.Width / 2f;
|
||||
origin.Y = texture.Bounds.Height / 2f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user