entry.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
  3. * License: http://www.opensource.org/licenses/BSD-2-Clause
  4. */
  5. #ifndef ENTRY_H_HEADER_GUARD
  6. #define ENTRY_H_HEADER_GUARD
  7. #include "dbg.h"
  8. #include <bx/bx.h>
  9. namespace entry
  10. {
  11. struct MouseButton
  12. {
  13. enum Enum
  14. {
  15. None,
  16. Left,
  17. Middle,
  18. Right,
  19. Count
  20. };
  21. };
  22. struct Modifier
  23. {
  24. enum Enum
  25. {
  26. None = 0,
  27. LeftAlt = 0x01,
  28. RightAlt = 0x02,
  29. LeftCtrl = 0x04,
  30. RightCtrl = 0x08,
  31. LeftShift = 0x10,
  32. RightShift = 0x20,
  33. LeftMeta = 0x40,
  34. RightMeta = 0x80,
  35. };
  36. };
  37. struct Key
  38. {
  39. enum Enum
  40. {
  41. None = 0,
  42. Esc,
  43. Return,
  44. Tab,
  45. Space,
  46. Backspace,
  47. Up,
  48. Down,
  49. Left,
  50. Right,
  51. PageUp,
  52. PageDown,
  53. Home,
  54. End,
  55. Print,
  56. Plus,
  57. Minus,
  58. F1,
  59. F2,
  60. F3,
  61. F4,
  62. F5,
  63. F6,
  64. F7,
  65. F8,
  66. F9,
  67. F10,
  68. F11,
  69. F12,
  70. NumPad0,
  71. NumPad1,
  72. NumPad2,
  73. NumPad3,
  74. NumPad4,
  75. NumPad5,
  76. NumPad6,
  77. NumPad7,
  78. NumPad8,
  79. NumPad9,
  80. Key0,
  81. Key1,
  82. Key2,
  83. Key3,
  84. Key4,
  85. Key5,
  86. Key6,
  87. Key7,
  88. Key8,
  89. Key9,
  90. KeyA,
  91. KeyB,
  92. KeyC,
  93. KeyD,
  94. KeyE,
  95. KeyF,
  96. KeyG,
  97. KeyH,
  98. KeyI,
  99. KeyJ,
  100. KeyK,
  101. KeyL,
  102. KeyM,
  103. KeyN,
  104. KeyO,
  105. KeyP,
  106. KeyQ,
  107. KeyR,
  108. KeyS,
  109. KeyT,
  110. KeyU,
  111. KeyV,
  112. KeyW,
  113. KeyX,
  114. KeyY,
  115. KeyZ,
  116. };
  117. };
  118. struct MouseState
  119. {
  120. MouseState()
  121. : m_mx(0)
  122. , m_my(0)
  123. {
  124. for (uint32_t ii = 0; ii < entry::MouseButton::Count; ++ii)
  125. {
  126. m_buttons[ii] = entry::MouseButton::None;
  127. }
  128. }
  129. uint32_t m_mx;
  130. uint32_t m_my;
  131. uint8_t m_buttons[entry::MouseButton::Count];
  132. };
  133. bool processEvents(uint32_t& _width, uint32_t& _height, uint32_t& _debug, uint32_t& _reset, MouseState* _mouse = NULL);
  134. } // namespace entry
  135. #endif // ENTRY_H_HEADER_GUARD