Untitled

Published July 13, 2006
Advertisement
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.
Previous Entry Untitled
Next Entry Untitled
0 likes 5 comments

Comments

Pipo DeClown
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.
July 13, 2006 10:05 AM
Mushu
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!
July 13, 2006 11:17 AM
Pipo DeClown
Hey handsome, it's being worked on!
July 14, 2006 05:31 AM
Mushu
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.
July 14, 2006 08:05 AM
Pipo DeClown
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.
July 14, 2006 05:02 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

Untitled

5326 views

Untitled

1043 views

Untitled

1185 views

Untitled

1100 views

Untitled

1145 views

Untitled

1430 views

Untitled

1098 views

Untitled

999 views

Untitled

1003 views

Untitled

1183 views
Advertisement