• entries
570
2427
• views
217196

# Untitled

84 views

Okay, so there was a little issue with the scope of inherited functions in a class which uses multiple inheritance, which can be fixed by using using declarations to bring the functions into scope. Which is kind of messy, IMO, but I can't think of any other way to do it ;_;

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.

I hate advanced C++. I might be a C programmer after all.

And aren't -YOU- supposed to be working on Nintendo handhelds??
Ah!
Ah.., I'm so disappointed.

I couldn't get any debuggers to work for it. And without debuggers, I am completely lost, so I decided to go back to my real love which is coding myself into cardboard boxes. With templates and other C++ nonsense. Hooray!

Hey handsome, it's being worked on!

Yeah, but it would be a real bitch to integrate with VS. And I can't work without VS.

Besides, how well do you trust code written by people who put divides in their code which will run on hardware which doesn't support hardware divides? Or, even a FPU!

To be frank, the GBA scares me. Its like walking into a room filled with knives while blindfolded on a plane filled with snakes flying over enemy airspace being and being shot at with a crapload of flak and in the path of a giant meteor about to destroy the world just as the sun goes supernova and the entire universe collapses.

What? The DS doesn't support divisions in hardware? Huuh? What would be a solution then? And perhaps the arm compiler makes a work around.

## Create an account

Register a new account