-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGame1.cs
More file actions
61 lines (52 loc) · 1.75 KB
/
Game1.cs
File metadata and controls
61 lines (52 loc) · 1.75 KB
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
using Dungeon_Delvers.Managers;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace Dungeon_Delvers
{
public class Game1 : Game
{
private GraphicsDeviceManager _graphics;
private SpriteBatch _spriteBatch;
private GameManager _gameManager;
public Game1()
{
_graphics = new GraphicsDeviceManager(this);
_graphics.PreparingDeviceSettings += (sender, e) =>
{
e.GraphicsDeviceInformation.PresentationParameters.PresentationInterval = PresentInterval.Two;
};
Content.RootDirectory = "Content";
IsMouseVisible = false;
}
protected override void Initialize()
{
Window.Title = "Dungeon Delvers";
base.Initialize();
}
protected override void LoadContent()
{
_spriteBatch = new SpriteBatch(GraphicsDevice);
Globals.sprites = _spriteBatch;
Globals.content = Content;
Globals.Bounds = new(1024, 768);
_gameManager = new GameManager();
}
protected override void Update(GameTime gameTime)
{
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
Exit();
Globals.Update(gameTime);
_gameManager.Update();
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.SlateGray);
_spriteBatch.Begin();
_gameManager.Draw();
_spriteBatch.End();
base.Draw(gameTime);
}
}
}