'Strange behaviour from OpenTK
So I had some code that temporarily ran, I'm just trying to create the most basic hello window in C# OpenTK but what happens is I've created something that is meant to close when i press escape but it has only worked once . From now it doesn't work whenever I run the code the window opens and then closes immediately, I can't see why this shouldn't work.
using OpenTK.Windowing.Common;
using OpenTK.Windowing.Desktop;
using OpenTK.Windowing.GraphicsLibraryFramework;
class Program{
public static void Main(){
// Window declaration
var gw = new GameWindow(GameWindowSettings.Default, NativeWindowSettings.Default);
gw.UpdateFrame += delegate(FrameEventArgs eventArgs)
{
var input = gw.KeyboardState;
if (input.IsKeyDown(Keys.Escape)) gw.Close();
};
// Running the application
gw.Run();
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
