Started implementation of first event/message passing system
This commit is contained in:
11
BarinkEngine/Include/EventSystem/Event.h
Normal file
11
BarinkEngine/Include/EventSystem/Event.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
struct Event
|
||||
{
|
||||
public:
|
||||
std::string name;
|
||||
int argc;
|
||||
void** argv;
|
||||
|
||||
};
|
16
BarinkEngine/Include/EventSystem/EventEmitter.h
Normal file
16
BarinkEngine/Include/EventSystem/EventEmitter.h
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include "Event.h"
|
||||
#include "EventListener.h"
|
||||
|
||||
class EventEmitter {
|
||||
public:
|
||||
void Subscribe (EventListener& subscriber);
|
||||
void Unsubscribe(EventListener& subscriber);
|
||||
|
||||
protected:
|
||||
std::list<EventListener*> subscribers;
|
||||
void EmitEvent(Event& incident);
|
||||
|
||||
EventEmitter();
|
||||
|
||||
};
|
5
BarinkEngine/Include/EventSystem/EventListener.cpp
Normal file
5
BarinkEngine/Include/EventSystem/EventListener.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include "EventListener.h"
|
||||
|
||||
void EventListener::ReceiveEvent(Event& incident)
|
||||
{
|
||||
}
|
8
BarinkEngine/Include/EventSystem/EventListener.h
Normal file
8
BarinkEngine/Include/EventSystem/EventListener.h
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include "Event.h"
|
||||
#include <list>
|
||||
class EventListener{
|
||||
public:
|
||||
virtual void ReceiveEvent(Event& incident);
|
||||
|
||||
};
|
Reference in New Issue
Block a user