kick
|
00001 // 00002 // EventListener.cpp 00003 // TmpProject 00004 // 00005 // Created by morten on 8/18/13. 00006 // Copyright (c) 2013 morten. All rights reserved. 00007 // 00008 00009 #include "kick/core/event_listener.h" 00010 #include "kick/core/event.h" 00011 00012 namespace kick { 00013 00014 AbstractEventListener::AbstractEventListener(AbstractEvent *ae, int listenerId) 00015 :ae(ae), listenerId(listenerId){ 00016 } 00017 00018 AbstractEventListener::~AbstractEventListener(){ 00019 destroyListener(); 00020 } 00021 00022 void AbstractEventListener::destroyListener(){ 00023 if (ae){ 00024 ae->removeListener(listenerId); 00025 ae = nullptr; 00026 } 00027 } 00028 }