public static Keys ToXNA(ref SDL.SDL_Keysym key) { Keys retVal; if (UseScancodes) { if (INTERNAL_scanMap.TryGetValue((int)key.scancode, out retVal)) { return(retVal); } } else { if (INTERNAL_keyMap.TryGetValue((int)key.sym, out retVal)) { return(retVal); } } FNAPlatform.Log( "KEY/SCANCODE MISSING FROM SDL2->XNA DICTIONARY: " + key.sym.ToString() + " " + key.scancode.ToString() ); return(Keys.None); }
public virtual void KeyDown(SDL.SDL_Keysym key) { if (key.scancode == SDL.SDL_Scancode.SDL_SCANCODE_ESCAPE) { Close(false); } }
public virtual bool KeyDown(SDL.SDL_Keysym key) { if (key.scancode == SDL.SDL_Scancode.SDL_SCANCODE_ESCAPE) { Close(false); } return(true); }
private static void OnKeyboardDown(SDL.SDL_Keysym keysym) { SDL.SDL_Keycode sym = keysym.sym; // send all keyboard events to the Input static class if (sym == SDL.SDL_Keycode.SDLK_LSHIFT) { lshift = true; } else if (sym == SDL.SDL_Keycode.SDLK_RSHIFT) { rshift = true; } else if (sym == SDL.SDL_Keycode.SDLK_LCTRL) { lctrl = true; } else if (sym == SDL.SDL_Keycode.SDLK_RCTRL) { rctrl = true; } else if (sym == SDL.SDL_Keycode.SDLK_LALT) { lalt = true; } else if (sym == SDL.SDL_Keycode.SDLK_RALT) { ralt = true; } else if (sym == SDL.SDL_Keycode.SDLK_LEFT) { Input.AddKey((char)0, lshift || rshift, lctrl || rctrl, lalt || ralt); } else if (sym == SDL.SDL_Keycode.SDLK_RIGHT) { Input.AddKey((char)1, lshift || rshift, lctrl || rctrl, lalt || ralt); } else if (sym == SDL.SDL_Keycode.SDLK_UP) { Input.AddKey((char)2, lshift || rshift, lctrl || rctrl, lalt || ralt); } else if (sym == SDL.SDL_Keycode.SDLK_DOWN) { Input.AddKey((char)3, lshift || rshift, lctrl || rctrl, lalt || ralt); } else { Input.AddKey((char)sym, lshift || rshift, lctrl || rctrl, lalt || ralt); } Input.AddKeyRaw(keysym.scancode); }
private static void OnKeyboardUp(SDL.SDL_Keysym keysym) { SDL.SDL_Keycode sym = keysym.sym; // send all keyboard events to the Input static class if (sym == SDL.SDL_Keycode.SDLK_LSHIFT) { lshift = false; } else if (sym == SDL.SDL_Keycode.SDLK_RSHIFT) { rshift = false; } else if (sym == SDL.SDL_Keycode.SDLK_LCTRL) { lctrl = false; } else if (sym == SDL.SDL_Keycode.SDLK_RCTRL) { rctrl = false; } else if (sym == SDL.SDL_Keycode.SDLK_LALT) { lalt = false; } else if (sym == SDL.SDL_Keycode.SDLK_RALT) { ralt = false; } else if (sym == SDL.SDL_Keycode.SDLK_LEFT) { Input.RemoveKey((char)0); } else if (sym == SDL.SDL_Keycode.SDLK_RIGHT) { Input.RemoveKey((char)1); } else if (sym == SDL.SDL_Keycode.SDLK_UP) { Input.RemoveKey((char)2); } else if (sym == SDL.SDL_Keycode.SDLK_DOWN) { Input.RemoveKey((char)3); } else { Input.RemoveKey((char)sym); } Input.RemoveKeyRaw(keysym.scancode); }
/// <summary>Used by wizard fade in/out function.</summary> public bool KeyHandler(SDL.SDL_Keysym keysym) { throw new NotImplementedException(); // bool rc; //switch (keysym.sym) //{ //case SDLK_ESCAPE: // Mix_HaltChannel(viewer.fadChannel); // rc = oslink.main_menu(); // calls the meta-menu // Mix_Volume(viewer.fadChannel, 0); // Mix_PlayChannel(viewer.fadChannel, creature.buzz, -1); // return rc; //default: // return true; //} }
protected virtual void OnKeyDown(SDL.SDL_Keysym e) { }
private static Key MapKey(ref SDL.SDL_Keysym keysym) { switch (keysym.scancode) { case SDL.SDL_Scancode.SDL_SCANCODE_A: return(Key.A); case SDL.SDL_Scancode.SDL_SCANCODE_B: return(Key.B); case SDL.SDL_Scancode.SDL_SCANCODE_C: return(Key.C); case SDL.SDL_Scancode.SDL_SCANCODE_D: return(Key.D); case SDL.SDL_Scancode.SDL_SCANCODE_E: return(Key.E); case SDL.SDL_Scancode.SDL_SCANCODE_F: return(Key.F); case SDL.SDL_Scancode.SDL_SCANCODE_G: return(Key.G); case SDL.SDL_Scancode.SDL_SCANCODE_H: return(Key.H); case SDL.SDL_Scancode.SDL_SCANCODE_I: return(Key.I); case SDL.SDL_Scancode.SDL_SCANCODE_J: return(Key.J); case SDL.SDL_Scancode.SDL_SCANCODE_K: return(Key.K); case SDL.SDL_Scancode.SDL_SCANCODE_L: return(Key.L); case SDL.SDL_Scancode.SDL_SCANCODE_M: return(Key.M); case SDL.SDL_Scancode.SDL_SCANCODE_N: return(Key.N); case SDL.SDL_Scancode.SDL_SCANCODE_O: return(Key.O); case SDL.SDL_Scancode.SDL_SCANCODE_P: return(Key.P); case SDL.SDL_Scancode.SDL_SCANCODE_Q: return(Key.Q); case SDL.SDL_Scancode.SDL_SCANCODE_R: return(Key.R); case SDL.SDL_Scancode.SDL_SCANCODE_S: return(Key.S); case SDL.SDL_Scancode.SDL_SCANCODE_T: return(Key.T); case SDL.SDL_Scancode.SDL_SCANCODE_U: return(Key.U); case SDL.SDL_Scancode.SDL_SCANCODE_V: return(Key.V); case SDL.SDL_Scancode.SDL_SCANCODE_W: return(Key.W); case SDL.SDL_Scancode.SDL_SCANCODE_X: return(Key.X); case SDL.SDL_Scancode.SDL_SCANCODE_Y: return(Key.Y); case SDL.SDL_Scancode.SDL_SCANCODE_Z: return(Key.Z); case SDL.SDL_Scancode.SDL_SCANCODE_1: return(Key.Number1); case SDL.SDL_Scancode.SDL_SCANCODE_2: return(Key.Number2); case SDL.SDL_Scancode.SDL_SCANCODE_3: return(Key.Number3); case SDL.SDL_Scancode.SDL_SCANCODE_4: return(Key.Number4); case SDL.SDL_Scancode.SDL_SCANCODE_5: return(Key.Number5); case SDL.SDL_Scancode.SDL_SCANCODE_6: return(Key.Number6); case SDL.SDL_Scancode.SDL_SCANCODE_7: return(Key.Number7); case SDL.SDL_Scancode.SDL_SCANCODE_8: return(Key.Number8); case SDL.SDL_Scancode.SDL_SCANCODE_9: return(Key.Number9); case SDL.SDL_Scancode.SDL_SCANCODE_0: return(Key.Number0); case SDL.SDL_Scancode.SDL_SCANCODE_RETURN: return(Key.Enter); case SDL.SDL_Scancode.SDL_SCANCODE_ESCAPE: return(Key.Escape); case SDL.SDL_Scancode.SDL_SCANCODE_BACKSPACE: return(Key.BackSpace); case SDL.SDL_Scancode.SDL_SCANCODE_TAB: return(Key.Tab); case SDL.SDL_Scancode.SDL_SCANCODE_SPACE: return(Key.Space); case SDL.SDL_Scancode.SDL_SCANCODE_MINUS: return(Key.Minus); case SDL.SDL_Scancode.SDL_SCANCODE_EQUALS: return(Key.Plus); case SDL.SDL_Scancode.SDL_SCANCODE_LEFTBRACKET: return(Key.BracketLeft); case SDL.SDL_Scancode.SDL_SCANCODE_RIGHTBRACKET: return(Key.BracketRight); case SDL.SDL_Scancode.SDL_SCANCODE_BACKSLASH: return(Key.BackSlash); case SDL.SDL_Scancode.SDL_SCANCODE_SEMICOLON: return(Key.Semicolon); case SDL.SDL_Scancode.SDL_SCANCODE_APOSTROPHE: return(Key.Quote); case SDL.SDL_Scancode.SDL_SCANCODE_GRAVE: return(Key.Grave); case SDL.SDL_Scancode.SDL_SCANCODE_COMMA: return(Key.Comma); case SDL.SDL_Scancode.SDL_SCANCODE_PERIOD: return(Key.Period); case SDL.SDL_Scancode.SDL_SCANCODE_SLASH: return(Key.Slash); case SDL.SDL_Scancode.SDL_SCANCODE_CAPSLOCK: return(Key.CapsLock); case SDL.SDL_Scancode.SDL_SCANCODE_F1: return(Key.F1); case SDL.SDL_Scancode.SDL_SCANCODE_F2: return(Key.F2); case SDL.SDL_Scancode.SDL_SCANCODE_F3: return(Key.F3); case SDL.SDL_Scancode.SDL_SCANCODE_F4: return(Key.F4); case SDL.SDL_Scancode.SDL_SCANCODE_F5: return(Key.F5); case SDL.SDL_Scancode.SDL_SCANCODE_F6: return(Key.F6); case SDL.SDL_Scancode.SDL_SCANCODE_F7: return(Key.F7); case SDL.SDL_Scancode.SDL_SCANCODE_F8: return(Key.F8); case SDL.SDL_Scancode.SDL_SCANCODE_F9: return(Key.F9); case SDL.SDL_Scancode.SDL_SCANCODE_F10: return(Key.F10); case SDL.SDL_Scancode.SDL_SCANCODE_F11: return(Key.F11); case SDL.SDL_Scancode.SDL_SCANCODE_F12: return(Key.F12); case SDL.SDL_Scancode.SDL_SCANCODE_PRINTSCREEN: return(Key.PrintScreen); case SDL.SDL_Scancode.SDL_SCANCODE_SCROLLLOCK: return(Key.ScrollLock); case SDL.SDL_Scancode.SDL_SCANCODE_PAUSE: return(Key.Pause); case SDL.SDL_Scancode.SDL_SCANCODE_INSERT: return(Key.Insert); case SDL.SDL_Scancode.SDL_SCANCODE_HOME: return(Key.Home); case SDL.SDL_Scancode.SDL_SCANCODE_PAGEUP: return(Key.PageUp); case SDL.SDL_Scancode.SDL_SCANCODE_DELETE: return(Key.Delete); case SDL.SDL_Scancode.SDL_SCANCODE_END: return(Key.End); case SDL.SDL_Scancode.SDL_SCANCODE_PAGEDOWN: return(Key.PageDown); case SDL.SDL_Scancode.SDL_SCANCODE_RIGHT: return(Key.Right); case SDL.SDL_Scancode.SDL_SCANCODE_LEFT: return(Key.Left); case SDL.SDL_Scancode.SDL_SCANCODE_DOWN: return(Key.Down); case SDL.SDL_Scancode.SDL_SCANCODE_UP: return(Key.Up); case SDL.SDL_Scancode.SDL_SCANCODE_NUMLOCKCLEAR: return(Key.NumLock); case SDL.SDL_Scancode.SDL_SCANCODE_KP_DIVIDE: return(Key.KeypadDivide); case SDL.SDL_Scancode.SDL_SCANCODE_KP_MULTIPLY: return(Key.KeypadMultiply); case SDL.SDL_Scancode.SDL_SCANCODE_KP_MINUS: return(Key.KeypadMinus); case SDL.SDL_Scancode.SDL_SCANCODE_KP_PLUS: return(Key.KeypadPlus); case SDL.SDL_Scancode.SDL_SCANCODE_KP_ENTER: return(Key.KeypadEnter); case SDL.SDL_Scancode.SDL_SCANCODE_KP_1: return(Key.Keypad1); case SDL.SDL_Scancode.SDL_SCANCODE_KP_2: return(Key.Keypad2); case SDL.SDL_Scancode.SDL_SCANCODE_KP_3: return(Key.Keypad3); case SDL.SDL_Scancode.SDL_SCANCODE_KP_4: return(Key.Keypad4); case SDL.SDL_Scancode.SDL_SCANCODE_KP_5: return(Key.Keypad5); case SDL.SDL_Scancode.SDL_SCANCODE_KP_6: return(Key.Keypad6); case SDL.SDL_Scancode.SDL_SCANCODE_KP_7: return(Key.Keypad7); case SDL.SDL_Scancode.SDL_SCANCODE_KP_8: return(Key.Keypad8); case SDL.SDL_Scancode.SDL_SCANCODE_KP_9: return(Key.Keypad9); case SDL.SDL_Scancode.SDL_SCANCODE_KP_0: return(Key.Keypad0); case SDL.SDL_Scancode.SDL_SCANCODE_KP_PERIOD: return(Key.KeypadPeriod); case SDL.SDL_Scancode.SDL_SCANCODE_NONUSBACKSLASH: return(Key.NonUSBackSlash); case SDL.SDL_Scancode.SDL_SCANCODE_KP_EQUALS: return(Key.KeypadPlus); case SDL.SDL_Scancode.SDL_SCANCODE_F13: return(Key.F13); case SDL.SDL_Scancode.SDL_SCANCODE_F14: return(Key.F14); case SDL.SDL_Scancode.SDL_SCANCODE_F15: return(Key.F15); case SDL.SDL_Scancode.SDL_SCANCODE_F16: return(Key.F16); case SDL.SDL_Scancode.SDL_SCANCODE_F17: return(Key.F17); case SDL.SDL_Scancode.SDL_SCANCODE_F18: return(Key.F18); case SDL.SDL_Scancode.SDL_SCANCODE_F19: return(Key.F19); case SDL.SDL_Scancode.SDL_SCANCODE_F20: return(Key.F20); case SDL.SDL_Scancode.SDL_SCANCODE_F21: return(Key.F21); case SDL.SDL_Scancode.SDL_SCANCODE_F22: return(Key.F22); case SDL.SDL_Scancode.SDL_SCANCODE_F23: return(Key.F23); case SDL.SDL_Scancode.SDL_SCANCODE_F24: return(Key.F24); case SDL.SDL_Scancode.SDL_SCANCODE_MENU: return(Key.Menu); case SDL.SDL_Scancode.SDL_SCANCODE_LCTRL: return(Key.ControlLeft); case SDL.SDL_Scancode.SDL_SCANCODE_LSHIFT: return(Key.ShiftLeft); case SDL.SDL_Scancode.SDL_SCANCODE_LALT: return(Key.AltLeft); case SDL.SDL_Scancode.SDL_SCANCODE_RCTRL: return(Key.ControlRight); case SDL.SDL_Scancode.SDL_SCANCODE_RSHIFT: return(Key.ShiftRight); case SDL.SDL_Scancode.SDL_SCANCODE_RALT: return(Key.AltRight); default: return(Key.Unknown); } }
public bool KeyUp(SDL.SDL_Keysym key) => true;
public virtual void KeyUp(SDL.SDL_Keysym key) { }
protected virtual void OnKeyUp(SDL.SDL_Keysym e) { }
public void KeyDown(SDL.SDL_Keysym key) { var ctrl = (key.mod & SDL.SDL_Keymod.KMOD_CTRL) != 0; var shift = (key.mod & SDL.SDL_Keymod.KMOD_SHIFT) != 0; switch (key.scancode) { case SDL.SDL_Scancode.SDL_SCANCODE_BACKSPACE: if (selectionAnchor != caret) { DeleteSelected(); } else if (caret > 0) { var removeFrom = caret; if (ctrl) { var stopOnNextNonLetter = false; while (removeFrom > 0) { removeFrom--; if (char.IsLetterOrDigit(text[removeFrom])) { stopOnNextNonLetter = true; } else if (stopOnNextNonLetter) { removeFrom++; break; } } } else { removeFrom--; } AddEditHistory(EditHistoryEvent.Delete); text = text.Remove(removeFrom, caret - removeFrom); SetCaret(removeFrom); } break; case SDL.SDL_Scancode.SDL_SCANCODE_DELETE: if (selectionAnchor != caret) { DeleteSelected(); } else if (caret < text.Length) { AddEditHistory(EditHistoryEvent.Delete); text = text.Remove(caret, 1); } break; case SDL.SDL_Scancode.SDL_SCANCODE_RETURN: case SDL.SDL_Scancode.SDL_SCANCODE_RETURN2: case SDL.SDL_Scancode.SDL_SCANCODE_KP_ENTER: InputSystem.Instance.SetKeyboardFocus(null); break; case SDL.SDL_Scancode.SDL_SCANCODE_LEFT: if (shift) { SetCaret(caret - 1, selectionAnchor); } else { SetCaret(selectionAnchor == caret ? caret - 1 : Math.Min(selectionAnchor, caret)); } break; case SDL.SDL_Scancode.SDL_SCANCODE_RIGHT: if (shift) { SetCaret(caret + 1, selectionAnchor); } else { SetCaret(selectionAnchor == caret ? caret + 1 : Math.Max(selectionAnchor, caret)); } break; case SDL.SDL_Scancode.SDL_SCANCODE_HOME: SetCaret(0, shift ? selectionAnchor : 0); break; case SDL.SDL_Scancode.SDL_SCANCODE_END: SetCaret(int.MaxValue, shift ? selectionAnchor : int.MaxValue); break; case SDL.SDL_Scancode.SDL_SCANCODE_V when ctrl && SDL.SDL_HasClipboardText() == SDL.SDL_bool.SDL_TRUE: TextInput(SDL.SDL_GetClipboardText()); break; case SDL.SDL_Scancode.SDL_SCANCODE_C when ctrl && selectionAnchor != caret: SDL.SDL_SetClipboardText(selectedText); break; case SDL.SDL_Scancode.SDL_SCANCODE_X when ctrl && selectionAnchor != caret: SDL.SDL_SetClipboardText(selectedText); DeleteSelected(); break; case SDL.SDL_Scancode.SDL_SCANCODE_Z when ctrl && editHistory != null && editHistory.Count > 0: text = editHistory.Pop(); SetCaret(text.Length); lastEvent = EditHistoryEvent.None; break; case SDL.SDL_Scancode.SDL_SCANCODE_A when ctrl: SetCaret(text.Length, 0); break; } }
protected override void OnKeyDown(SDL.SDL_Keysym e) { HandleController(e.sym, true); }
protected override void OnKeyUp(SDL.SDL_Keysym e) { HandleController(e.sym, false); }
public override void KeyDown(SDL.SDL_Keysym key) { contents.SetTextInputFocus(searchBox, list.filter.query); base.KeyDown(key); }
public static Key ToKey(this SDL.SDL_Keysym sdlKeysym) { switch (sdlKeysym.sym) { default: case SDL.SDL_Keycode.SDLK_UNKNOWN: return(Key.Unknown); case SDL.SDL_Keycode.SDLK_KP_COMMA: return(Key.Comma); case SDL.SDL_Keycode.SDLK_KP_TAB: return(Key.Tab); case SDL.SDL_Keycode.SDLK_KP_BACKSPACE: return(Key.BackSpace); case SDL.SDL_Keycode.SDLK_KP_A: return(Key.A); case SDL.SDL_Keycode.SDLK_KP_B: return(Key.B); case SDL.SDL_Keycode.SDLK_KP_C: return(Key.C); case SDL.SDL_Keycode.SDLK_KP_D: return(Key.D); case SDL.SDL_Keycode.SDLK_KP_E: return(Key.E); case SDL.SDL_Keycode.SDLK_KP_F: return(Key.F); case SDL.SDL_Keycode.SDLK_KP_SPACE: return(Key.Space); case SDL.SDL_Keycode.SDLK_KP_CLEAR: return(Key.Clear); case SDL.SDL_Keycode.SDLK_RETURN: return(Key.Enter); case SDL.SDL_Keycode.SDLK_ESCAPE: return(Key.Escape); case SDL.SDL_Keycode.SDLK_BACKSPACE: return(Key.BackSpace); case SDL.SDL_Keycode.SDLK_TAB: return(Key.Tab); case SDL.SDL_Keycode.SDLK_SPACE: return(Key.Space); case SDL.SDL_Keycode.SDLK_QUOTE: return(Key.Quote); case SDL.SDL_Keycode.SDLK_COMMA: return(Key.Comma); case SDL.SDL_Keycode.SDLK_MINUS: return(Key.Minus); case SDL.SDL_Keycode.SDLK_PERIOD: return(Key.Period); case SDL.SDL_Keycode.SDLK_SLASH: return(Key.Slash); case SDL.SDL_Keycode.SDLK_0: return(Key.Number0); case SDL.SDL_Keycode.SDLK_1: return(Key.Number1); case SDL.SDL_Keycode.SDLK_2: return(Key.Number2); case SDL.SDL_Keycode.SDLK_3: return(Key.Number3); case SDL.SDL_Keycode.SDLK_4: return(Key.Number4); case SDL.SDL_Keycode.SDLK_5: return(Key.Number5); case SDL.SDL_Keycode.SDLK_6: return(Key.Number6); case SDL.SDL_Keycode.SDLK_7: return(Key.Number7); case SDL.SDL_Keycode.SDLK_8: return(Key.Number8); case SDL.SDL_Keycode.SDLK_9: return(Key.Number9); case SDL.SDL_Keycode.SDLK_SEMICOLON: return(Key.Semicolon); case SDL.SDL_Keycode.SDLK_EQUALS: return(Key.Plus); case SDL.SDL_Keycode.SDLK_LEFTBRACKET: return(Key.BracketLeft); case SDL.SDL_Keycode.SDLK_BACKSLASH: return(Key.BackSlash); case SDL.SDL_Keycode.SDLK_RIGHTBRACKET: return(Key.BracketRight); case SDL.SDL_Keycode.SDLK_BACKQUOTE: return(Key.Tilde); case SDL.SDL_Keycode.SDLK_a: return(Key.A); case SDL.SDL_Keycode.SDLK_b: return(Key.B); case SDL.SDL_Keycode.SDLK_c: return(Key.C); case SDL.SDL_Keycode.SDLK_d: return(Key.D); case SDL.SDL_Keycode.SDLK_e: return(Key.E); case SDL.SDL_Keycode.SDLK_f: return(Key.F); case SDL.SDL_Keycode.SDLK_g: return(Key.G); case SDL.SDL_Keycode.SDLK_h: return(Key.H); case SDL.SDL_Keycode.SDLK_i: return(Key.I); case SDL.SDL_Keycode.SDLK_j: return(Key.J); case SDL.SDL_Keycode.SDLK_k: return(Key.K); case SDL.SDL_Keycode.SDLK_l: return(Key.L); case SDL.SDL_Keycode.SDLK_m: return(Key.M); case SDL.SDL_Keycode.SDLK_n: return(Key.N); case SDL.SDL_Keycode.SDLK_o: return(Key.O); case SDL.SDL_Keycode.SDLK_p: return(Key.P); case SDL.SDL_Keycode.SDLK_q: return(Key.Q); case SDL.SDL_Keycode.SDLK_r: return(Key.R); case SDL.SDL_Keycode.SDLK_s: return(Key.S); case SDL.SDL_Keycode.SDLK_t: return(Key.T); case SDL.SDL_Keycode.SDLK_u: return(Key.U); case SDL.SDL_Keycode.SDLK_v: return(Key.V); case SDL.SDL_Keycode.SDLK_w: return(Key.W); case SDL.SDL_Keycode.SDLK_x: return(Key.X); case SDL.SDL_Keycode.SDLK_y: return(Key.Y); case SDL.SDL_Keycode.SDLK_z: return(Key.Z); case SDL.SDL_Keycode.SDLK_CAPSLOCK: return(Key.CapsLock); case SDL.SDL_Keycode.SDLK_F1: return(Key.F1); case SDL.SDL_Keycode.SDLK_F2: return(Key.F2); case SDL.SDL_Keycode.SDLK_F3: return(Key.F3); case SDL.SDL_Keycode.SDLK_F4: return(Key.F4); case SDL.SDL_Keycode.SDLK_F5: return(Key.F5); case SDL.SDL_Keycode.SDLK_F6: return(Key.F6); case SDL.SDL_Keycode.SDLK_F7: return(Key.F7); case SDL.SDL_Keycode.SDLK_F8: return(Key.F8); case SDL.SDL_Keycode.SDLK_F9: return(Key.F9); case SDL.SDL_Keycode.SDLK_F10: return(Key.F10); case SDL.SDL_Keycode.SDLK_F11: return(Key.F11); case SDL.SDL_Keycode.SDLK_F12: return(Key.F12); case SDL.SDL_Keycode.SDLK_PRINTSCREEN: return(Key.PrintScreen); case SDL.SDL_Keycode.SDLK_SCROLLLOCK: return(Key.ScrollLock); case SDL.SDL_Keycode.SDLK_PAUSE: return(Key.Pause); case SDL.SDL_Keycode.SDLK_INSERT: return(Key.Insert); case SDL.SDL_Keycode.SDLK_HOME: return(Key.Home); case SDL.SDL_Keycode.SDLK_PAGEUP: return(Key.PageUp); case SDL.SDL_Keycode.SDLK_DELETE: return(Key.Delete); case SDL.SDL_Keycode.SDLK_END: return(Key.End); case SDL.SDL_Keycode.SDLK_PAGEDOWN: return(Key.PageDown); case SDL.SDL_Keycode.SDLK_RIGHT: return(Key.Right); case SDL.SDL_Keycode.SDLK_LEFT: return(Key.Left); case SDL.SDL_Keycode.SDLK_DOWN: return(Key.Down); case SDL.SDL_Keycode.SDLK_UP: return(Key.Up); case SDL.SDL_Keycode.SDLK_NUMLOCKCLEAR: return(Key.NumLock); case SDL.SDL_Keycode.SDLK_KP_DIVIDE: return(Key.KeypadDivide); case SDL.SDL_Keycode.SDLK_KP_MULTIPLY: return(Key.KeypadMultiply); case SDL.SDL_Keycode.SDLK_KP_MINUS: return(Key.KeypadMinus); case SDL.SDL_Keycode.SDLK_KP_PLUS: return(Key.KeypadPlus); case SDL.SDL_Keycode.SDLK_KP_ENTER: return(Key.KeypadEnter); case SDL.SDL_Keycode.SDLK_KP_1: return(Key.Keypad1); case SDL.SDL_Keycode.SDLK_KP_2: return(Key.Keypad2); case SDL.SDL_Keycode.SDLK_KP_3: return(Key.Keypad3); case SDL.SDL_Keycode.SDLK_KP_4: return(Key.Keypad4); case SDL.SDL_Keycode.SDLK_KP_5: return(Key.Keypad5); case SDL.SDL_Keycode.SDLK_KP_6: return(Key.Keypad6); case SDL.SDL_Keycode.SDLK_KP_7: return(Key.Keypad7); case SDL.SDL_Keycode.SDLK_KP_8: return(Key.Keypad8); case SDL.SDL_Keycode.SDLK_KP_9: return(Key.Keypad9); case SDL.SDL_Keycode.SDLK_KP_0: return(Key.Keypad0); case SDL.SDL_Keycode.SDLK_KP_PERIOD: return(Key.KeypadPeriod); case SDL.SDL_Keycode.SDLK_F13: return(Key.F13); case SDL.SDL_Keycode.SDLK_F14: return(Key.F14); case SDL.SDL_Keycode.SDLK_F15: return(Key.F15); case SDL.SDL_Keycode.SDLK_F16: return(Key.F16); case SDL.SDL_Keycode.SDLK_F17: return(Key.F17); case SDL.SDL_Keycode.SDLK_F18: return(Key.F18); case SDL.SDL_Keycode.SDLK_F19: return(Key.F19); case SDL.SDL_Keycode.SDLK_F20: return(Key.F20); case SDL.SDL_Keycode.SDLK_F21: return(Key.F21); case SDL.SDL_Keycode.SDLK_F22: return(Key.F22); case SDL.SDL_Keycode.SDLK_F23: return(Key.F23); case SDL.SDL_Keycode.SDLK_F24: return(Key.F24); case SDL.SDL_Keycode.SDLK_MENU: return(Key.Menu); case SDL.SDL_Keycode.SDLK_STOP: return(Key.Stop); case SDL.SDL_Keycode.SDLK_MUTE: return(Key.Mute); case SDL.SDL_Keycode.SDLK_VOLUMEUP: return(Key.VolumeUp); case SDL.SDL_Keycode.SDLK_VOLUMEDOWN: return(Key.VolumeDown); case SDL.SDL_Keycode.SDLK_CLEAR: return(Key.Clear); case SDL.SDL_Keycode.SDLK_DECIMALSEPARATOR: return(Key.KeypadDecimal); case SDL.SDL_Keycode.SDLK_LCTRL: return(Key.ControlLeft); case SDL.SDL_Keycode.SDLK_LSHIFT: return(Key.ShiftLeft); case SDL.SDL_Keycode.SDLK_LALT: return(Key.AltLeft); case SDL.SDL_Keycode.SDLK_LGUI: return(Key.WinLeft); case SDL.SDL_Keycode.SDLK_RCTRL: return(Key.ControlRight); case SDL.SDL_Keycode.SDLK_RSHIFT: return(Key.ShiftRight); case SDL.SDL_Keycode.SDLK_RALT: return(Key.AltRight); case SDL.SDL_Keycode.SDLK_RGUI: return(Key.WinRight); case SDL.SDL_Keycode.SDLK_AUDIONEXT: return(Key.TrackNext); case SDL.SDL_Keycode.SDLK_AUDIOPREV: return(Key.TrackPrevious); case SDL.SDL_Keycode.SDLK_AUDIOSTOP: return(Key.Stop); case SDL.SDL_Keycode.SDLK_AUDIOPLAY: return(Key.PlayPause); case SDL.SDL_Keycode.SDLK_AUDIOMUTE: return(Key.Mute); case SDL.SDL_Keycode.SDLK_SLEEP: return(Key.Sleep); } }
public override bool KeyDown(SDL.SDL_Keysym key) { contents.SetTextInputFocus(searchBox, list.filter.query); return(base.KeyDown(key)); }
public static Key ToKey(this SDL.SDL_Keysym sdlKeysym) { // Apple devices don't have the notion of NumLock (they have a Clear key instead). // treat them as if they always have NumLock on (the numpad always performs its primary actions). bool numLockOn = sdlKeysym.mod.HasFlagFast(SDL.SDL_Keymod.KMOD_NUM) || RuntimeInfo.IsApple; switch (sdlKeysym.scancode) { default: case SDL.SDL_Scancode.SDL_SCANCODE_UNKNOWN: return(Key.Unknown); case SDL.SDL_Scancode.SDL_SCANCODE_KP_COMMA: return(Key.Comma); case SDL.SDL_Scancode.SDL_SCANCODE_KP_TAB: return(Key.Tab); case SDL.SDL_Scancode.SDL_SCANCODE_KP_BACKSPACE: return(Key.BackSpace); case SDL.SDL_Scancode.SDL_SCANCODE_KP_A: return(Key.A); case SDL.SDL_Scancode.SDL_SCANCODE_KP_B: return(Key.B); case SDL.SDL_Scancode.SDL_SCANCODE_KP_C: return(Key.C); case SDL.SDL_Scancode.SDL_SCANCODE_KP_D: return(Key.D); case SDL.SDL_Scancode.SDL_SCANCODE_KP_E: return(Key.E); case SDL.SDL_Scancode.SDL_SCANCODE_KP_F: return(Key.F); case SDL.SDL_Scancode.SDL_SCANCODE_KP_SPACE: return(Key.Space); case SDL.SDL_Scancode.SDL_SCANCODE_KP_CLEAR: return(Key.Clear); case SDL.SDL_Scancode.SDL_SCANCODE_RETURN: return(Key.Enter); case SDL.SDL_Scancode.SDL_SCANCODE_ESCAPE: return(Key.Escape); case SDL.SDL_Scancode.SDL_SCANCODE_BACKSPACE: return(Key.BackSpace); case SDL.SDL_Scancode.SDL_SCANCODE_TAB: return(Key.Tab); case SDL.SDL_Scancode.SDL_SCANCODE_SPACE: return(Key.Space); case SDL.SDL_Scancode.SDL_SCANCODE_APOSTROPHE: return(Key.Quote); case SDL.SDL_Scancode.SDL_SCANCODE_COMMA: return(Key.Comma); case SDL.SDL_Scancode.SDL_SCANCODE_MINUS: return(Key.Minus); case SDL.SDL_Scancode.SDL_SCANCODE_PERIOD: return(Key.Period); case SDL.SDL_Scancode.SDL_SCANCODE_SLASH: return(Key.Slash); case SDL.SDL_Scancode.SDL_SCANCODE_0: return(Key.Number0); case SDL.SDL_Scancode.SDL_SCANCODE_1: return(Key.Number1); case SDL.SDL_Scancode.SDL_SCANCODE_2: return(Key.Number2); case SDL.SDL_Scancode.SDL_SCANCODE_3: return(Key.Number3); case SDL.SDL_Scancode.SDL_SCANCODE_4: return(Key.Number4); case SDL.SDL_Scancode.SDL_SCANCODE_5: return(Key.Number5); case SDL.SDL_Scancode.SDL_SCANCODE_6: return(Key.Number6); case SDL.SDL_Scancode.SDL_SCANCODE_7: return(Key.Number7); case SDL.SDL_Scancode.SDL_SCANCODE_8: return(Key.Number8); case SDL.SDL_Scancode.SDL_SCANCODE_9: return(Key.Number9); case SDL.SDL_Scancode.SDL_SCANCODE_SEMICOLON: return(Key.Semicolon); case SDL.SDL_Scancode.SDL_SCANCODE_EQUALS: return(Key.Plus); case SDL.SDL_Scancode.SDL_SCANCODE_LEFTBRACKET: return(Key.BracketLeft); case SDL.SDL_Scancode.SDL_SCANCODE_BACKSLASH: return(Key.BackSlash); case SDL.SDL_Scancode.SDL_SCANCODE_RIGHTBRACKET: return(Key.BracketRight); case SDL.SDL_Scancode.SDL_SCANCODE_GRAVE: return(Key.Tilde); case SDL.SDL_Scancode.SDL_SCANCODE_A: return(Key.A); case SDL.SDL_Scancode.SDL_SCANCODE_B: return(Key.B); case SDL.SDL_Scancode.SDL_SCANCODE_C: return(Key.C); case SDL.SDL_Scancode.SDL_SCANCODE_D: return(Key.D); case SDL.SDL_Scancode.SDL_SCANCODE_E: return(Key.E); case SDL.SDL_Scancode.SDL_SCANCODE_F: return(Key.F); case SDL.SDL_Scancode.SDL_SCANCODE_G: return(Key.G); case SDL.SDL_Scancode.SDL_SCANCODE_H: return(Key.H); case SDL.SDL_Scancode.SDL_SCANCODE_I: return(Key.I); case SDL.SDL_Scancode.SDL_SCANCODE_J: return(Key.J); case SDL.SDL_Scancode.SDL_SCANCODE_K: return(Key.K); case SDL.SDL_Scancode.SDL_SCANCODE_L: return(Key.L); case SDL.SDL_Scancode.SDL_SCANCODE_M: return(Key.M); case SDL.SDL_Scancode.SDL_SCANCODE_N: return(Key.N); case SDL.SDL_Scancode.SDL_SCANCODE_O: return(Key.O); case SDL.SDL_Scancode.SDL_SCANCODE_P: return(Key.P); case SDL.SDL_Scancode.SDL_SCANCODE_Q: return(Key.Q); case SDL.SDL_Scancode.SDL_SCANCODE_R: return(Key.R); case SDL.SDL_Scancode.SDL_SCANCODE_S: return(Key.S); case SDL.SDL_Scancode.SDL_SCANCODE_T: return(Key.T); case SDL.SDL_Scancode.SDL_SCANCODE_U: return(Key.U); case SDL.SDL_Scancode.SDL_SCANCODE_V: return(Key.V); case SDL.SDL_Scancode.SDL_SCANCODE_W: return(Key.W); case SDL.SDL_Scancode.SDL_SCANCODE_X: return(Key.X); case SDL.SDL_Scancode.SDL_SCANCODE_Y: return(Key.Y); case SDL.SDL_Scancode.SDL_SCANCODE_Z: return(Key.Z); case SDL.SDL_Scancode.SDL_SCANCODE_CAPSLOCK: return(Key.CapsLock); case SDL.SDL_Scancode.SDL_SCANCODE_F1: return(Key.F1); case SDL.SDL_Scancode.SDL_SCANCODE_F2: return(Key.F2); case SDL.SDL_Scancode.SDL_SCANCODE_F3: return(Key.F3); case SDL.SDL_Scancode.SDL_SCANCODE_F4: return(Key.F4); case SDL.SDL_Scancode.SDL_SCANCODE_F5: return(Key.F5); case SDL.SDL_Scancode.SDL_SCANCODE_F6: return(Key.F6); case SDL.SDL_Scancode.SDL_SCANCODE_F7: return(Key.F7); case SDL.SDL_Scancode.SDL_SCANCODE_F8: return(Key.F8); case SDL.SDL_Scancode.SDL_SCANCODE_F9: return(Key.F9); case SDL.SDL_Scancode.SDL_SCANCODE_F10: return(Key.F10); case SDL.SDL_Scancode.SDL_SCANCODE_F11: return(Key.F11); case SDL.SDL_Scancode.SDL_SCANCODE_F12: return(Key.F12); case SDL.SDL_Scancode.SDL_SCANCODE_PRINTSCREEN: return(Key.PrintScreen); case SDL.SDL_Scancode.SDL_SCANCODE_SCROLLLOCK: return(Key.ScrollLock); case SDL.SDL_Scancode.SDL_SCANCODE_PAUSE: return(Key.Pause); case SDL.SDL_Scancode.SDL_SCANCODE_INSERT: return(Key.Insert); case SDL.SDL_Scancode.SDL_SCANCODE_HOME: return(Key.Home); case SDL.SDL_Scancode.SDL_SCANCODE_PAGEUP: return(Key.PageUp); case SDL.SDL_Scancode.SDL_SCANCODE_DELETE: return(Key.Delete); case SDL.SDL_Scancode.SDL_SCANCODE_END: return(Key.End); case SDL.SDL_Scancode.SDL_SCANCODE_PAGEDOWN: return(Key.PageDown); case SDL.SDL_Scancode.SDL_SCANCODE_RIGHT: return(Key.Right); case SDL.SDL_Scancode.SDL_SCANCODE_LEFT: return(Key.Left); case SDL.SDL_Scancode.SDL_SCANCODE_DOWN: return(Key.Down); case SDL.SDL_Scancode.SDL_SCANCODE_UP: return(Key.Up); case SDL.SDL_Scancode.SDL_SCANCODE_NUMLOCKCLEAR: return(Key.NumLock); case SDL.SDL_Scancode.SDL_SCANCODE_KP_DIVIDE: return(Key.KeypadDivide); case SDL.SDL_Scancode.SDL_SCANCODE_KP_MULTIPLY: return(Key.KeypadMultiply); case SDL.SDL_Scancode.SDL_SCANCODE_KP_MINUS: return(Key.KeypadMinus); case SDL.SDL_Scancode.SDL_SCANCODE_KP_PLUS: return(Key.KeypadPlus); case SDL.SDL_Scancode.SDL_SCANCODE_KP_ENTER: return(Key.KeypadEnter); case SDL.SDL_Scancode.SDL_SCANCODE_KP_1: return(numLockOn ? Key.Keypad1 : Key.End); case SDL.SDL_Scancode.SDL_SCANCODE_KP_2: return(numLockOn ? Key.Keypad2 : Key.Down); case SDL.SDL_Scancode.SDL_SCANCODE_KP_3: return(numLockOn ? Key.Keypad3 : Key.PageDown); case SDL.SDL_Scancode.SDL_SCANCODE_KP_4: return(numLockOn ? Key.Keypad4 : Key.Left); case SDL.SDL_Scancode.SDL_SCANCODE_KP_5: return(numLockOn ? Key.Keypad5 : Key.Clear); case SDL.SDL_Scancode.SDL_SCANCODE_KP_6: return(numLockOn ? Key.Keypad6 : Key.Right); case SDL.SDL_Scancode.SDL_SCANCODE_KP_7: return(numLockOn ? Key.Keypad7 : Key.Home); case SDL.SDL_Scancode.SDL_SCANCODE_KP_8: return(numLockOn ? Key.Keypad8 : Key.Up); case SDL.SDL_Scancode.SDL_SCANCODE_KP_9: return(numLockOn ? Key.Keypad9 : Key.PageUp); case SDL.SDL_Scancode.SDL_SCANCODE_KP_0: return(numLockOn ? Key.Keypad0 : Key.Insert); case SDL.SDL_Scancode.SDL_SCANCODE_KP_PERIOD: return(numLockOn ? Key.KeypadPeriod : Key.Delete); case SDL.SDL_Scancode.SDL_SCANCODE_NONUSBACKSLASH: return(Key.NonUSBackSlash); case SDL.SDL_Scancode.SDL_SCANCODE_F13: return(Key.F13); case SDL.SDL_Scancode.SDL_SCANCODE_F14: return(Key.F14); case SDL.SDL_Scancode.SDL_SCANCODE_F15: return(Key.F15); case SDL.SDL_Scancode.SDL_SCANCODE_F16: return(Key.F16); case SDL.SDL_Scancode.SDL_SCANCODE_F17: return(Key.F17); case SDL.SDL_Scancode.SDL_SCANCODE_F18: return(Key.F18); case SDL.SDL_Scancode.SDL_SCANCODE_F19: return(Key.F19); case SDL.SDL_Scancode.SDL_SCANCODE_F20: return(Key.F20); case SDL.SDL_Scancode.SDL_SCANCODE_F21: return(Key.F21); case SDL.SDL_Scancode.SDL_SCANCODE_F22: return(Key.F22); case SDL.SDL_Scancode.SDL_SCANCODE_F23: return(Key.F23); case SDL.SDL_Scancode.SDL_SCANCODE_F24: return(Key.F24); case SDL.SDL_Scancode.SDL_SCANCODE_MENU: return(Key.Menu); case SDL.SDL_Scancode.SDL_SCANCODE_STOP: return(Key.Stop); case SDL.SDL_Scancode.SDL_SCANCODE_MUTE: return(Key.Mute); case SDL.SDL_Scancode.SDL_SCANCODE_VOLUMEUP: return(Key.VolumeUp); case SDL.SDL_Scancode.SDL_SCANCODE_VOLUMEDOWN: return(Key.VolumeDown); case SDL.SDL_Scancode.SDL_SCANCODE_CLEAR: return(Key.Clear); case SDL.SDL_Scancode.SDL_SCANCODE_DECIMALSEPARATOR: return(Key.KeypadDecimal); case SDL.SDL_Scancode.SDL_SCANCODE_LCTRL: return(Key.ControlLeft); case SDL.SDL_Scancode.SDL_SCANCODE_LSHIFT: return(Key.ShiftLeft); case SDL.SDL_Scancode.SDL_SCANCODE_LALT: return(Key.AltLeft); case SDL.SDL_Scancode.SDL_SCANCODE_LGUI: return(Key.WinLeft); case SDL.SDL_Scancode.SDL_SCANCODE_RCTRL: return(Key.ControlRight); case SDL.SDL_Scancode.SDL_SCANCODE_RSHIFT: return(Key.ShiftRight); case SDL.SDL_Scancode.SDL_SCANCODE_RALT: return(Key.AltRight); case SDL.SDL_Scancode.SDL_SCANCODE_RGUI: return(Key.WinRight); case SDL.SDL_Scancode.SDL_SCANCODE_AUDIONEXT: return(Key.TrackNext); case SDL.SDL_Scancode.SDL_SCANCODE_AUDIOPREV: return(Key.TrackPrevious); case SDL.SDL_Scancode.SDL_SCANCODE_AUDIOSTOP: return(Key.Stop); case SDL.SDL_Scancode.SDL_SCANCODE_AUDIOPLAY: return(Key.PlayPause); case SDL.SDL_Scancode.SDL_SCANCODE_AUDIOMUTE: return(Key.Mute); case SDL.SDL_Scancode.SDL_SCANCODE_SLEEP: return(Key.Sleep); } }
public virtual bool KeyUp(SDL.SDL_Keysym key) => true;
public void KeyUp(SDL.SDL_Keysym key) { }
// Processes key strokes. private void HandleKeyDown(SDL.SDL_Keysym keysym) { throw new NotImplementedException(); // byte c; //if (viewer.display_mode == Viewer.AnonymousEnum.ModeMap) //{ // switch (keysym.sym) // { // case SDLK_ESCAPE: // MainMenu(); // break; // default: // viewer.display_mode = Viewer.AnonymousEnum.Mode_3d; // --viewer.UPDATE; // parser.KBDPUT(32); // This is a (necessary ???) hack. // break; // } //} else //{ // switch (keysym.sym) // { // case SDLK_RSHIFT: // case SDLK_LSHIFT: // case SDLK_RCTRL: // case SDLK_LCTRL: // case SDLK_RALT: // case SDLK_LALT: // //SDL 2.0 0 removed // //case SDLK_RMETA: // //case SDLK_LMETA: // case SDLK_LGUI: // case SDLK_RGUI: // //case SDLK_LSUPER: // //case SDLK_RSUPER: // case SDLK_MODE: // //case SDLK_COMPOSE: // //case SDLK_NUMLOCK: // case SDLK_NUMLOCKCLEAR: // case SDLK_CAPSLOCK: // case SDLK_SCROLLLOCK: // // ignore these keys // return; // case SDLK_ESCAPE: // MainMenu(); // Enter the meta-menu routine // return; // // case SDLK_EXCLAIM: c = '!'; break; // // case SDLK_LESS: c = '<'; break; // // case SDLK_GREATER: c = '>'; break; // // case SDLK_QUESTION: c = '?'; break; // // case SDLK_UNDERSCORE: c = '_'; break; // // case SDLK_PERIOD: c = '.'; break; // // case SDLK_LEFTBRACKET: c = '{'; break; // // case SDLK_RIGHTBRACKET: c = '}'; break; // default: // c = keys[keysym.sym]; // break; // } // parser.KBDPUT(c); //} }