]> git.r.bdr.sh - rbdr/super-polarity/blame_incremental - SuperPolarity/TitleScreen.cs
Update project to work on VS Code mac
[rbdr/super-polarity] / SuperPolarity / TitleScreen.cs
... / ...
CommitLineData
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using Microsoft.Xna.Framework;
6using Microsoft.Xna.Framework.Graphics;
7
8namespace 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}