Even more documentation.

This commit is contained in:
2019-01-14 01:26:46 -06:00
parent 40c7772559
commit b019b7cf10
16 changed files with 368 additions and 46 deletions

View File

@@ -5,18 +5,72 @@ using System.Collections.Generic;
namespace RecrownedAthenaeum.ScreenSystem
{
public enum ScreenState { EnterTransition, ExitTransition, Normal }
/// <summary>
/// Represents one of the poosible states a screen can be in.
/// </summary>
public enum ScreenState {
/// <summary>
/// Screen is transitioning in.
/// </summary>
EnterTransition,
/// <summary>
/// Screen is transitioning out.
/// </summary>
ExitTransition,
/// <summary>
/// Screen is currently displayed normally without transition.
/// </summary>
Normal
}
/// <summary>
/// A screen represents a virtual system of management that controls an system of items to be displayed.
/// </summary>
public class Screen
{
public List<ITransition> Transitions;
public bool UseRenderTargetForExitTransition;
/// <summary>
/// Transitions to apply.
/// </summary>
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.
/// </summary>
public bool UseRenderTargetForExitTransition { get; private set; }
/// <summary>
/// The background color to be used to clear the screen.
/// </summary>
public Color BackgroundColor;
public GraphicsDevice GraphicsDevice { get; private set; }
/// <summary>
/// The next screen to be displayed after exit transition finishes. May be null, leading to transition to previous screen or loading screen.
/// </summary>
public Screen NextScreen { get; set; }
/// <summary>
/// The current window size.
/// </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; }
/// <summary>
/// Current state of the screen.
/// </summary>
public ScreenState State { get; private set; }
/// <summary>
/// Creates a new screen.
/// </summary>
/// <param name="useEnterTransition">True to start in entering transition state.</param>
public Screen(bool useEnterTransition = false)
{
State = useEnterTransition ? ScreenState.EnterTransition : ScreenState.Normal;
@@ -26,11 +80,10 @@ namespace RecrownedAthenaeum.ScreenSystem
/// <summary>
/// Called only once after initialization to give required parameters.
/// </summary>
public virtual void Initiate(GraphicsDevice graphicsDevice, Rectangle screenSize, Camera2D camera)
public virtual void Initiate(Rectangle screenSize, Camera2D camera)
{
this.Camera = camera;
this.ScreenSize = screenSize;
GraphicsDevice = graphicsDevice;
Initiated = true;
}
@@ -82,7 +135,7 @@ namespace RecrownedAthenaeum.ScreenSystem
for (int transitionID = 0; transitionID < Transitions.Count; transitionID++)
{
ITransition transition = Transitions[transitionID];
if (!transition.EnteringTransition(delta, waiting))
if (!transition.UpdateEnteringTransition(delta, waiting))
{
complete = false;
}
@@ -98,7 +151,7 @@ namespace RecrownedAthenaeum.ScreenSystem
bool complete = true;
foreach (ITransition transition in Transitions)
{
if (!transition.ExitingTransition(delta, waiting))
if (!transition.UpdateExitingTransition(delta, waiting))
{
complete = false;
}
@@ -135,7 +188,6 @@ namespace RecrownedAthenaeum.ScreenSystem
}
public ScreenState State { get; private set; }
/// <summary>
/// Call this to begin exit transition.