Is irrlicht able to pass input event to more than one event receiver at the same time ?
thx.
more than one active IEventReceiver ?
I faced this problem too.....
So, I developed an adaptator that you can register as the main device event receiver. Then, you can register as many event receiver as you want using adaptor's methods (add, remove, clear).
Hope it may help.... or maybe I failed to see better solution.
So, I developed an adaptator that you can register as the main device event receiver. Then, you can register as many event receiver as you want using adaptor's methods (add, remove, clear).
Code: Select all
#ifndef _ERM_HPP
#define _ERM_HPP
////////////////////////////////////////////////////////////////////////////////
//
// HELP ERM
//
////////////////////////////////////////////////////////////////////////////////
#include <irrlicht.h>
#include <list>
#include <algorithm>
#include <functional>
/*
Event Receiver Manager
SUM : ERM regroups multiple event receivers
*/
struct t_event_receiver_manager : irr::IEventReceiver
{
// add an event receiver into manager
inline void add( IEventReceiver * const er ) { _event_receivers.push_back( er ); }
// remove an event receiver from manager
inline void remove( IEventReceiver * const er ) { _event_receivers.remove( er ); }
// clear event receivers from manager
inline void clear() { _event_receivers.clear(); }
// callback
inline bool OnEvent( irr::SEvent ev )
{
for_each( _event_receivers.begin(),
_event_receivers.end(),
std::bind2nd( std::mem_fun(&irr::IEventReceiver::OnEvent) ,ev ) );
return true; // who cares ?
}
private:
// list of registered event receiver
std::list< IEventReceiver * const > _event_receivers;
};
#endif
-
- Posts: 206
- Joined: Thu Sep 01, 2005 9:26 pm
- Location: France