To create a window I got to find two approaches:
1.- With the brand new GLFW-based windowing and intput systems:
class Program {
static unsafe void Main(string[] args) {
GLFW.Init();
Window* window = GLFW.CreateWindow(800, 800, "GLFW", null, null);
while (!GLFW.WindowShouldClose(window)) {
GLFW.SwapBuffers(window);
GLFW.PollEvents();
}
}
2.- With the creating window tutorial approach here, changing the code a bit.
class Program {
static unsafe void Main(string[] args) {
using (Game game = new Game(800, 600, "LearnOpenTK")) {
//Run takes a double, which is how many frames per second it should strive to reach.
//You can leave that out and it'll just update as fast as the hardware will allow it.
game.Run();
}
}
}
Being the Game class (code slightly corrected from the tutorial source):
public class Game: GameWindow
{
public Game(int width, int height, string title) : base(GameWindowSettings.Default, NativeWindowSettings.Default) { }
protected override void OnUpdateFrame(FrameEventArgs e) {
//KeyboardState input = Keyboard.GetState();
if (IsKeyDown(Keys.Escape))
{
//Exit();
Close();
}
base.OnUpdateFrame(e);
}
}
In one hand I am familiar with the GLFW library and input system from some c++ adventures, but not though with the idea of handling unsafe code. Although I might be familiar with c++ memory management and pointers, I am not with c#. Moreover this is a very mature window + input library.
On the other, the openTK windowing + input approach seems to be very simple, the one adviced in the tutorial and apparently better embedded in openTK overall.
Any caveats or pros and cons about the facts that might support one windowing + input system or the other?