This repository has been archived by the owner on Jun 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainGame.cs
73 lines (53 loc) · 2.11 KB
/
MainGame.cs
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using BloodyPath.Models;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace BloodyPath;
public class MainGame : Game
{
private readonly MainMenu MainMenu = new();
private readonly BattleField BattleField = new();
private readonly VisibilityScreens VisibilityScreens = new();
private readonly MusicManager MusicManager = new();
private readonly GraphicsDeviceManager Graphics;
private SpriteBatch SpriteBatch;
public MainGame()
{
Graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
// Graphics.IsFullScreen = true;
Graphics.PreferredBackBufferWidth = 800;
Graphics.PreferredBackBufferHeight = 600;
Graphics.ApplyChanges();
MediaPlayer.Volume = 0.5f;
IsMouseVisible = true;
}
protected override void Initialize() => base.Initialize();
protected override void LoadContent()
{
SpriteBatch = new SpriteBatch(GraphicsDevice);
MusicManager.LoadContent(Content.Load<Song>(@"Music\ve3xone - Midnight Melodies"),
Content.Load<Song>(@"Music\ve3xone - Neon Forest"));
MainMenu.Screen = new (this, VisibilityScreens, MusicManager);
MainMenu.ScreenDrawer = new(MainMenu.Screen);
MainMenu.ScreenController = new(MainMenu.Screen);
BattleField.Screen = new (this, VisibilityScreens, MusicManager);
BattleField.ScreenDrawer = new(BattleField.Screen);
BattleField.ScreenController = new(BattleField.Screen);
}
protected override void Update(GameTime gameTime)
{
var keyboardState = Keyboard.GetState();
MainMenu.ScreenController.Update(gameTime);
BattleField.ScreenController.Update(gameTime,keyboardState);
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
MainMenu.ScreenDrawer.Draw(SpriteBatch);
BattleField.ScreenDrawer.Draw(SpriteBatch);
base.Draw(gameTime);
}
}