SimpleGL  1.1.0
A framework for platform independent rendering
event.hpp
Go to the documentation of this file.
1 
8 #ifndef EVENT_HPP
9 #define EVENT_HPP
10 
11 #include "SimpleGL_Export.h"
12 
13 #include <vector>
14 
15 #include "input.hpp"
16 
17 namespace sgl {
18 
24  enum class EventType {
25 
29  KEY_EVENT,
30 
35  };
36 
42  class SIMPLEGL_EXPORT Event {
43 
44  protected:
46  static std::vector<Event*> events;
47 
50 
51  public:
57  static std::vector<Event*> getEvents();
58 
64  static void addEvent(Event* event);
65 
67  static void clearEvents();
68 
74  Event(EventType type);
75 
77  virtual ~Event(void);
78 
84  EventType getType();
85  };
86 
92  class SIMPLEGL_EXPORT KeyEvent : public Event {
93 
94  private:
96  Key key;
97 
99  int scancode;
100 
102  Action action;
103 
105  Modifier mods;
106 
107  public:
116  KeyEvent(Key key, int scancode, Action action, Modifier mods);
117 
119  ~KeyEvent(void) override;
120 
126  Key getKey();
127 
133  int getScancode();
134 
140  Action getAction();
141 
147  Modifier getMods();
148  };
149 
155  class SIMPLEGL_EXPORT MouseButtonEvent : public Event {
156 
157  private:
159  MouseButton button;
160 
162  Action action;
163 
165  Modifier mods;
166 
167  public:
175  MouseButtonEvent(MouseButton button, Action action, Modifier mods);
176 
178  ~MouseButtonEvent(void) override;
179 
185  MouseButton getButton();
186 
192  Action getAction();
193 
199  Modifier getMods();
200  };
201 }
202 
203 #endif /* EVENT_HPP */
MouseButton
This enum wraps the GLFW mouse buttons.
Definition: input.hpp:396
static std::vector< Event * > events
Stores the events that got received.
Definition: event.hpp:46
Key
This enum wraps the GLFW keys.
Definition: input.hpp:22
EventType type
Stores the event type.
Definition: event.hpp:49
Modifier
This enum wraps the GLFW modifier bits.
Definition: input.hpp:457
Generic namespace for the SimpleGL framework.
Definition: application.hpp:18
Constant for a mouse button event.
Constant for a key event.
EventType
This enum contains different event types.
Definition: event.hpp:24
Action
This enum wraps the GLFW actions.
Definition: input.hpp:440
This abstract class defines a event for the application.
Definition: event.hpp:42
This class defines a mouse button event, created by the MouseButtonCallback.
Definition: event.hpp:155
This class defines a key event, created by the KeyCallback.
Definition: event.hpp:92