refactoring; removed configuration setup; added consistent sprite batch; got rid of sprite batch settings; implemented newer setup;

This commit is contained in:
2019-03-23 19:04:43 -05:00
parent e3535f5662
commit b045033b25
28 changed files with 342 additions and 329 deletions

View File

@@ -1,6 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using RecrownedAthenaeum.Camera;
using RecrownedAthenaeum.Render;
using System.Collections.Generic;
namespace RecrownedAthenaeum.ScreenSystem
@@ -34,7 +35,7 @@ namespace RecrownedAthenaeum.ScreenSystem
public readonly List<ITransition> Transitions;
/// <summary>
/// Whether or not to continue rendering this screen onto a buffer for the benifit of the next screen to use as a transition.
/// Whether or not to continue rendering this screen onto a buffer for the benefit of the next screen to use as a transition.
/// </summary>
public bool UseRenderTargetForExitTransition { get; private set; }
@@ -49,19 +50,9 @@ namespace RecrownedAthenaeum.ScreenSystem
public Screen NextScreen { get; set; }
/// <summary>
/// The current window size.
/// The current window dimensions.
/// </summary>
public Rectangle ScreenSize { get; private set; }
/// <summary>
/// Whether or not screen have been initiated.
/// </summary>
public bool Initiated { get; private set; }
/// <summary>
/// The 2D camera to be used for the screen.
/// </summary>
public Camera2D Camera { get; private set; }
public int width, height;
/// <summary>
/// Current state of the screen.
@@ -79,13 +70,14 @@ namespace RecrownedAthenaeum.ScreenSystem
}
/// <summary>
/// Called only once after initialization to give required parameters.
/// Called when screen size is set.
/// </summary>
public virtual void Initiate(Rectangle screenSize, Camera2D camera)
/// <param name="width">The width of the screen.</param>
/// <param name="height">The height of the screen.</param>
public virtual void ApplySize(int width, int height)
{
this.Camera = camera;
this.ScreenSize = screenSize;
Initiated = true;
this.width = width;
this.height = height;
}
/// <summary>
@@ -101,7 +93,7 @@ namespace RecrownedAthenaeum.ScreenSystem
/// Called to draw this screen.
/// </summary>
/// <param name="spriteBatch">SpriteBatch to use.</param>
public virtual void Draw(SpriteBatch spriteBatch)
public virtual void Draw(ConsistentSpriteBatch spriteBatch)
{
foreach (ITransition transition in Transitions)
{
@@ -167,7 +159,7 @@ namespace RecrownedAthenaeum.ScreenSystem
{
foreach (ITransition transition in Transitions)
{
transition.InitiateTransition(ScreenSize);
transition.InitiateTransition(new Rectangle(0, 0, width, height));
}
}