implemented rectangle renderer changes.
This commit is contained in:
parent
4fb9e64f06
commit
de93e35b07
@ -13,15 +13,12 @@ namespace RecrownedAthenaeum.UI.Modular
|
||||
/// </summary>
|
||||
public class UIModule : IInputListener
|
||||
{
|
||||
private RectangleRenderer renderer;
|
||||
private PrimitiveBatch primitiveBatch;
|
||||
|
||||
private bool debug = false;
|
||||
private RectangleRenderer rectangleRenderer;
|
||||
|
||||
/// <summary>
|
||||
/// Draws rectangle using the bounds of this module.
|
||||
/// </summary>
|
||||
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; } }
|
||||
|
||||
/// <summary>
|
||||
/// Bounds of this module.
|
||||
@ -62,7 +59,7 @@ namespace RecrownedAthenaeum.UI.Modular
|
||||
/// <param name="batch">Batch used to draw.</param>
|
||||
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); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user