input.h 2.1 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. #ifdef __cplusplus
  26. extern "C"
  27. {
  28. #endif
  29. typedef struct tagPALINPUTSTATE
  30. {
  31. PALDIRECTION dir, prevdir;
  32. DWORD dwKeyPress;
  33. } PALINPUTSTATE;
  34. extern volatile PALINPUTSTATE g_InputState;
  35. enum PALKEY
  36. {
  37. kKeyMenu = (1 << 0),
  38. kKeySearch = (1 << 1),
  39. kKeyDown = (1 << 2),
  40. kKeyLeft = (1 << 3),
  41. kKeyUp = (1 << 4),
  42. kKeyRight = (1 << 5),
  43. kKeyPgUp = (1 << 6),
  44. kKeyPgDn = (1 << 7),
  45. kKeyRepeat = (1 << 8),
  46. kKeyAuto = (1 << 9),
  47. kKeyDefend = (1 << 10),
  48. kKeyUseItem = (1 << 11),
  49. kKeyThrowItem = (1 << 12),
  50. kKeyFlee = (1 << 13),
  51. kKeyStatus = (1 << 14),
  52. kKeyForce = (1 << 15),
  53. kKeyHome = (1 << 16),
  54. kKeyEnd = (1 << 17),
  55. };
  56. VOID
  57. PAL_ClearKeyState(
  58. VOID
  59. );
  60. VOID
  61. PAL_InitInput(
  62. VOID
  63. );
  64. VOID
  65. PAL_ProcessEvent(
  66. VOID
  67. );
  68. VOID
  69. PAL_ShutdownInput(
  70. VOID
  71. );
  72. int
  73. PAL_PollEvent(
  74. SDL_Event *event
  75. );
  76. # if PAL_HAS_TOUCH
  77. VOID
  78. PAL_SetTouchBounds(
  79. DWORD dwScreenWidth,
  80. DWORD dwScreenHeight,
  81. SDL_Rect renderRect
  82. );
  83. # endif
  84. extern BOOL g_fUseJoystick;
  85. #ifdef __cplusplus
  86. }
  87. #endif
  88. #endif