So, if you wanted to create a master event adapter which handled listeners of every event, you'd have to type out -
class EventAdapter : public pain::core::HandlerList< pain::core::KeyDownEvent >, public pain::core::HandlerList< pain::core::KeyUpEvent >, public pain::core::HandlerList< pain::core::MouseDownEvent >, public pain::core::HandlerList< pain::core::MouseMoveEvent >, public pain::core::HandlerList< pain::core::MouseUpEvent >, public pain::core::HandlerList< pain::core::QuitEvent >{ USE_HANDLER_LIST( KeyDownEvent ); USE_HANDLER_LIST( KeyUpEvent ); USE_HANDLER_LIST( MouseDownEvent ); USE_HANDLER_LIST( MouseMoveEvent ); USE_HANDLER_LIST( MouseUpEvent ); USE_HANDLER_LIST( QuitEvent );public: void poll();};
Where USE_HANDLER_LIST is a macro defined as
#define USE_HANDLER_LIST( _T ) \ using pain::core::HandlerList< pain::core::##_T >::raiseEvent; \ using pain::core::HandlerList< pain::core::##_T >::addListener; \ using pain::core::HandlerList< pain::core::##_T >::delListener
Now, normally I'll avoid macros like the plague, but MaulingMonkey of #gamedev convinced me otherwise.
Fruny tried to get me to (ab)use [boost] which may or may not have an easy way to code the Visitor pattern, which, iirc is kind of like the Observer pattern, though I'd honestly have to look it up. In any case, my solution 'works' now. Hur hur.
Basically what this unhypothetical class will do is provide a generic wrapper over event processing. The one I'm working on now is the SDL event handler, which will capture events via SDL, convert them over to the system's internal event structures, and pass them out to listeners (Observer Pattern).
But yeah. Hur hur hur.
And aren't -YOU- supposed to be working on Nintendo handhelds??
Ah!
Ah.., I'm so disappointed.