-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGame1.cs
More file actions
73 lines (55 loc) · 2.04 KB
/
Game1.cs
File metadata and controls
73 lines (55 loc) · 2.04 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
62
63
64
65
66
67
68
69
70
71
72
73
using Amber.Engine;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace Amber;
public class Game1 : Game
{
private GraphicsDeviceManager _graphics;
private SpriteBatch _spriteBatch;
private Sprite _test;
public Game1()
{
_graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
IsMouseVisible = true;
}
protected override void Initialize()
{
base.Initialize();
}
protected override void LoadContent()
{
_spriteBatch = new SpriteBatch(GraphicsDevice);
TextureManager.LoadTexture(Content, "Sprites/Player/player_sprite", "player_sprite");
TextureManager.LoadTexture(Content, "Sprites/Player/testing_sprite", "testing_sprite");
_test = new Sprite(TextureManager.GetTexture("testing_sprite"), 4, 8);
_test.RegisterAnimation(0, 8);
_test.RegisterAnimation(1, 4);
_test.RegisterAnimation(2, 8);
_test.RegisterAnimation(3, 4);
EntityManager.AddEntity(new Player(), "boi");
EntityManager.NewEntity("floor");
EntityManager.GetEntity("floor").Position = new Vector2(0.0f, 200.0f);
EntityManager.GetEntity("floor").isRigid = true;
EntityManager.GetEntity("boi").hitbox = new Hitbox();
EntityManager.GetEntity("floor").hitbox = new Hitbox();
}
protected override void Update(GameTime gameTime)
{
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
Exit();
// TODO: Add your update logic here
EntityManager.UpdateAll();
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
_spriteBatch.Begin();
_test.DrawTexture(_spriteBatch, Vector2.Zero);
EntityManager.DrawAll(_spriteBatch);
_spriteBatch.End();
base.Draw(gameTime);
}
}