entry.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /*
  2. * Copyright 2011-2013 Branimir Karadzic. All rights reserved.
  3. * License: http://www.opensource.org/licenses/BSD-2-Clause
  4. */
  5. #ifndef __ENTRY_H__
  6. #define __ENTRY_H__
  7. namespace entry
  8. {
  9. struct MouseButton
  10. {
  11. enum Enum
  12. {
  13. None,
  14. Left,
  15. Middle,
  16. Right,
  17. Count
  18. };
  19. };
  20. struct Modifier
  21. {
  22. enum Enum
  23. {
  24. None = 0,
  25. LeftAlt = 0x01,
  26. RightAlt = 0x02,
  27. LeftCtrl = 0x04,
  28. RightCtrl = 0x08,
  29. LeftShift = 0x10,
  30. RightShift = 0x20,
  31. LeftMeta = 0x40,
  32. RightMeta = 0x80,
  33. };
  34. };
  35. struct Key
  36. {
  37. enum Enum
  38. {
  39. None = 0,
  40. Esc,
  41. Return,
  42. Tab,
  43. Space,
  44. Backspace,
  45. Up,
  46. Down,
  47. Left,
  48. Right,
  49. PageUp,
  50. PageDown,
  51. Home,
  52. End,
  53. Print,
  54. Plus,
  55. Minus,
  56. F1,
  57. F2,
  58. F3,
  59. F4,
  60. F5,
  61. F6,
  62. F7,
  63. F8,
  64. F9,
  65. F10,
  66. F11,
  67. F12,
  68. NumPad0,
  69. NumPad1,
  70. NumPad2,
  71. NumPad3,
  72. NumPad4,
  73. NumPad5,
  74. NumPad6,
  75. NumPad7,
  76. NumPad8,
  77. NumPad9,
  78. Key0,
  79. Key1,
  80. Key2,
  81. Key3,
  82. Key4,
  83. Key5,
  84. Key6,
  85. Key7,
  86. Key8,
  87. Key9,
  88. KeyA,
  89. KeyB,
  90. KeyC,
  91. KeyD,
  92. KeyE,
  93. KeyF,
  94. KeyG,
  95. KeyH,
  96. KeyI,
  97. KeyJ,
  98. KeyK,
  99. KeyL,
  100. KeyM,
  101. KeyN,
  102. KeyO,
  103. KeyP,
  104. KeyQ,
  105. KeyR,
  106. KeyS,
  107. KeyT,
  108. KeyU,
  109. KeyV,
  110. KeyW,
  111. KeyX,
  112. KeyY,
  113. KeyZ,
  114. };
  115. };
  116. struct Event
  117. {
  118. enum Enum
  119. {
  120. Exit,
  121. Key,
  122. Mouse,
  123. Size,
  124. };
  125. Event::Enum m_type;
  126. };
  127. struct KeyEvent : public Event
  128. {
  129. Key::Enum m_key;
  130. uint8_t m_modifiers;
  131. bool m_down;
  132. };
  133. struct MouseEvent : public Event
  134. {
  135. int32_t m_mx;
  136. int32_t m_my;
  137. MouseButton::Enum m_button;
  138. bool m_down;
  139. bool m_move;
  140. };
  141. struct SizeEvent : public Event
  142. {
  143. uint32_t m_width;
  144. uint32_t m_height;
  145. };
  146. const Event* poll();
  147. void release(const Event* _event);
  148. void setWindowSize(uint32_t _width, uint32_t _height);
  149. void toggleWindowFrame();
  150. void setMouseLock(bool _lock);
  151. } // namespace entry
  152. #endif // __ENTRY_H__