root/src/AIDemos/Screens/Demos/DemoGameScreen.cs
| 3 | 23 | ||
|---|---|---|---|
7 | using Microsoft.Xna.Framework.Content; | 7 | using Microsoft.Xna.Framework.Content; |
8 | using Microsoft.Xna.Framework; | 8 | using Microsoft.Xna.Framework; |
9 | using Microsoft.Xna.Framework.Input; | 9 | using Microsoft.Xna.Framework.Input; |
10 | using Brains.Framework; | ||
10 | 11 | ||
11 | namespace AIDemos.Screens.Demos | 12 | namespace AIDemos.Screens.Demos |
12 | { | 13 | { |
... | ... | ||
17 | 18 | ||
18 | protected SpriteFont gameFont; | 19 | protected SpriteFont gameFont; |
19 | protected SpriteFont titleFont; | 20 | protected SpriteFont titleFont; |
21 | protected AIEngine _engine; | ||
20 | public string Title { get; set; } | 22 | public string Title { get; set; } |
21 | public string Description{ get; set; } | 23 | public string Description{ get; set; } |
22 | public DemoGameScreen() | 24 | public DemoGameScreen(string title,string description) |
23 | { | 25 | { |
26 | Title = title; | ||
27 | Description = description; | ||
24 | } | 28 | } |
29 | protected void CenterCamOnMap() | ||
30 | { | ||
31 | primitiveBatch.CameraPosition = new Vector2( | ||
32 | -ScreenManager.GraphicsDevice.Viewport.Width / 2 + | ||
33 | _engine.World.Map.ClusterGrid.Grids[0].Width / 2, | ||
34 | -ScreenManager.GraphicsDevice.Viewport.Height / 2 + | ||
35 | _engine.World.Map.ClusterGrid.Grids[0].Height / 2); | ||
25 | 36 | ||
37 | } | ||
26 | public override void LoadContent() | 38 | public override void LoadContent() |
27 | { | 39 | { |
28 | if (content == null) | 40 | if (content == null) |
... | ... | ||
31 | gameFont = content.Load<SpriteFont>("gamefont"); | 43 | gameFont = content.Load<SpriteFont>("gamefont"); |
32 | titleFont= content.Load<SpriteFont>("titlefont"); | 44 | titleFont= content.Load<SpriteFont>("titlefont"); |
33 | primitiveBatch = new PrimitiveBatch(ScreenManager.GraphicsDevice); | 45 | primitiveBatch = new PrimitiveBatch(ScreenManager.GraphicsDevice); |
46 | |||
47 | _engine = new AIEngine(); | ||
48 | |||
34 | } | 49 | } |
35 | 50 | ||
36 | public override void Draw(Microsoft.Xna.Framework.GameTime gameTime) | 51 | public override void Draw(Microsoft.Xna.Framework.GameTime gameTime) |
Download diff