The TTY keyboard driver requires a robust cleanup method to avoid
hogging the keyboard/console after the process exists. Without
this, it does not make sense to use enable this driver.
public static void Main(string[] args)
{
Trace.Listeners.Add(new ConsoleTraceListener());
+ using (Toolkit.Init())
+ {
+ while (true)
+ {
+ var state = OpenTK.Input.Keyboard.GetState();
+ if (!state.IsConnected)
+ {
+ break;
+ }
+ else if (state.IsKeyDown(OpenTK.Input.Key.Escape))
+ {
+ break;
+ }
+ }
+ }
+ return;
+
Tests.GameWindowStates.Main();
return;
IJoystickDriver2 JoystickDriver;
IKeyboardDriver2 KeyboardDriver;
+ IMouseDriver2 MouseDriver;
const string gpu_path = "/dev/dri"; // card0, card1, ...
{
lock (this)
{
- KeyboardDriver = KeyboardDriver ??
- // Todo: use LinuxInput driver if available?
- (IKeyboardDriver2)new LinuxKeyboardTTY();
+ KeyboardDriver = KeyboardDriver ?? new LinuxInput();
return KeyboardDriver;
}
}
namespace OpenTK.Platform.Linux
{
+ // Todo: this has terrible side-effects on process exit
+ // (the keyboard remains tied up.) We need to find a
+ // proper way to clean up after ourselves, even in case
+ // of a crash.
+ #if EXPERIMENTAL
class LinuxKeyboardTTY : IKeyboardDriver2, IDisposable
{
const int stdin = 0; // STDIN_FILENO
#endregion
}
+ #endif
}