diff --git a/RecrownedAthenaeum/UI/Modular/Modules/Image.cs b/RecrownedAthenaeum/UI/Modular/Modules/Image.cs
index 413ee9f..d473912 100644
--- a/RecrownedAthenaeum/UI/Modular/Modules/Image.cs
+++ b/RecrownedAthenaeum/UI/Modular/Modules/Image.cs
@@ -67,7 +67,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
{
this.color = color;
this.rotation = rotation;
- this.offset = origin;
+ this.origin = origin;
bounds = destination;
Draw(spriteBatch);
}
diff --git a/RecrownedAthenaeum/UI/Modular/UIModule.cs b/RecrownedAthenaeum/UI/Modular/UIModule.cs
index 04ed30e..dba28bf 100644
--- a/RecrownedAthenaeum/UI/Modular/UIModule.cs
+++ b/RecrownedAthenaeum/UI/Modular/UIModule.cs
@@ -21,14 +21,20 @@ namespace RecrownedAthenaeum.UI.Modular
public bool Debugging { set { if (value) { if (rectangleRenderer == null) rectangleRenderer = new RectangleRenderer(); } else { rectangleRenderer?.Dispose(); rectangleRenderer = null; } } get { return rectangleRenderer != null; } }
///
- /// Bounds of this module.
+ /// The bounds before factoring in the origin.
///
public Rectangle bounds;
///
- /// The how much of the entire boundary to offset when drawing.
+ /// Bounds of this module (after factoring in the origin).
///
- public Vector2 offset;
+ public Rectangle ActualBounds
+ {
+ get
+ {
+ return new Rectangle((int)(bounds.X - origin.X), (int)(bounds.Y - origin.Y), bounds.Width, bounds.Height);
+ }
+ }
///
/// Origin of this module.
@@ -68,7 +74,7 @@ namespace RecrownedAthenaeum.UI.Modular
if (Debugging)
{
rectangleRenderer.Begin();
- rectangleRenderer.Draw(bounds.X, bounds.Y, bounds.Width, bounds.Height, Color.Red);
+ rectangleRenderer.Draw(ActualBounds.X, ActualBounds.Y, ActualBounds.Width, ActualBounds.Height, Color.Red);
rectangleRenderer.End();
}
}
@@ -126,8 +132,8 @@ namespace RecrownedAthenaeum.UI.Modular
///
public void CenterOrigin()
{
- offset.X = bounds.Width / 2f;
- offset.Y = bounds.Height / 2f;
+ origin.X = bounds.Width / 2f;
+ origin.Y = bounds.Height / 2f;
}
}
}
diff --git a/RecrownedAthenaeum/UI/Modular/UIModuleGroup.cs b/RecrownedAthenaeum/UI/Modular/UIModuleGroup.cs
index 03d705e..dfaebe5 100644
--- a/RecrownedAthenaeum/UI/Modular/UIModuleGroup.cs
+++ b/RecrownedAthenaeum/UI/Modular/UIModuleGroup.cs
@@ -57,12 +57,13 @@ namespace RecrownedAthenaeum.UI.Modular
scissorBounds = batch.GraphicsDevice.ScissorRectangle;
batch.GraphicsDevice.ScissorRectangle = scissor;
}
+
foreach (UIModule module in modules)
{
int offsetX = module.bounds.X;
int offsetY = module.bounds.Y;
- module.bounds.X = bounds.X + offsetX - (int)module.offset.X;
- module.bounds.Y = bounds.Y + offsetY - (int)module.offset.Y;
+ module.bounds.X = bounds.X + offsetX;
+ module.bounds.Y = bounds.Y + offsetY;
module.Draw(batch);
module.bounds.X = offsetX;
module.bounds.Y = offsetY;