summaryrefslogtreecommitdiff
path: root/Penguloon/Scenes/LoadingScene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Penguloon/Scenes/LoadingScene.cs')
-rw-r--r--Penguloon/Scenes/LoadingScene.cs71
1 files changed, 71 insertions, 0 deletions
diff --git a/Penguloon/Scenes/LoadingScene.cs b/Penguloon/Scenes/LoadingScene.cs
new file mode 100644
index 0000000..19f0215
--- /dev/null
+++ b/Penguloon/Scenes/LoadingScene.cs
@@ -0,0 +1,71 @@
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Audio;
+using Microsoft.Xna.Framework.Input.Touch;
+using Penguloon.Scenes;
+using System;
+using System.Collections.Generic;
+
+namespace Penguloon.Scenes
+{
+ public class LoadingScene : SceneBase
+ {
+ public LoadingScene(Main main) : base(main)
+ {
+
+ }
+
+ public override void CreateControls()
+ {
+
+ }
+
+ public override void Draw(float deltaTime)
+ {
+ base.Draw(deltaTime);
+
+ // if were still loading assets for loading screen, return
+ if (!ContentManager.DonePreLoading) return;
+
+ // background
+ Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/background"),
+ destinationRectangle: new Rectangle(0, 0, (int)StaticUIValues.ScreenViewport.X, (int)StaticUIValues.ScreenViewport.Y));
+
+ DrawSnowflakes();
+
+ // draw progressbar
+ DrawProgressbar();
+
+ // draw title
+ DrawText(ContentManager.GetFont("Fonts/GWENT/128"), "Penguloon", new Vector2(0, 100),
+ StaticUIValues.ScreenViewport, TextAllignment.CenterTop, Color.Red, Color.Black, 5);
+ }
+
+ /// <summary>
+ /// Draw progress bar.
+ /// </summary>
+ private void DrawProgressbar()
+ {
+ int barWidth = (int)(StaticUIValues.LoadingProgressbarSize.X * ContentManager.LoadPercentageF);
+
+ Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/red"),
+ destinationRectangle: new Rectangle(StaticUIValues.LoadingProgressbarValuePosition.ToPoint(),
+ new Point(barWidth - 10, (int)StaticUIValues.LoadingProgressbarSize.Y - 10)));
+
+ Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/progressbar"),
+ destinationRectangle: new Rectangle(StaticUIValues.LoadingProgressbarPosition.ToPoint(),
+ StaticUIValues.LoadingProgressbarSize.ToPoint()));
+ }
+
+ public override void Update(float deltaTime, TouchLocation[] touchLocations)
+ {
+ base.Update(deltaTime, touchLocations);
+
+ // if loading is completed
+ if (ContentManager.DoneLoading)
+ {
+ SceneManager.MenuScene = new MenuScene(Main);
+ SceneManager.SelectedScene = SelectedScene.Menu;
+ }
+ }
+ }
+} \ No newline at end of file