Modules made more useable by improving or fixing some of the drawing position logic. Variable names refactored as well.
This commit is contained in:
@@ -23,12 +23,12 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
|
||||
/// <summary>
|
||||
/// Scale of of the X axis.
|
||||
/// </summary>
|
||||
public float ScaleX { get { return (float)bounds.Width / texture.Width; } set { bounds.Width = (int)(texture.Width * value); } }
|
||||
public float ScaleX { get { return (float)situation.Width / texture.Width; } set { situation.Width = (int)(texture.Width * value); } }
|
||||
|
||||
/// <summary>
|
||||
/// Scale of the Y axis.
|
||||
/// </summary>
|
||||
public float ScaleY { get { return (float)bounds.Height / texture.Height; } set { bounds.Height = (int)(texture.Height * value); } }
|
||||
public float ScaleY { get { return (float)situation.Height / texture.Height; } set { situation.Height = (int)(texture.Height * value); } }
|
||||
|
||||
/// <summary>
|
||||
/// Sets scale of X and Y.
|
||||
@@ -42,7 +42,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
|
||||
public Image(Texture2D texture)
|
||||
{
|
||||
this.texture = texture ?? throw new ArgumentException("Image requires a texture.");
|
||||
bounds = texture.Bounds;
|
||||
situation = texture.Bounds;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -51,7 +51,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
|
||||
/// <param name="batch">The batch to use.</param>
|
||||
public override void Draw(SpriteBatch batch)
|
||||
{
|
||||
batch.Draw(texture, bounds, null, color, rotation, origin, SpriteEffects.None, 0f);
|
||||
batch.Draw(texture, situation, null, color, rotation, origin, SpriteEffects.None, 0f);
|
||||
base.Draw(batch);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
|
||||
this.color = color;
|
||||
this.rotation = rotation;
|
||||
this.origin = origin;
|
||||
bounds = destination;
|
||||
situation = destination;
|
||||
Draw(spriteBatch);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user