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