-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppWindow.cs
More file actions
36 lines (27 loc) · 889 Bytes
/
AppWindow.cs
File metadata and controls
36 lines (27 loc) · 889 Bytes
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
using Silk.NET.Core.Contexts;
using Silk.NET.Windowing;
using Monitor = Silk.NET.Windowing.Monitor;
namespace BgfxEngine;
public class AppWindow
{
private IWindow _window;
public Action<IWindow> OnLoad { get; set; }
public IWindow SilkWindow => _window;
public INativeWindow NativeWindow => _window.Native!;
public AppWindow()
{
WindowOptions options = WindowOptions.Default;
options.Title = "BGFX Engine";
options.Size = new(1280, 720);
options.VSync = true;
_window = Window.Create(options);
_window.Load += () => OnLoad?.Invoke(_window);
_window.Initialize();
_window.Monitor = Monitor.GetMonitors(null).Last();
_window.Position = _window.Monitor.Bounds.Center - _window.Size / 2;
}
public void Run()
{
_window.Run();
}
}