]> git.r.bdr.sh - rbdr/super-polarity/blob - SuperPolarity/TitleScreen.cs
f97c19a5b4b47e642bd922394903c93c8f103e49
[rbdr/super-polarity] / SuperPolarity / TitleScreen.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using Microsoft.Xna.Framework;
6 using Microsoft.Xna.Framework.Graphics;
7
8 namespace SuperPolarity
9 {
10 class TitleScreen : Screen
11 {
12 protected Texture2D TitleImage;
13
14 public TitleScreen(SuperPolarity newGame) : base(newGame) {}
15
16 public override void LoadContent()
17 {
18 base.LoadContent();
19 TitleImage = Game.Content.Load<Texture2D>("Graphics\\polaritydemotitle");
20 InputController.Bind("pause", HandleStart);
21 }
22
23 public void HandleStart(float value)
24 {
25 if (!Active) { return; }
26 Game.Player.Reset();
27 var gameScreen = new GameScreen(Game);
28 gameScreen.Initialize();
29 ScreenManager.Push(gameScreen);
30 }
31
32 public override void CleanUp()
33 {
34 base.CleanUp();
35 TitleImage = null;
36 }
37
38 public override void Draw(SpriteBatch spriteBatch)
39 {
40 base.Draw(spriteBatch);
41 spriteBatch.Draw(TitleImage, new Vector2(0, 0), Color.White);
42 }
43
44 public override void Update(GameTime gameTime)
45 {
46 base.Update(gameTime);
47 InputController.UpdateInput(false);
48 }
49 }
50 }