aboutsummaryrefslogtreecommitdiff
path: root/SuperPolarity/TitleScreen.cs
blob: f97c19a5b4b47e642bd922394903c93c8f103e49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace SuperPolarity
{
    class TitleScreen : Screen
    {
        protected Texture2D TitleImage;

        public TitleScreen(SuperPolarity newGame) : base(newGame) {}

        public override void LoadContent()
        {
            base.LoadContent();
            TitleImage = Game.Content.Load<Texture2D>("Graphics\\polaritydemotitle");
            InputController.Bind("pause", HandleStart);
        }

        public void HandleStart(float value)
        {
            if (!Active) { return; }
            Game.Player.Reset();
            var gameScreen = new GameScreen(Game);
            gameScreen.Initialize();
            ScreenManager.Push(gameScreen);
        }

        public override void CleanUp()
        {
            base.CleanUp();
            TitleImage = null;
        }

        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
            spriteBatch.Draw(TitleImage, new Vector2(0, 0), Color.White);
        }

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            InputController.UpdateInput(false);
        }
    }
}