Events are now passing correctly, small bug with held keys that needs fixing
This commit is contained in:
@@ -3,12 +3,13 @@
|
||||
#include "Event.hpp"
|
||||
#include "Pub_Sub.h"
|
||||
|
||||
void VrEventSubscriber::subscribe(VrEventPublisher* publisher, vr::Event::EventType type) {
|
||||
|
||||
void VrEventSubscriber::subscribe_to_publisher(VrEventPublisher* publisher, vr::Event::EventType type) {
|
||||
|
||||
publisher->subscribe(this, type);
|
||||
}
|
||||
|
||||
void VrEventSubscriber::subscribe(VrEventPublisher* publisher, std::vector<vr::Event::EventType> type) {
|
||||
void VrEventSubscriber::subscribe_to_publisher(VrEventPublisher* publisher, std::vector<vr::Event::EventType> type) {
|
||||
|
||||
publisher->subscribe(this, type);
|
||||
}
|
||||
@@ -29,13 +30,13 @@ void VrEventPublisher::unsubscribe(VrEventSubscriber *s, vr::Event::EventType ty
|
||||
std::remove(subscribers[type].begin(), subscribers[type].end(), s);
|
||||
}
|
||||
|
||||
void VrEventPublisher::notify(vr::Event event) {
|
||||
void VrEventPublisher::notify_subscribers(std::unique_ptr<vr::Event> event) {
|
||||
|
||||
// get the bucket containing subscribers to that Event_Class
|
||||
std::vector<VrEventSubscriber*> *event_type_bucket = &subscribers[event.type];
|
||||
std::vector<VrEventSubscriber*> *event_type_bucket = &subscribers[event.get()->type];
|
||||
|
||||
// Send them the event
|
||||
for (auto s : *event_type_bucket) {
|
||||
s->update(this, event);
|
||||
s->recieve_event(this, std::move(event));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user