SimpleGL  1.1.0
A framework for platform independent rendering
event.cpp
Go to the documentation of this file.
1 
8 #include "SimpleGL/event.hpp"
9 
10 namespace sgl {
11  std::vector<Event*> Event::events;
12 
13  std::vector<Event*> Event::getEvents() {
14  return events;
15  }
16 
17  void Event::addEvent(Event* event) {
18  if (event != nullptr) {
19  events.push_back(event);
20  }
21  }
22 
24  /* Clear events */
25  events.clear();
26  }
27 
29  : type(type) {
30  /* Nothing to do here */
31  }
32 
33  Event::~Event(void) {
34  /* Nothing to do here */
35  }
36 
38  return type;
39  }
40 
41  KeyEvent::KeyEvent(Key key, int scancode, Action action, Modifier mods)
43  key(key), scancode(scancode), action(action), mods(mods) {
44  /* Nothing to do here */
45  }
46 
48  /* Nothing to do here */
49  }
50 
52  return key;
53  }
54 
56  return scancode;
57  }
58 
60  return action;
61  }
62 
64  return mods;
65  }
66 
69  button(button), action(action), mods(mods) {
70  /* Nothing to do here */
71  }
72 
74  /* Nothing to do here */
75  }
76 
78  return button;
79  }
80 
82  return action;
83  }
84 
86  return mods;
87  }
88 }
MouseButtonEvent(MouseButton button, Action action, Modifier mods)
Creates a new mouse button event.
Definition: event.cpp:67
MouseButton
This enum wraps the GLFW mouse buttons.
Definition: input.hpp:396
Event(EventType type)
Creates a new event.
Definition: event.cpp:28
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
KeyEvent(Key key, int scancode, Action action, Modifier mods)
Creates a new key event.
Definition: event.cpp:41
static void clearEvents()
Clears the event list, this should be called after every loop.
Definition: event.cpp:23
virtual ~Event(void)
Deletes a event.
Definition: event.cpp:33
EventType type
Stores the event type.
Definition: event.hpp:49
Modifier getMods()
Returns the modifier bits of the event.
Definition: event.cpp:63
Modifier
This enum wraps the GLFW modifier bits.
Definition: input.hpp:457
Generic namespace for the SimpleGL framework.
Definition: application.hpp:18
int getScancode()
Returns the system-specific scancode for the key.
Definition: event.cpp:55
Constant for a mouse button event.
Constant for a key event.
~KeyEvent(void) override
Deletes a key event.
Definition: event.cpp:47
~MouseButtonEvent(void) override
Deletes a mouse button event.
Definition: event.cpp:73
EventType getType()
Returns the event type.
Definition: event.cpp:37
Key getKey()
Returns the key of the event.
Definition: event.cpp:51
EventType
This enum contains different event types.
Definition: event.hpp:24
static void addEvent(Event *event)
Adds an event to the list.
Definition: event.cpp:17
Action getAction()
Returns the action of the event.
Definition: event.cpp:81
Action
This enum wraps the GLFW actions.
Definition: input.hpp:440
MouseButton getButton()
Returns the mouse button of the event.
Definition: event.cpp:77
This abstract class defines a event for the application.
Definition: event.hpp:42
static std::vector< Event * > getEvents()
Returns the list of events.
Definition: event.cpp:13
Action getAction()
Returns the action of the event.
Definition: event.cpp:59
Modifier getMods()
Returns the modifier bits of the event.
Definition: event.cpp:85