SDL_keyboard_c.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. #include "../SDL_internal.h"
  19. #ifndef SDL_keyboard_c_h_
  20. #define SDL_keyboard_c_h_
  21. #include "SDL_keycode.h"
  22. #include "SDL_events.h"
  23. /* Initialize the keyboard subsystem */
  24. extern int SDL_KeyboardInit(void);
  25. /* Get the default keymap */
  26. extern void SDL_GetDefaultKeymap(SDL_Keycode * keymap);
  27. /* Set the mapping of scancode to key codes */
  28. extern void SDL_SetKeymap(int start, const SDL_Keycode * keys, int length, SDL_bool send_event);
  29. /* Set a platform-dependent key name, overriding the default platform-agnostic
  30. name. Encoded as UTF-8. The string is not copied, thus the pointer given to
  31. this function must stay valid forever (or at least until the call to
  32. VideoQuit()). */
  33. extern void SDL_SetScancodeName(SDL_Scancode scancode, const char *name);
  34. /* Set the keyboard focus window */
  35. extern void SDL_SetKeyboardFocus(SDL_Window * window);
  36. /* Send a character from an on-screen keyboard as scancode and modifier key events,
  37. currently assuming ASCII characters on a US keyboard layout
  38. */
  39. extern int SDL_SendKeyboardUnicodeKey(Uint32 ch);
  40. /* Send a keyboard key event */
  41. extern int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode);
  42. extern int SDL_SendKeyboardKeyAutoRelease(SDL_Scancode scancode);
  43. /* Release all the autorelease keys */
  44. extern void SDL_ReleaseAutoReleaseKeys(void);
  45. /* Return true if any hardware key is pressed */
  46. extern SDL_bool SDL_HardwareKeyboardKeyPressed(void);
  47. /* Send keyboard text input */
  48. extern int SDL_SendKeyboardText(const char *text);
  49. /* Send editing text for selected range from start to end */
  50. extern int SDL_SendEditingText(const char *text, int start, int end);
  51. /* Shutdown the keyboard subsystem */
  52. extern void SDL_KeyboardQuit(void);
  53. /* Convert to UTF-8 */
  54. extern char *SDL_UCS4ToUTF8(Uint32 ch, char *dst);
  55. /* Toggle on or off pieces of the keyboard mod state. */
  56. extern void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle);
  57. #endif /* SDL_keyboard_c_h_ */
  58. /* vi: set ts=4 sw=4 expandtab: */