Mercurial > LightClone
view LightClone/Source/EventSystem.cpp @ 15:ee1c2510096d
Work on GUI system
author | koryspansel <koryspansel@bendbroadband.com> |
---|---|
date | Wed, 14 Sep 2011 11:04:18 -0700 |
parents | 7081e8e6008c |
children | 51718795f019 |
line wrap: on
line source
/* * EventSystem */ #include "EventSystem.h" /* * EventSystem */ EventSystem::EventSystem() { } /* * AddSource */ ErrorCode EventSystem::AddSource(EventSource* pSource) { return kSources.Add(pSource); } /* * AddSink */ ErrorCode EventSystem::AddSink(EventSink* pSink) { return kSinks.Add(pSink); } /* * RemoveSink */ ErrorCode EventSystem::RemoveSink(EventSink* pSink) { ErrorCode eCode = Error_Fail; int32 nIndex = kSinks.Find(pSink); if(nIndex >= 0) { eCode = kSinks.Remove(nIndex); } return eCode; } /* * Post */ void EventSystem::Post(const Event& kEvent) { for(uint32 i = 0; i < kSinks.GetSize(); ++i) { if(kSinks[i]->ProcessEvent(kEvent) == EventResult_Stop) { break; } } } /* * Update */ void EventSystem::Update(float fElapsed) { for(uint32 i = 0; i < kSources.GetSize(); ++i) { kSources[i]->Update(this, fElapsed); } }