entry.h 1.9 KB

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