documentation

This commit is contained in:
2019-01-13 23:23:03 -06:00
parent 4ac011f3cf
commit 32c2f25196
6 changed files with 117 additions and 36 deletions

View File

@@ -26,9 +26,6 @@ namespace RecrownedAthenaeum.ScreenSystem
/// <summary>
/// Called only once after initialization to give required parameters.
/// </summary>
/// <param name="graphicsDevice"></param>
/// <param name="screenSize"></param>
/// <param name="camera"></param>
public virtual void Initiate(GraphicsDevice graphicsDevice, Rectangle screenSize, Camera2D camera)
{
this.Camera = camera;
@@ -37,11 +34,19 @@ namespace RecrownedAthenaeum.ScreenSystem
Initiated = true;
}
/// <summary>
/// Called to update the screen.
/// </summary>
/// <param name="gameTime">Game time information.</param>
public virtual void Update(GameTime gameTime)
{
}
/// <summary>
/// Called to draw this screen.
/// </summary>
/// <param name="spriteBatch">SpriteBatch to use.</param>
public virtual void Draw(SpriteBatch spriteBatch)
{
foreach (ITransition transition in Transitions)
@@ -51,33 +56,33 @@ namespace RecrownedAthenaeum.ScreenSystem
}
/// <summary>
/// Updates the transition.
/// Updates the transition based on the current state of the screen.
/// </summary>
/// <param name="delta">Time passed since last frame in seconds.</param>
/// <param name="assetsLoaded">If waiting on assets.</param>
/// <param name="waiting">If the this transition should wait.</param>
/// <param name="previousScreenExitFrame">The previous screen's frame. May be null.</param>
/// <returns>Only returns true if exit transition is complete. Returns false otherwise.</returns>
public bool UpdateTransition(double delta, bool assetsLoaded)
public bool UpdateTransition(double delta, bool waiting)
{
switch (State)
{
case ScreenState.EnterTransition:
EnteringTransition(delta, assetsLoaded);
EnteringTransition(delta, waiting);
break;
case ScreenState.ExitTransition:
return ExitingTransition(delta, assetsLoaded);
return ExitingTransition(delta, waiting);
}
return false;
}
private void EnteringTransition(double delta, bool assetsLoaded)
private void EnteringTransition(double delta, bool waiting)
{
bool complete = true;
for (int transitionID = 0; transitionID < Transitions.Count; transitionID++)
{
ITransition transition = Transitions[transitionID];
if (!transition.EnteringTransition(delta, assetsLoaded))
if (!transition.EnteringTransition(delta, waiting))
{
complete = false;
}
@@ -88,12 +93,12 @@ namespace RecrownedAthenaeum.ScreenSystem
}
}
private bool ExitingTransition(double delta, bool assetsLoaded)
private bool ExitingTransition(double delta, bool waiting)
{
bool complete = true;
foreach (ITransition transition in Transitions)
{
if (!transition.ExitingTransition(delta, assetsLoaded))
if (!transition.ExitingTransition(delta, waiting))
{
complete = false;
}
@@ -113,11 +118,18 @@ namespace RecrownedAthenaeum.ScreenSystem
}
}
/// <summary>
/// Called when this screen is no longer the displayed screen.
/// </summary>
public virtual void Hide()
{
}
/// <summary>
/// Called whenever the status of assets changes from being loaded to unloaded or unloaded to loaded.
/// </summary>
/// <param name="state">True for loaded, false for unloaded.</param>
public virtual void AssetLoadStateChange(bool state)
{
@@ -125,12 +137,20 @@ namespace RecrownedAthenaeum.ScreenSystem
public ScreenState State { get; private set; }
/// <summary>
/// Call this to begin exit transition.
/// </summary>
/// <param name="UseRenderTargetForExitTransition">Whether or not to use a render target for the next screen to use.</param>
public void StartExitTransition(bool UseRenderTargetForExitTransition = false)
{
this.UseRenderTargetForExitTransition = UseRenderTargetForExitTransition;
State = ScreenState.ExitTransition;
}
/// <summary>
/// Called everytime the previous screen frame buffer updates. Used for transition purposes.
/// </summary>
/// <param name="previousScreenFrame">The previous screen's render buffer.</param>
public virtual void UpdatePreviousScreenFrame(RenderTarget2D previousScreenFrame)
{
foreach (ITransition transition in Transitions)