Event.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. * Copyright (C) 2022 The V-Gears Team
  3. *
  4. * This file is part of V-Gears
  5. *
  6. * V-Gears is free software: you can redistribute it and/or modify it under
  7. * terms of the GNU General Public License as published by the Free Software
  8. * Foundation, version 3.0 (GPLv3) of the License.
  9. *
  10. * V-Gears is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #pragma once
  16. // Add this include because this is only common file between everything that
  17. // uses Input function.
  18. #include <OIS/OIS.h>
  19. namespace QGears{
  20. /**
  21. * Type of event.
  22. */
  23. enum EventType{
  24. /**
  25. * Null event.
  26. */
  27. ET_NULL = 0,
  28. /**
  29. * A key is pressed.
  30. */
  31. ET_KEY_PRESS,
  32. /**
  33. * A key is being held down.
  34. */
  35. ET_KEY_REPEAT,
  36. /**
  37. * @todo Understand and document.
  38. */
  39. ET_KEY_REPEAT_WAIT,
  40. /**
  41. * @todo Understand and document.
  42. */
  43. ET_KEY_IMPULSE,
  44. /**
  45. * A key is released.
  46. */
  47. ET_KEY_RELEASE,
  48. /**
  49. * A mouse button is pressed.
  50. */
  51. ET_MOUSE_PRESS,
  52. /**
  53. * A mouse button is released.
  54. */
  55. ET_MOUSE_RELEASE,
  56. /**
  57. * The mouse has moved.
  58. */
  59. ET_MOUSE_MOVE,
  60. /**
  61. * The mouse has scrolled.
  62. */
  63. ET_MOUSE_SCROLL
  64. };
  65. /**
  66. * An input event.
  67. */
  68. struct Event{
  69. /**
  70. * Constructor.
  71. *
  72. * Sets the type to {@see ET_NULL}, and the parameters to 0.
  73. */
  74. Event():
  75. type(ET_NULL),
  76. param1(0),
  77. param2(0)
  78. {};
  79. /**
  80. * Constructor.
  81. *
  82. * Sets the parameters to 0.
  83. *
  84. * @param n[in] The event type.
  85. */
  86. Event(EventType n):
  87. type(n),
  88. param1(0),
  89. param2(0)
  90. {};
  91. /**
  92. * Constructor.
  93. *
  94. * @param n[in] The event type.
  95. * @param p1[in] First parameter.
  96. * @param p1[in] Second parameter.
  97. */
  98. Event(EventType n, float p1, float p2) :
  99. type(n),
  100. param1(p1),
  101. param2(p2)
  102. {};
  103. /**
  104. * The type of the event.
  105. */
  106. EventType type;
  107. /**
  108. * First event parameter.
  109. */
  110. float param1;
  111. /**
  112. * Second event parameter.
  113. */
  114. float param2;
  115. /**
  116. * Event ID.
  117. */
  118. Ogre::String event;
  119. };
  120. }