diff --git a/RecrownedAthenaeum/UI/Modular/UIModule.cs b/RecrownedAthenaeum/UI/Modular/UIModule.cs
index 0e75698..b34b108 100644
--- a/RecrownedAthenaeum/UI/Modular/UIModule.cs
+++ b/RecrownedAthenaeum/UI/Modular/UIModule.cs
@@ -13,15 +13,12 @@ namespace RecrownedAthenaeum.UI.Modular
///
public class UIModule : IInputListener
{
- private RectangleRenderer renderer;
- private PrimitiveBatch primitiveBatch;
-
- private bool debug = false;
+ private RectangleRenderer rectangleRenderer;
///
/// Draws rectangle using the bounds of this module.
///
- public bool Debugging { set { if (value) { if (renderer == null) renderer = new RectangleRenderer(primitiveBatch = new PrimitiveBatch()); } else { primitiveBatch.Dispose(); primitiveBatch = null; renderer = null; } } get { return debug; } }
+ 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.
@@ -62,7 +59,7 @@ namespace RecrownedAthenaeum.UI.Modular
/// Batch used to draw.
public virtual void Draw(SpriteBatch batch)
{
- if (Debugging) { renderer.Begin(false); renderer.DrawRectangle(bounds.X, bounds.Y, bounds.Width, bounds.Height, Color.Red); renderer.End(); }
+ if (Debugging) { rectangleRenderer.Draw(bounds.X, bounds.Y, bounds.Width, bounds.Height, Color.Red); }
}
///