diff --git a/RhythmBullet/RhythmBulletGame.cs b/RhythmBullet/RhythmBulletGame.cs index d0f5c72..8fe92c4 100644 --- a/RhythmBullet/RhythmBulletGame.cs +++ b/RhythmBullet/RhythmBulletGame.cs @@ -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)); } /// @@ -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() diff --git a/RhythmBullet/Zer01HD/Utilities/ContentSystem/ContentSystem.cs b/RhythmBullet/Zer01HD/Utilities/ContentSystem/ContentSystem.cs index f9918b4..7d6ce66 100644 --- a/RhythmBullet/Zer01HD/Utilities/ContentSystem/ContentSystem.cs +++ b/RhythmBullet/Zer01HD/Utilities/ContentSystem/ContentSystem.cs @@ -131,6 +131,7 @@ namespace RhythmBullet.Zer01HD.Utilities.ContentSystem contentManager.Unload(); assets.Clear(); ClearQueue(); + Debug.WriteLine("Unloaded all assets."); } } diff --git a/RhythmBullet/Zer01HD/Utilities/UI/LoadingScreen.cs b/RhythmBullet/Zer01HD/Utilities/UI/LoadingScreen.cs index 6944649..608a5c0 100644 --- a/RhythmBullet/Zer01HD/Utilities/UI/LoadingScreen.cs +++ b/RhythmBullet/Zer01HD/Utilities/UI/LoadingScreen.cs @@ -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("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); } }