Mercurial > fife-parpg
changeset 624:b312d170ab0c
* Removed the "trigger" system as it was not in use and very incomplete. I couldn't come up with a good reason why it should be part of event channel either. The trigger system is scheduled for a future release anyway.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 01 Oct 2010 19:25:40 +0000 |
parents | 684e5537eef7 |
children | 92290efadab7 |
files | engine/core/eventchannel/eventmanager.cpp engine/core/eventchannel/eventmanager.h engine/core/eventchannel/trigger/ec_itriggercontroller.h engine/core/eventchannel/trigger/ec_itriggercontroller.i engine/core/eventchannel/trigger/ec_itriggerlistener.h engine/core/eventchannel/trigger/ec_itriggerlistener.i engine/core/eventchannel/trigger/ec_trigger.h engine/core/eventchannel/trigger/ec_trigger.i engine/core/modules.h |
diffstat | 9 files changed, 6 insertions(+), 370 deletions(-) [+] |
line wrap: on
line diff
--- a/engine/core/eventchannel/eventmanager.cpp Fri Oct 01 16:26:22 2010 +0000 +++ b/engine/core/eventchannel/eventmanager.cpp Fri Oct 01 19:25:40 2010 +0000 @@ -34,7 +34,6 @@ #include "eventchannel/key/ec_ikeyfilter.h" #include "eventchannel/mouse/ec_mouseevent.h" #include "eventchannel/command/ec_command.h" -#include "eventchannel/trigger/ec_trigger.h" #include "eventmanager.h" @@ -382,7 +381,6 @@ if(has_next_event) event = next_event; } - pollTriggers(); } void EventManager::processActiveEvent(SDL_Event event) { @@ -537,20 +535,6 @@ return ES_ENGINE; } - void EventManager::registerTrigger(Trigger& trigger){ - m_triggers.push_back(&trigger); - } - - void EventManager::unregisterTrigger(Trigger& trigger){ - m_triggers.remove(&trigger); - } - - void EventManager::pollTriggers(){ - for (std::list<Trigger*>::iterator it = m_triggers.begin(); it!=m_triggers.end(); ++it) { - (*it)->pollTrigger(); - } - } - void EventManager::setKeyFilter(IKeyFilter* keyFilter) { m_keyfilter = keyFilter; }
--- a/engine/core/eventchannel/eventmanager.h Fri Oct 01 16:26:22 2010 +0000 +++ b/engine/core/eventchannel/eventmanager.h Fri Oct 01 19:25:40 2010 +0000 @@ -52,8 +52,6 @@ #include "eventchannel/sdl/ec_isdleventcontroller.h" #include "eventchannel/sdl/ec_isdleventlistener.h" -#include "eventchannel/trigger/ec_itriggercontroller.h" - namespace FIFE { class ICommandListener; @@ -69,8 +67,7 @@ public IKeyController, public IMouseController, public ISdlEventController, - public IEventSource, - public ITriggerController { + public IEventSource { public: /** Constructor. */ @@ -83,21 +80,23 @@ void addCommandListener(ICommandListener* listener); void addCommandListenerFront(ICommandListener* listener); void removeCommandListener(ICommandListener* listener); + void dispatchCommand(Command& command); + void addKeyListener(IKeyListener* listener); void addKeyListenerFront(IKeyListener* listener); void removeKeyListener(IKeyListener* listener); + void addMouseListener(IMouseListener* listener); void addMouseListenerFront(IMouseListener* listener); void removeMouseListener(IMouseListener* listener); + void addSdlEventListener(ISdlEventListener* listener); void addSdlEventListenerFront(ISdlEventListener* listener); void removeSdlEventListener(ISdlEventListener* listener); + EventSourceType getEventSourceType(); - void registerTrigger(Trigger& trigger); - void unregisterTrigger(Trigger& trigger); - /** Process the SDL event queue. * This is to be called only by the engine itself once per frame. * It passes appropriate events to their listeners @@ -123,8 +122,6 @@ void fillKeyEvent(const SDL_Event& sdlevt, KeyEvent& keyevt); void fillMouseEvent(const SDL_Event& sdlevt, MouseEvent& mouseevt); - void pollTriggers(); - std::deque<ICommandListener*> m_commandlisteners; std::deque<ICommandListener*> m_pending_commandlisteners; std::deque<ICommandListener*> m_pending_commandlisteners_front; @@ -150,7 +147,6 @@ int m_mousestate; MouseEvent::MouseButtonType m_mostrecentbtn; - std::list<Trigger*> m_triggers; }; } //FIFE
--- a/engine/core/eventchannel/trigger/ec_itriggercontroller.h Fri Oct 01 16:26:22 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2008 by the FIFE team * - * http://www.fifengine.de * - * This file is part of FIFE. * - * * - * FIFE is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef FIFE_EVENTCHANNEL_TRIGGERCONTROLLER_H -#define FIFE_EVENTCHANNEL_TRIGGERCONTROLLER_H - -// Standard C++ library includes -// -#include <list> - -// 3rd party library includes -// - -// FIFE includes -// These includes are split up in two parts, separated by one empty line -// First block: files included from the FIFE root src directory -// Second block: files included from the same folder -// - -namespace FIFE { - - class Trigger; - - /** - * Manages triggers - */ - class ITriggerController { - - public: - virtual ~ITriggerController() { } - - virtual void registerTrigger(Trigger& trigger) = 0; - - virtual void unregisterTrigger(Trigger& trigger) = 0; - - }; -} - -#endif
--- a/engine/core/eventchannel/trigger/ec_itriggercontroller.i Fri Oct 01 16:26:22 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2008 by the FIFE team * - * http://www.fifengine.de * - * This file is part of FIFE. * - * * - * FIFE is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -%module fife -%{ -#include "eventchannel/trigger/ec_itriggercontroller.h" -%} - -namespace FIFE { - - class Trigger; - - class ITriggerController { - - public: - virtual ~ITriggerController() { } - - virtual void registerTrigger(Trigger& trigger) = 0; - - virtual void unregisterTrigger(Trigger& trigger) = 0; - - }; -}
--- a/engine/core/eventchannel/trigger/ec_itriggerlistener.h Fri Oct 01 16:26:22 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2008 by the FIFE team * - * http://www.fifengine.de * - * This file is part of FIFE. * - * * - * FIFE is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef FIFE_EVENTCHANNEL_TRIGGERLISTENER_H -#define FIFE_EVENTCHANNEL_TRIGGERLISTENER_H - -// Standard C++ library includes -// -#include <list> - -// 3rd party library includes -// - -// FIFE includes -// These includes are split up in two parts, separated by one empty line -// First block: files included from the FIFE root src directory -// Second block: files included from the same folder -// - -namespace FIFE { - - class Trigger; - - /** - * Listens for triggers - */ - class ITriggerListener { - - public: - virtual ~ITriggerListener() { } - - virtual void triggerFired() = 0; - - }; -} - -#endif
--- a/engine/core/eventchannel/trigger/ec_itriggerlistener.i Fri Oct 01 16:26:22 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2008 by the FIFE team * - * http://www.fifengine.de * - * This file is part of FIFE. * - * * - * FIFE is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -%module fife -%{ -#include "eventchannel/trigger/ec_itriggerlistener.h" -%} - -namespace FIFE { - - class Trigger; - - class ITriggerListener { - - public: - virtual ~ITriggerListener() { } - - virtual void triggerFired() = 0; - - }; -}
--- a/engine/core/eventchannel/trigger/ec_trigger.h Fri Oct 01 16:26:22 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2008 by the FIFE team * - * http://www.fifengine.de * - * This file is part of FIFE. * - * * - * FIFE is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef FIFE_EVENTCHANNEL_TRIGGER_H -#define FIFE_EVENTCHANNEL_TRIGGER_H - -// Standard C++ library includes -// -#include <list> - -// 3rd party library includes -// - -// FIFE includes -// These includes are split up in two parts, separated by one empty line -// First block: files included from the FIFE root src directory -// Second block: files included from the same folder -// - -#include "ec_itriggercontroller.h" -#include "ec_itriggerlistener.h" - -namespace FIFE { - - /** - * A trigger is fired when certain preconditions met - */ - class Trigger : public ITriggerController { - - public: - - Trigger(ITriggerListener& listener){ - registerListener(listener); - } - - Trigger() { } - - virtual ~Trigger(){ - m_triggers.clear(); - } - - void pollTrigger(){ - if(requirementsMet()){ - pollTriggers(); - } - } - - virtual bool requirementsMet(){ - return false; - } - - void registerTrigger(Trigger& trigger){ - m_triggers.push_back(&trigger); - } - - void unregisterTrigger(Trigger& trigger){ - m_triggers.remove(&trigger); - } - - void pollTriggers(){ - for (std::list<Trigger*>::iterator it = m_triggers.begin(), it_end =m_triggers.end(); it != it_end; ++it) { - (*it)->pollTrigger(); - } - } - - void fireTrigger(){ - for (std::list<ITriggerListener*>::iterator it = m_listeners.begin(), it_end = m_listeners.end(); it != it_end; ++it) { - (*it)->triggerFired(); - } - } - - void registerListener(ITriggerListener& triggerlistener){ - m_listeners.push_back(&triggerlistener); - } - - void unregisterListener(ITriggerListener& triggerlistener){ - m_listeners.remove(&triggerlistener); - } - - protected: - std::list<ITriggerListener*> m_listeners; - std::list<Trigger*> m_triggers; - }; -} - -#endif
--- a/engine/core/eventchannel/trigger/ec_trigger.i Fri Oct 01 16:26:22 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2008 by the FIFE team * - * http://www.fifengine.de * - * This file is part of FIFE. * - * * - * FIFE is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -%module fife -%{ -#include "eventchannel/trigger/ec_trigger.h" -%} - -%include "ec_trigger.i" -%include "ec_itriggercontroller.i" -%include "ec_itriggerlistener.i" - -namespace FIFE { - - class Trigger : public ITriggerController { - - public: - Trigger(ITriggerListener& listener); - - void registerTrigger(Trigger& trigger); - - void unregisterTrigger(Trigger& trigger); - - void registerListener(ITriggerListener& triggerlistener); - - void unregisterListener(ITriggerListener& triggerlistener); - }; -}
--- a/engine/core/modules.h Fri Oct 01 16:26:22 2010 +0000 +++ b/engine/core/modules.h Fri Oct 01 19:25:40 2010 +0000 @@ -38,7 +38,6 @@ LM_AUDIO, LM_CONTROLLER, LM_EVTCHANNEL, - LM_TRIGGER, LM_GUI, LM_CONSOLE, LM_LOADERS, @@ -74,7 +73,6 @@ {LM_AUDIO, LM_CORE, "Audio"}, \ {LM_CONTROLLER, LM_CORE, "Controller"}, \ {LM_EVTCHANNEL, LM_CORE, "Event Channel"}, \ - {LM_TRIGGER, LM_EVTCHANNEL, "Trigger System"}, \ {LM_GUI, LM_CORE, "GUI"}, \ {LM_CONSOLE, LM_GUI, "Console"}, \ {LM_LOADERS, LM_CORE, "Loaders"}, \