Did a lot of boilerplate on the Event wrapper

master
MitchellHansen 8 years ago
parent 3c91614f45
commit 4cd9bbb4ed

@ -0,0 +1,74 @@
#pragma once
namespace vr {
class Event {
public:
enum EventType
{
Closed,
Resized,
LostFocus,
GainedFocus,
TextEntered,
KeyPressed,
KeyReleased,
MouseWheelMoved,
MouseWheelScrolled,
MouseButtonPressed,
MouseButtonReleased,
MouseMoved,
MouseEntered,
MouseLeft,
JoystickButtonPressed,
JoystickButtonReleased,
JoystickMoved,
JoystickConnected,
JoystickDisconnected,
TouchBegan,
TouchMoved,
TouchEnded,
SensorChanged,
Count
};
EventType type;
};
Closed,
Resized,
LostFocus,
GainedFocus,
TextEntered,
KeyPressed,
KeyReleased,
MouseWheelMoved,
MouseWheelScrolled,
MouseButtonPressed,
MouseButtonReleased,
MouseMoved,
MouseEntered,
MouseLeft,
JoystickButtonPressed,
JoystickButtonReleased,
JoystickMoved,
JoystickConnected,
JoystickDisconnected,
TouchBegan,
TouchMoved,
TouchEnded,
SensorChanged,
Count
}

@ -119,9 +119,15 @@ public:
event_class = Event_Class::SensorEvent;
}
else {
std::cout << "Unable to classify sf::Event into Event_Class";
abort();
}
// get the bucket containing subscribers to that Event_Class
std::vector<SfEventSubscriber*> *event_type_bucket = &subscribers[event_class];
// Send them the event
for (auto s : *event_type_bucket) {
s->update(this, e);
}

Loading…
Cancel
Save