testkeys.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
  3. This software is provided 'as-is', without any express or implied
  4. warranty. In no event will the authors be held liable for any damages
  5. arising from the use of this software.
  6. Permission is granted to anyone to use this software for any purpose,
  7. including commercial applications, and to alter it and redistribute it
  8. freely.
  9. */
  10. /* Print out all the scancodes we have, just to verify them */
  11. #include <stdio.h>
  12. #include <ctype.h>
  13. #include <stdlib.h>
  14. #include <string.h>
  15. #include "SDL.h"
  16. int
  17. main(int argc, char *argv[])
  18. {
  19. SDL_Scancode scancode;
  20. /* Enable standard application logging */
  21. SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
  22. if (SDL_Init(SDL_INIT_VIDEO) < 0) {
  23. SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
  24. exit(1);
  25. }
  26. for (scancode = 0; scancode < SDL_NUM_SCANCODES; ++scancode) {
  27. SDL_Log("Scancode #%d, \"%s\"\n", scancode,
  28. SDL_GetScancodeName(scancode));
  29. }
  30. SDL_Quit();
  31. return (0);
  32. }