From de93e35b0739367e49ffc2c75aeda0f7ce77577a Mon Sep 17 00:00:00 2001 From: Recrown Date: Mon, 11 Feb 2019 23:27:51 -0600 Subject: [PATCH] implemented rectangle renderer changes. --- RecrownedAthenaeum/UI/Modular/UIModule.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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); } } ///