]> git.r.bdr.sh - rbdr/super-polarity/blob - Super Polarity/GameScreen.cs
28fd7b758d18bbd43ad10e50a46e4094faba73a4
[rbdr/super-polarity] / Super Polarity / GameScreen.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 using Microsoft.Xna.Framework.Input;
8
9 namespace SuperPolarity
10 {
11 class GameScreen : Screen
12 {
13 public GameScreen(SuperPolarity newGame) : base(newGame) {}
14
15 private BasicGenerator generatorTest;
16
17 public override void Initialize()
18 {
19 InputController.RegisterEventForButton("changePolarity", Buttons.A);
20 InputController.RegisterEventForKey("changePolarity", Keys.Z);
21
22 InputController.RegisterEventForButton("shoot", Buttons.X);
23 InputController.RegisterEventForKey("shoot", Keys.X);
24 }
25
26 public override void LoadContent()
27 {
28
29 generatorTest = new BasicGenerator();
30 generatorTest.Initialize(Game, new Vector2(100, 600), BasicGenerator.Ships.Scout, 3000, 10);
31
32 Vector2 playerPosition = new Vector2(Game.GraphicsDevice.Viewport.TitleSafeArea.X, Game.GraphicsDevice.Viewport.TitleSafeArea.Y + Game.GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
33
34 ActorFactory.CreateMainShip(playerPosition);
35 ActorFactory.CreateShip(Ship.Polarity.Positive, new Vector2(200, 200));
36 ActorFactory.CreateShip(Ship.Polarity.Negative, new Vector2(400, 200));
37 ActorFactory.CreateScout(Ship.Polarity.Negative, new Vector2(500, 500));
38 ActorFactory.CreateCruiser(Ship.Polarity.Positive, new Vector2(40, 40));
39 }
40
41 public override void Update(GameTime gameTime)
42 {
43 InputController.UpdateInput();
44 ActorManager.Update(gameTime);
45 generatorTest.Update(gameTime);
46 }
47
48 public override void Draw(SpriteBatch spriteBatch)
49 {
50 Renderer.Draw(spriteBatch);
51 }
52 }
53 }