updated transition system to be more intuitive
This commit is contained in:
@@ -16,18 +16,19 @@ namespace RhythmBullet.Zer01HD.Game.Screens
|
||||
{
|
||||
class MainScreen : Screen
|
||||
{
|
||||
FadeAwayTransition fat;
|
||||
Texture2D background;
|
||||
Viewport viewport;
|
||||
|
||||
public MainScreen(GraphicsDevice graphicsDevice, ContentSystem assets) : base(true)
|
||||
public MainScreen(ContentSystem assets) : base(true)
|
||||
{
|
||||
FadeAwayTransition fadeAwayTransition = new FadeAwayTransition();
|
||||
Transitions.Add(fadeAwayTransition);
|
||||
graphicsDevice.Clear(Color.White);
|
||||
background = assets.Get<Texture2D>("backgrounds/mainBG");
|
||||
fat = new FadeAwayTransition(1.25f);
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
Transitions.Add(fat);
|
||||
base.Show();
|
||||
}
|
||||
|
||||
|
@@ -13,30 +13,31 @@ namespace RhythmBullet.Zer01HD.Game.Screens.Transitions
|
||||
{
|
||||
internal class FadeAwayTransition : IDisposable, ITransition
|
||||
{
|
||||
private const float TIME_REQUIRED = 2f;
|
||||
private float time;
|
||||
public Texture2D curtain;
|
||||
public Rectangle curtainSize;
|
||||
private Color color;
|
||||
private float progR, progG, progB, progA;
|
||||
private float rR, rG, rB, rA;
|
||||
|
||||
internal FadeAwayTransition()
|
||||
internal FadeAwayTransition(float time)
|
||||
{
|
||||
color = Color.White;
|
||||
rR = (0 - 254) / TIME_REQUIRED;
|
||||
rG = (0 - 254) / TIME_REQUIRED;
|
||||
rB = (0 - 254) / TIME_REQUIRED;
|
||||
rA = (0 - 254) / TIME_REQUIRED;
|
||||
|
||||
progA = color.A;
|
||||
progR = color.R;
|
||||
progG = color.G;
|
||||
progB = color.B;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public void InitiateTransition(Rectangle dimensions)
|
||||
{
|
||||
curtainSize = dimensions;
|
||||
color = Color.White;
|
||||
rR = (0 - 254) / time;
|
||||
rG = (0 - 254) / time;
|
||||
rB = (0 - 254) / time;
|
||||
rA = (0 - 254) / time;
|
||||
|
||||
progA = color.A;
|
||||
progR = color.R;
|
||||
progG = color.G;
|
||||
progB = color.B;
|
||||
}
|
||||
|
||||
private bool Fade(float deltaf)
|
||||
|
Reference in New Issue
Block a user