43 lines
752 B
C++
43 lines
752 B
C++
#include "cGUIEventHandler.hpp"
|
|
|
|
using GUIEventEngine::cGUIEventHandler;
|
|
|
|
cGUIEventHandler::cGUIEventHandler()
|
|
{
|
|
}
|
|
|
|
cGUIEventHandler::~cGUIEventHandler()
|
|
{
|
|
for (unsigned int i = 0; i < m_events.size(); ++i) {
|
|
delete m_events[i];
|
|
m_events[i] = nullptr;
|
|
}
|
|
m_events.clear();
|
|
}
|
|
|
|
/// Functions
|
|
void cGUIEventHandler::CheckEvents()
|
|
{
|
|
SDL_Event event;
|
|
while (SDL_PollEvent(&event)) {
|
|
std::vector<GUIEventEngine::cGUIEvent*>::iterator it;
|
|
|
|
for (it = m_events.begin(); it < m_events.end(); it++) {
|
|
(*it)->OnEvent(event);
|
|
}
|
|
}
|
|
}
|
|
|
|
void cGUIEventHandler::AddEvents(GUIEventEngine::cGUIEvent* event )
|
|
{
|
|
m_events.push_back(event);
|
|
}
|
|
|
|
/// Sets
|
|
|
|
/// Gets
|
|
std::vector<GUIEventEngine::cGUIEvent*>& cGUIEventHandler::getEvents()
|
|
{
|
|
return m_events;
|
|
}
|