smoothed out black to white transition on splash screen
This commit is contained in:
parent
b77aa6d7fd
commit
46dc862aed
@ -34,7 +34,7 @@ namespace RhythmBullet
|
||||
public RhythmBulletGame()
|
||||
{
|
||||
graphics = new GraphicsDeviceManager(this);
|
||||
BackgroundColor = new Color(0, 0, 0, 255);
|
||||
|
||||
Content.RootDirectory = "Content";
|
||||
Assets = new ContentSystem(Content);
|
||||
resolutionContentResolver = new ResolutionContentResolver();
|
||||
@ -91,7 +91,7 @@ namespace RhythmBullet
|
||||
// Create a new SpriteBatch, which can be used to draw textures.
|
||||
spriteBatch = new SpriteBatch(GraphicsDevice);
|
||||
QueueContent();
|
||||
Screen = new SplashScreen(this, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
|
||||
Screen = new LoadingScreen(this, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -139,6 +139,7 @@ namespace RhythmBullet
|
||||
|
||||
public void Resize(int width, int height)
|
||||
{
|
||||
pixels_per_WU = height / WORLD_HEIGHT;
|
||||
resolutionContentResolver.Width = width;
|
||||
resolutionContentResolver.Height = height;
|
||||
graphics.PreferredBackBufferWidth = width;
|
||||
@ -147,7 +148,7 @@ namespace RhythmBullet
|
||||
Assets.UnloadAll();
|
||||
QueueContent();
|
||||
Screen.AssetLoadStateChange(true);
|
||||
Screen = new SplashScreen(this, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
|
||||
Screen = new LoadingScreen(this, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
|
||||
}
|
||||
|
||||
private void PostResize()
|
||||
|
@ -131,6 +131,7 @@ namespace RhythmBullet.Zer01HD.Utilities.ContentSystem
|
||||
contentManager.Unload();
|
||||
assets.Clear();
|
||||
ClearQueue();
|
||||
Debug.WriteLine("Unloaded all assets.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,15 +12,18 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace RhythmBullet.Zer01HD.Game
|
||||
{
|
||||
class SplashScreen : Screen
|
||||
class LoadingScreen : Screen
|
||||
{
|
||||
Texture2D recrown;
|
||||
Color color;
|
||||
Rectangle rectangleBounds;
|
||||
float proportion = 0.4f;
|
||||
RhythmBulletGame rhythmBullet;
|
||||
float progress;
|
||||
public SplashScreen(RhythmBulletGame rhythmBullet, Rectangle dimensions)
|
||||
double progress;
|
||||
double timePassed;
|
||||
public LoadingScreen(RhythmBulletGame rhythmBullet, Rectangle dimensions)
|
||||
{
|
||||
color = Color.White;
|
||||
this.recrown = rhythmBullet.Content.Load<Texture2D>("RhythmBullet");
|
||||
this.rhythmBullet = rhythmBullet;
|
||||
rectangleBounds = new Rectangle(0, 0, (int)(dimensions.Height * proportion), (int)(dimensions.Height * proportion));
|
||||
@ -31,13 +34,14 @@ namespace RhythmBullet.Zer01HD.Game
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
if (progress < 0.8f)
|
||||
if (progress < 1f)
|
||||
{
|
||||
float delta = (float) gameTime.ElapsedGameTime.TotalSeconds;
|
||||
progress += (delta/6f);
|
||||
if (progress > 1f)
|
||||
double delta = gameTime.ElapsedGameTime.TotalSeconds;
|
||||
timePassed += delta;
|
||||
progress = timePassed / 4;
|
||||
if (progress > 0.9f)
|
||||
{
|
||||
progress = 1f;
|
||||
progress = 0.9f;
|
||||
}
|
||||
rhythmBullet.BackgroundColor.R = (byte)(progress * 255);
|
||||
rhythmBullet.BackgroundColor.G = (byte)(progress * 255);
|
||||
@ -49,7 +53,7 @@ namespace RhythmBullet.Zer01HD.Game
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
spriteBatch.Draw(recrown, rectangleBounds, Color.White);
|
||||
spriteBatch.Draw(recrown, rectangleBounds, color);
|
||||
base.Draw(spriteBatch);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user