Began trying to fix primitive batch. Added a default camera to the configuration.

This commit is contained in:
2019-01-30 07:46:58 -06:00
parent 8387cbc604
commit e1e2bbb3d7
13 changed files with 68 additions and 40 deletions

View File

@@ -2,6 +2,7 @@
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using RecrownedAthenaeum.Input;
using RecrownedAthenaeum.Render;
using System;
namespace RecrownedAthenaeum.UI.Modular
@@ -12,6 +13,16 @@ namespace RecrownedAthenaeum.UI.Modular
/// </summary>
public class UIModule : IInputListener
{
private RectangleRenderer renderer;
private PrimitiveBatch primitiveBatch;
private bool debug = false;
/// <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; } }
/// <summary>
/// Bounds of this module.
/// </summary>
@@ -51,7 +62,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(); }
}
/// <summary>