diff options
| author | aldrikboy <aldrikboy@gmail.com> | 2017-12-11 22:02:13 +0100 |
|---|---|---|
| committer | aldrikboy <aldrikboy@gmail.com> | 2017-12-11 22:02:13 +0100 |
| commit | fd6fa4e5cebbe3edb65d50c78dcc8a97ce98ce64 (patch) | |
| tree | 8950f6b9023e0b47e22e1cd4869ab76de0803f4c /Penguloon/Scenes/LoadingScene.cs | |
| parent | c4c0f3c887d627b6432551e96009c7aeecd4cdd8 (diff) | |
First commit
Diffstat (limited to 'Penguloon/Scenes/LoadingScene.cs')
| -rw-r--r-- | Penguloon/Scenes/LoadingScene.cs | 71 |
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 |
