diff --git a/RhythmBullet/RhythmBullet.csproj b/RhythmBullet/RhythmBullet.csproj
index 4e5c60d..bf9c636 100644
--- a/RhythmBullet/RhythmBullet.csproj
+++ b/RhythmBullet/RhythmBullet.csproj
@@ -47,9 +47,11 @@
true
+
+
diff --git a/RhythmBullet/RhythmBulletGame.cs b/RhythmBullet/RhythmBulletGame.cs
index 8620e4b..7f9bc9b 100644
--- a/RhythmBullet/RhythmBulletGame.cs
+++ b/RhythmBullet/RhythmBulletGame.cs
@@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Input;
using RhythmBullet.Zer01HD.Game;
using RhythmBullet.Zer01HD.Game.ContentResolvers;
using RhythmBullet.Zer01HD.Game.Preferences;
+using RhythmBullet.Zer01HD.Game.Screens;
using RhythmBullet.Zer01HD.UI;
using RhythmBullet.Zer01HD.Utilities;
using RhythmBullet.Zer01HD.Utilities.ContentSystem;
@@ -29,6 +30,7 @@ namespace RhythmBullet
public readonly ContentSystem Assets;
readonly ResolutionContentResolver resolutionContentResolver;
public PreferencesManager preferencesManager;
+ private Screen previousScreen;
private Screen currentScreen;
private bool resizing;
public RhythmBulletGame()
@@ -60,6 +62,7 @@ namespace RhythmBullet
{
if (currentScreen != null)
{
+ previousScreen = value;
Screen.Hide();
}
currentScreen = value;
@@ -91,7 +94,7 @@ namespace RhythmBullet
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
QueueContent();
- Screen = new LoadingScreen(Content.Load("RhythmBullet"), new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
+ Screen = new LoadingScreen(Content.Load("RhythmBullet"), 0.5f, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
}
///
@@ -113,20 +116,21 @@ namespace RhythmBullet
if (!Assets.Done)
{
Assets.Update();
- } else if (resizing)
+ }
+ else if (resizing)
{
resizing = false;
PostResize();
}
- switch (Screen.State) {
+ switch (Screen.State)
+ {
case ScreenState.EnterTransition:
Screen.EnteringTransition(gameTime.ElapsedGameTime.TotalSeconds, Assets.Done, ref BackgroundColor);
break;
case ScreenState.ExitTransition:
- Screen transitionScreen = Screen.ExitingTransition(gameTime.ElapsedGameTime.TotalSeconds, Assets.Done, ref BackgroundColor);
- if (transitionScreen != null)
+ if (Screen.ExitingTransition(gameTime.ElapsedGameTime.TotalSeconds, Assets.Done, ref BackgroundColor))
{
- Screen = transitionScreen;
+ Screen = previousScreen != null ? previousScreen : new MainScreen(graphics.GraphicsDevice, BackgroundColor);
}
break;
case ScreenState.Normal:
@@ -162,7 +166,7 @@ namespace RhythmBullet
Assets.UnloadAll();
QueueContent();
Screen.AssetLoadStateChange(true);
- Screen = new LoadingScreen(Content.Load("RhythmBullet"), new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
+ Screen = new LoadingScreen(Content.Load("loading_ring"), 0.4f, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
}
private void PostResize()
@@ -173,21 +177,9 @@ namespace RhythmBullet
private void QueueContent()
{
- Assets.Queue("Tech-Circle1");
- Assets.Queue("polyjet-standard");
- Assets.Queue("cybercircle3B");
Assets.Queue("title");
- Assets.Queue("cybercircle1");
Assets.Queue("default_cover", false);
- Assets.Queue("laser");
- Assets.Queue("pellet");
- Assets.Queue("shard");
- Assets.Queue("bar");
- Assets.Queue("flake");
- Assets.Queue("void_circle");
- Assets.Queue("tpSelector");
Assets.Queue("backgrounds/mainBG");
- Assets.Queue("magic1");
}
}
}
diff --git a/RhythmBullet/Zer01HD/Game/Screens/MainScreen.cs b/RhythmBullet/Zer01HD/Game/Screens/MainScreen.cs
index 883d50a..9b75a45 100644
--- a/RhythmBullet/Zer01HD/Game/Screens/MainScreen.cs
+++ b/RhythmBullet/Zer01HD/Game/Screens/MainScreen.cs
@@ -1,5 +1,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
+using RhythmBullet.Zer01HD.Game.Screens.Transitions;
using RhythmBullet.Zer01HD.UI;
using RhythmBullet.Zer01HD.Utilities.UI;
using System;
@@ -12,14 +13,16 @@ namespace RhythmBullet.Zer01HD.Game.Screens
{
class MainScreen : Screen
{
+ FadeInTransition fadeInTransition;
- public MainScreen() : base(true)
+ public MainScreen(GraphicsDevice graphicsDevice, Color transitionFromColor) : base(true)
{
-
+ fadeInTransition = new FadeInTransition(graphicsDevice, transitionFromColor, ScreenSize);
}
public override void EnteringTransition(double delta, bool assetsLoaded, ref Color backgroundColor)
{
+ fadeInTransition.Fade((float)delta);
base.EnteringTransition(delta, assetsLoaded, ref backgroundColor);
}
}
diff --git a/RhythmBullet/Zer01HD/Game/Screens/Transitions/FadeInTransition.cs b/RhythmBullet/Zer01HD/Game/Screens/Transitions/FadeInTransition.cs
index e747ec5..c594a96 100644
--- a/RhythmBullet/Zer01HD/Game/Screens/Transitions/FadeInTransition.cs
+++ b/RhythmBullet/Zer01HD/Game/Screens/Transitions/FadeInTransition.cs
@@ -28,7 +28,7 @@ namespace RhythmBullet.Zer01HD.Game.Screens.Transitions
}
- internal void Fade(SpriteBatch batch, float deltaf)
+ internal bool Fade(float deltaf)
{
if (progR > 0 || progG > 0 || progB > 0)
{
@@ -53,8 +53,17 @@ namespace RhythmBullet.Zer01HD.Game.Screens.Transitions
color.G = (byte)progG;
color.B = (byte)progB;
color.A = (byte)progA;
+ return false;
+ }
+ return true;
+ }
+
+ internal void Draw(SpriteBatch batch)
+ {
+ if (curtain != null)
+ {
+ batch.Draw(curtain, curtainSize, color);
}
- batch.Draw(curtain, curtainSize, color);
}
public void Dispose()
diff --git a/RhythmBullet/Zer01HD/Utilities/UI/LoadingScreen.cs b/RhythmBullet/Zer01HD/Utilities/UI/LoadingScreen.cs
index 7a86710..fafffa6 100644
--- a/RhythmBullet/Zer01HD/Utilities/UI/LoadingScreen.cs
+++ b/RhythmBullet/Zer01HD/Utilities/UI/LoadingScreen.cs
@@ -9,21 +9,30 @@ namespace RhythmBullet.Zer01HD.Game
{
class LoadingScreen : Screen
{
- Texture2D texture;
+ readonly Texture2D texture;
Color color;
- Rectangle rectangleBounds;
- float proportion = 0.5f;
+ Rectangle textureBounds;
+ readonly float proportion;
bool recorded;
float rR, rG, rB;
float progR, progG, progB;
float progC = 254;
- public LoadingScreen(Texture2D texture, Rectangle dimensions) : base(true)
+ float rotation;
+ readonly bool rotate;
+ Vector2 origin;
+
+ public LoadingScreen(Texture2D texture, float proportion, Rectangle dimensions, bool rotate = false) : base(true)
{
color = Color.White;
this.texture = texture;
- rectangleBounds = new Rectangle(0, 0, (int)(dimensions.Height * proportion), (int)(dimensions.Height * proportion));
- rectangleBounds.X = (dimensions.Width - rectangleBounds.Width) / 2;
- rectangleBounds.Y = (dimensions.Height - rectangleBounds.Height) / 2;
+ this.proportion = proportion;
+ this.rotate = rotate;
+ textureBounds.Width = (int)(dimensions.Height * proportion);
+ textureBounds.Height = (int)(dimensions.Height * proportion);
+ textureBounds.X = (dimensions.Width) / 2;
+ textureBounds.Y = (dimensions.Height) / 2;
+ origin.X = texture.Width / 2;
+ origin.Y = texture.Height / 2;
}
public override void Update(GameTime gameTime)
@@ -33,16 +42,20 @@ namespace RhythmBullet.Zer01HD.Game
public override void EnteringTransition(double delta, bool assetsLoaded, ref Color BGColor)
{
+ float deltaf = (float)delta;
+ if (rotate)
+ {
+ DoRotate(deltaf);
+ }
if (assetsLoaded)
{
- float deltaf = (float)delta;
if (progR < 254 || progG < 254 || progB < 254)
{
if (!recorded)
{
- rR = (Color.White.R - BGColor.R) / 3f;
- rG = (Color.White.G - BGColor.G) / 3f;
- rB = (Color.White.B - BGColor.B) / 3f;
+ rR = (Color.White.R - BGColor.R) / 2f;
+ rG = (Color.White.G - BGColor.G) / 2f;
+ rB = (Color.White.B - BGColor.B) / 2f;
recorded = true;
}
progR += rR * deltaf;
@@ -55,34 +68,50 @@ namespace RhythmBullet.Zer01HD.Game
BGColor.G = (byte)progG;
BGColor.B = (byte)progB;
}
- else if (progC > 0)
- {
- float rate = deltaf * 255 / 1.5f;
- progC -= rate;
- progC = Math.Max(progC, 0);
- color.R = (byte)progC;
- color.G = (byte)progC;
- color.B = (byte)progC;
- color.A = (byte)progC;
- }
else
{
- DoneTransition();
+ DoneEnterTransition();
StartExitTransition();
}
-
}
- base.EnteringTransition(delta, assetsLoaded, ref BGColor);
}
- public override Screen ExitingTransition(double delta, bool assetsLoaded, ref Color backgroundColor)
+ public override bool ExitingTransition(double delta, bool assetsLoaded, ref Color backgroundColor)
{
- return new MainScreen();
+ float deltaf = (float)delta;
+ if (rotate)
+ {
+ DoRotate(deltaf);
+ }
+ if (progC > 0)
+ {
+ float rate = deltaf * 255 / 1f;
+ progC -= rate;
+ progC = Math.Max(progC, 0);
+ color.R = (byte)progC;
+ color.G = (byte)progC;
+ color.B = (byte)progC;
+ color.A = (byte)progC;
+ }
+ else
+ {
+ return true;
+ }
+ return false;
+ }
+
+ void DoRotate(float deltaf)
+ {
+ rotation += (2f / 3f) * (float)Math.PI * deltaf;
+ if (rotation >= 2 * Math.PI)
+ {
+ rotation = 0;
+ }
}
public override void Draw(SpriteBatch spriteBatch)
{
- spriteBatch.Draw(texture, rectangleBounds, color);
+ spriteBatch.Draw(texture, textureBounds, null, color, rotation, origin, SpriteEffects.None, 0f);
base.Draw(spriteBatch);
}
diff --git a/RhythmBullet/Zer01HD/Utilities/UI/Screen.cs b/RhythmBullet/Zer01HD/Utilities/UI/Screen.cs
index c2af936..f040476 100644
--- a/RhythmBullet/Zer01HD/Utilities/UI/Screen.cs
+++ b/RhythmBullet/Zer01HD/Utilities/UI/Screen.cs
@@ -39,9 +39,9 @@ namespace RhythmBullet.Zer01HD.Utilities.UI
}
- public virtual Screen ExitingTransition(double delta, bool assetsLoaded, ref Color backgroundColor)
+ public virtual bool ExitingTransition(double delta, bool assetsLoaded, ref Color backgroundColor)
{
- return null;
+ return true;
}
public virtual void Show()
@@ -67,7 +67,7 @@ namespace RhythmBullet.Zer01HD.Utilities.UI
}
}
- public void DoneTransition()
+ public void DoneEnterTransition()
{
state = ScreenState.Normal;
}