forked from flavius-st/TheAdventure
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
40 lines (32 loc) · 1.03 KB
/
Program.cs
File metadata and controls
40 lines (32 loc) · 1.03 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
using System.Diagnostics;
using Silk.NET.SDL;
namespace TheAdventure;
public static class Program
{
public static void Main()
{
var sdl = new Sdl(new SdlContext());
var sdlInitResult = sdl.Init(Sdl.InitVideo | Sdl.InitEvents | Sdl.InitTimer | Sdl.InitGamecontroller |
Sdl.InitJoystick);
if (sdlInitResult < 0)
{
throw new InvalidOperationException("Failed to initialize SDL.");
}
using (var window = new GameWindow(sdl, 800, 480))
{
var renderer = new GameRenderer(sdl, window);
var input = new Input(sdl, window, renderer);
var engine = new Engine(renderer, input);
engine.InitializeWorld();
bool quit = false;
while (!quit)
{
quit = input.ProcessInput();
if (quit) break;
engine.ProcessFrame();
engine.RenderFrame();
}
}
sdl.Quit();
}
}