Skip to content
This repository
Browse code

Implemented KeyDown and KeyUp events for Sdl2NativeWindow.

  • Loading branch information...
commit f851d8887c477f1f983a97d78930f3c75cef15ab 1 parent 3853280
Elias Holzer azeno authored

Showing 1 changed file with 9 additions and 0 deletions. Show diff stats Hide diff stats

  1. +9 0 Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs
9 Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs
@@ -214,6 +214,15 @@ static void ProcessKeyEvent(Sdl2NativeWindow window, Event ev)
214 214 {
215 215 bool key_pressed = ev.Key.State == State.Pressed;
216 216 var key = ev.Key.Keysym;
  217 + var args = new KeyboardKeyEventArgs()
  218 + {
  219 + Key = TranslateKey(key.Scancode),
  220 + ScanCode = (uint)key.Scancode
  221 + };
  222 + if (key_pressed)
  223 + window.KeyDown(window, args);
  224 + else
  225 + window.KeyUp(window, args);
217 226 //window.keyboard.SetKey(TranslateKey(key.scancode), (uint)key.scancode, key_pressed);
218 227 }
219 228

0 comments on commit f851d88

Please sign in to comment.
Something went wrong with that request. Please try again.