Changed 9p and tatlas' to use a separately loaded texture.

This commit is contained in:
2019-03-20 19:28:16 -05:00
parent 4add103f94
commit e3535f5662
30 changed files with 184 additions and 169 deletions

View File

@@ -3,7 +3,6 @@ using Microsoft.Xna.Framework.Graphics;
using RecrownedAthenaeum.SpecialTypes;
using RecrownedAthenaeum.UI.SkinSystem;
using RecrownedAthenaeum.UI.SkinSystem.Definitions;
using System;
namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
{

View File

@@ -1,7 +1,5 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using RecrownedAthenaeum.UI.SkinSystem;
using RecrownedAthenaeum.UI.SkinSystem.Definitions;
using System;
using System.Text;

View File

@@ -2,7 +2,6 @@
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using RecrownedAthenaeum.Input;
using RecrownedAthenaeum.Render;
using System;
namespace RecrownedAthenaeum.UI.Modular

View File

@@ -3,9 +3,7 @@ using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using RecrownedAthenaeum.Camera;
using RecrownedAthenaeum.Render;
using RecrownedAthenaeum.ScreenSystem;
namespace RecrownedAthenaeum.UI.Modular
{
@@ -16,32 +14,23 @@ namespace RecrownedAthenaeum.UI.Modular
public class UIModuleGroup : UIModule
{
List<UIModule> modules = new List<UIModule>();
Rectangle scissorBounds;
RasterizerState scissorRasterizer;
SpriteBatchSettings spriteBatchSettings;
ScissorBox scissorBox;
/// <summary>
/// Camera used by the module for cropping.
/// Configuration for starting sprite batch after scissoring. Only used if cropping.
/// </summary>
public Camera2D camera;
public SpriteBatchSettings spriteBatchSettings;
/// <summary>
/// Creates a module group.
/// </summary>
/// <param name="crop">Whether or not to crop out of bounds. Default is false.</param>
/// <param name="camera">What camera to use for cropping. Default is null and will use <see cref="Configuration"/>'s camera if crop is enabled.</param>
/// <param name="spriteBatchSettings">The settings to be used that begins the batch.</param>
public UIModuleGroup(bool crop = false, Camera2D camera = null, SpriteBatchSettings? spriteBatchSettings = null)
public UIModuleGroup(bool crop = false)
{
if (spriteBatchSettings == null) spriteBatchSettings = Configuration.spriteBatchSettings;
if (crop && camera == null) camera = Configuration.Camera2D;
this.spriteBatchSettings = spriteBatchSettings.Value;
this.camera = camera;
this.spriteBatchSettings = Configuration.SpriteBatchSettings.Value;
if (crop)
{
scissorRasterizer = new RasterizerState();
scissorRasterizer.ScissorTestEnable = true;
scissorBounds = new Rectangle();
scissorBox = new ScissorBox();
}
}
@@ -51,17 +40,10 @@ namespace RecrownedAthenaeum.UI.Modular
/// <param name="batch">Batch used to draw the group.</param>
public override void Draw(SpriteBatch batch)
{
if (scissorBounds != null)
if (scissorBox != null)
{
batch.End();
spriteBatchSettings.BeginSpriteBatch(batch);
scissorBounds.Width = situation.Width;
scissorBounds.Height = situation.Height;
scissorBounds.X = situation.X;
scissorBounds.Y = situation.Y;
Rectangle scissor = scissorBounds;
scissorBounds = batch.GraphicsDevice.ScissorRectangle;
batch.GraphicsDevice.ScissorRectangle = scissor;
scissorBox.Begin(Boundaries, batch, spriteBatchSettings);
}
foreach (UIModule module in modules)
@@ -75,11 +57,10 @@ namespace RecrownedAthenaeum.UI.Modular
module.situation.Y = offsetY;
}
if (scissorBounds != null)
if (scissorBox != null)
{
batch.GraphicsDevice.ScissorRectangle = scissorBounds;
batch.End();
spriteBatchSettings.BeginSpriteBatch(batch);
scissorBox.End();
}
}