CppExperiments/EventManager/EventManager.cpp

14 lines
376 B
C++
Raw Normal View History

2021-10-21 13:00:01 +00:00
#include "EventManager.h"
void EventManager::eventRegister(std::string eventName, std::function< void(EventInfo) > callBack) {
this->callBackList[eventName].push_back(callBack);
}
void EventManager::eventDispatch(std::string eventName){
EventInfo info;
info.eventName = eventName;
for(auto call : this->callBackList[eventName]) {
call(info);
}
}