improved transition system with usage of target rendering
This commit is contained in:
@@ -36,10 +36,10 @@ namespace RhythmBullet.Zer01HD.Game.Screens
|
||||
base.Draw(spriteBatch);
|
||||
}
|
||||
|
||||
public override void EnteringTransition(double delta, bool assetsLoaded, ref Color backgroundColor)
|
||||
public override void EnteringTransition(double delta, bool assetsLoaded, ref Color backgroundColor, RenderTarget2D previousScreenExitFrame)
|
||||
{
|
||||
fadeInTransition.Fade((float)delta);
|
||||
base.EnteringTransition(delta, assetsLoaded, ref backgroundColor);
|
||||
base.EnteringTransition(delta, assetsLoaded, ref backgroundColor, previousScreenExitFrame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ namespace RhythmBullet.Zer01HD.Game
|
||||
base.Update(gameTime);
|
||||
}
|
||||
|
||||
public override void EnteringTransition(double delta, bool assetsLoaded, ref Color BGColor)
|
||||
public override void EnteringTransition(double delta, bool assetsLoaded, ref Color BGColor, RenderTarget2D previousScreenExitFrame)
|
||||
{
|
||||
float deltaf = (float)delta;
|
||||
if (rotate)
|
||||
@@ -73,7 +73,7 @@ namespace RhythmBullet.Zer01HD.Game
|
||||
else
|
||||
{
|
||||
DoneEnterTransition();
|
||||
StartExitTransition();
|
||||
StartExitTransition(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -12,13 +12,19 @@ namespace RhythmBullet.Zer01HD.Utilities.UI
|
||||
|
||||
public class Screen
|
||||
{
|
||||
public Rectangle ScreenSize;
|
||||
|
||||
ScreenState state;
|
||||
|
||||
public bool UseRenderTargetForExitTransition;
|
||||
private GraphicsDevice GraphicsDevice;
|
||||
public Screen(bool useEnterTransition = false)
|
||||
{
|
||||
state = useEnterTransition ? ScreenState.EnterTransition : ScreenState.Normal;
|
||||
State = useEnterTransition ? ScreenState.EnterTransition : ScreenState.Normal;
|
||||
}
|
||||
|
||||
public void Initiate(Rectangle screenSize, GraphicsDevice graphicsDevice)
|
||||
{
|
||||
Initiated = true;
|
||||
this.ScreenSize = screenSize;
|
||||
this.GraphicsDevice = graphicsDevice;
|
||||
RenderTarget = new RenderTarget2D(graphicsDevice, ScreenSize.Width, ScreenSize.Height);
|
||||
}
|
||||
|
||||
public virtual void Update(GameTime gameTime)
|
||||
@@ -31,7 +37,7 @@ namespace RhythmBullet.Zer01HD.Utilities.UI
|
||||
|
||||
}
|
||||
|
||||
public virtual void EnteringTransition(double delta, bool assetsLoaded, ref Color backgroundColor)
|
||||
public virtual void EnteringTransition(double delta, bool assetsLoaded, ref Color backgroundColor, RenderTarget2D previousScreenExitFrame)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -56,23 +62,41 @@ namespace RhythmBullet.Zer01HD.Utilities.UI
|
||||
|
||||
}
|
||||
|
||||
public ScreenState State
|
||||
{
|
||||
get
|
||||
{
|
||||
return state;
|
||||
}
|
||||
}
|
||||
public ScreenState State { get; private set; }
|
||||
|
||||
public void DoneEnterTransition()
|
||||
{
|
||||
state = ScreenState.Normal;
|
||||
State = ScreenState.Normal;
|
||||
}
|
||||
|
||||
public void StartExitTransition()
|
||||
public void StartExitTransition(bool UseRenderTargetForExitTransition = false)
|
||||
{
|
||||
state = ScreenState.ExitTransition;
|
||||
this.UseRenderTargetForExitTransition = UseRenderTargetForExitTransition;
|
||||
State = ScreenState.ExitTransition;
|
||||
}
|
||||
|
||||
public Screen NextScreen
|
||||
{
|
||||
get; protected set;
|
||||
}
|
||||
|
||||
public Rectangle ScreenSize
|
||||
{
|
||||
get;
|
||||
protected set;
|
||||
//Remember to init in init func
|
||||
}
|
||||
|
||||
public RenderTarget2D RenderTarget
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public bool Initiated
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user