input.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* -*- mode: c; tab-width: 4; c-basic-offset: 3; c-file-style: "linux" -*- */
  2. //
  3. // Copyright (c) 2009, Wei Mingzhi <whistler_wmz@users.sf.net>.
  4. // All rights reserved.
  5. //
  6. // This file is part of SDLPAL.
  7. //
  8. // SDLPAL is free software: you can redistribute it and/or modify
  9. // it under the terms of the GNU General Public License as published by
  10. // the Free Software Foundation, either version 3 of the License, or
  11. // (at your option) any later version.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU General Public License
  19. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. //
  21. #ifndef INPUT_H
  22. #define INPUT_H
  23. #include "common.h"
  24. #include "palcommon.h"
  25. typedef struct tagPALINPUTSTATE
  26. {
  27. PALDIRECTION dir, prevdir;
  28. DWORD dwKeyPress;
  29. } PALINPUTSTATE;
  30. enum PALKEY
  31. {
  32. kKeyMenu = (1 << 0),
  33. kKeySearch = (1 << 1),
  34. kKeyDown = (1 << 2),
  35. kKeyLeft = (1 << 3),
  36. kKeyUp = (1 << 4),
  37. kKeyRight = (1 << 5),
  38. kKeyPgUp = (1 << 6),
  39. kKeyPgDn = (1 << 7),
  40. kKeyRepeat = (1 << 8),
  41. kKeyAuto = (1 << 9),
  42. kKeyDefend = (1 << 10),
  43. kKeyUseItem = (1 << 11),
  44. kKeyThrowItem = (1 << 12),
  45. kKeyFlee = (1 << 13),
  46. kKeyStatus = (1 << 14),
  47. kKeyForce = (1 << 15),
  48. kKeyHome = (1 << 16),
  49. kKeyEnd = (1 << 17),
  50. };
  51. PAL_C_LINKAGE_BEGIN
  52. VOID
  53. PAL_ClearKeyState(
  54. VOID
  55. );
  56. VOID
  57. PAL_InitInput(
  58. VOID
  59. );
  60. VOID
  61. PAL_ProcessEvent(
  62. VOID
  63. );
  64. VOID
  65. PAL_ShutdownInput(
  66. VOID
  67. );
  68. int
  69. PAL_PollEvent(
  70. SDL_Event *event
  71. );
  72. VOID
  73. PAL_SetTouchBounds(
  74. DWORD dwScreenWidth,
  75. DWORD dwScreenHeight,
  76. SDL_Rect renderRect
  77. );
  78. VOID
  79. PAL_RegisterInputFilter(
  80. void (*init_filter)(),
  81. int (*event_filter)(const SDL_Event *, volatile PALINPUTSTATE *),
  82. void (*shutdown_filter)()
  83. );
  84. extern volatile PALINPUTSTATE g_InputState;
  85. extern BOOL g_fUseJoystick;
  86. PAL_C_LINKAGE_END
  87. #endif