Functioning state before changing to using render targets
This commit is contained in:
@@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics;
|
||||
using RhythmBullet.Zer01HD.Utilities.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -11,36 +12,38 @@ namespace RhythmBullet.Zer01HD.Game.Screens.Transitions
|
||||
{
|
||||
internal class FadeInTransition : IDisposable
|
||||
{
|
||||
private const float RATE = 0.3f;
|
||||
public readonly Texture2D curtain;
|
||||
Rectangle curtainSize;
|
||||
Color color;
|
||||
public Rectangle curtainSize;
|
||||
private Color color;
|
||||
private float progR, progG, progB, progA;
|
||||
private float rR, rG, rB, rA;
|
||||
private bool recorded;
|
||||
|
||||
internal FadeInTransition(GraphicsDevice graphicsDevice, Color startColor, Vector2 dimensions)
|
||||
private float rR, rG, rB, rA;
|
||||
internal FadeInTransition(GraphicsDevice graphicsDevice, Color startColor)
|
||||
{
|
||||
curtain = new Texture2D(graphicsDevice, 1, 1);
|
||||
curtain.SetData(new[] { startColor });
|
||||
curtainSize.Width = (int)dimensions.X;
|
||||
curtainSize.Height = (int)dimensions.Y;
|
||||
curtain.SetData(new[] { Color.White });
|
||||
|
||||
color = startColor;
|
||||
}
|
||||
|
||||
internal void Init(Rectangle dimensions)
|
||||
{
|
||||
curtainSize = dimensions;
|
||||
rR = (0 - color.R) / RATE;
|
||||
rG = (0 - color.G) / RATE;
|
||||
rB = (0 - color.B) / RATE;
|
||||
rA = (0 - color.A) / RATE;
|
||||
|
||||
progA = color.A;
|
||||
progR = color.R;
|
||||
progG = color.G;
|
||||
progB = color.B;
|
||||
}
|
||||
|
||||
internal bool Fade(float deltaf)
|
||||
{
|
||||
if (progR > 0 || progG > 0 || progB > 0)
|
||||
{
|
||||
if (!recorded)
|
||||
{
|
||||
rR = (0 - color.R) / 1f;
|
||||
rG = (0 - color.G) / 1f;
|
||||
rB = (0 - color.B) / 1f;
|
||||
rA = (0 - color.A) / 1f;
|
||||
recorded = true;
|
||||
}
|
||||
|
||||
progR += rR * deltaf;
|
||||
progR = Math.Max(progR, 0);
|
||||
progG += rG * deltaf;
|
||||
@@ -55,7 +58,7 @@ namespace RhythmBullet.Zer01HD.Game.Screens.Transitions
|
||||
color.A = (byte)progA;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
internal void Draw(SpriteBatch batch)
|
||||
|
Reference in New Issue
Block a user