forked from ComputerScienceHouse/devcade-game-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
81 lines (62 loc) · 2.16 KB
/
Program.cs
File metadata and controls
81 lines (62 loc) · 2.16 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
74
75
76
77
78
79
80
81
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Devcade;
namespace YourGameName // Replace "YourGameName" with your actual game name
{
public class Game1 : Game
{
private GraphicsDeviceManager _graphics;
private SpriteBatch _spriteBatch;
private Rectangle windowSize;
public Game1()
{
_graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
IsMouseVisible = false;
}
protected override void Initialize()
{
Input.Initialize();
// Set window size or full screen based on your requirements
#if DEBUG
_graphics.PreferredBackBufferWidth = 800;
_graphics.PreferredBackBufferHeight = 600;
_graphics.ApplyChanges();
#else
_graphics.IsFullScreen = true;
_graphics.ApplyChanges();
#endif
windowSize = GraphicsDevice.Viewport.Bounds;
base.Initialize();
}
protected override void LoadContent()
{
_spriteBatch = new SpriteBatch(GraphicsDevice);
// Load your game content here
// Example: Load a texture
// var texture = Content.Load<Texture2D>("fileNameWithoutExtension");
}
protected override void Update(GameTime gameTime)
{
Input.Update();
// Add your game logic here
// Example: Check for player input
if (Input.IsKeyPressed(Keys.Space))
{
// Perform some action when the Space key is pressed
}
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
_spriteBatch.Begin();
// Add your drawing code here
// Example: Draw a texture
// _spriteBatch.Draw(texture, Vector2.Zero, Color.White);
_spriteBatch.End();
base.Draw(gameTime);
}
}
}