is there an event manager?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
shadowghost21
Posts: 56
Joined: Wed Nov 23, 2011 11:53 pm

is there an event manager?

Post by shadowghost21 »

Handling the events right in the main class works fine for a demo or tutorial but I assume that other have written their own event manager. I found one post on here that had a download link but that file is not longer with rapidshare :( I thought I would check to see if there are any event managers out there before I write my own. And I guess if there isn't then I can throw mine up when I am finished with it. Something about doing the event handling like the tutorials for an actual project seems... messy for lack of a better term.

Note: This isn't me asking how to write an event manager, just if there is one. I would rather not waste my time reinventing a wheel that may exist and be good enough for me:)
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Re: is there an event manager?

Post by Lonesome Ducky »

There's one in one of the examples. The movement example I think
shadowghost21
Posts: 56
Joined: Wed Nov 23, 2011 11:53 pm

Re: is there an event manager?

Post by shadowghost21 »

That's just a listener. I am talking about something that manages ALL the listeners and dispatches events as they happen. The model I have in my head is like that of Obj-C/iOS development, call backs when events happen that you care about sorta thing. I'm thinking their is no such thing, only the IEventReceiver that the device takes in the constructor.
shadowghost21
Posts: 56
Joined: Wed Nov 23, 2011 11:53 pm

Re: is there an event manager?

Post by shadowghost21 »

I don't really feel like my question was addressed: I'll try to rephrase it.

If I have multiple 'layers' such as some GUI Class and say clickable objects in game is there a way to tell the device that I want the gui events to go to some class guiClass and and keyboard events to go to some class keyboardClass. Both of these classes can inheret from IEventListener but IrrlichtDevice only takes one listener, can it take MULTIPLE receivers, can you add receivers? I want to basically have multiple classes take a crack at the event to see if they qualify for handling? I assume if there isn't then I need to continue to build some kind of event manager that gets all the events and dispatches to any listeners that are registered.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: is there an event manager?

Post by CuteAlien »

You can create a receiver that distributes events. Check my last post in this thread - it contains example code how to do that: http://irrlicht.sourceforge.net/forum/v ... =4&t=26176
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
shadowghost21
Posts: 56
Joined: Wed Nov 23, 2011 11:53 pm

Re: is there an event manager?

Post by shadowghost21 »

Thanks I have written event dispatch systems before but I always like to see how other have done it :) I just thought there was a better way and was more frustrated. I have been programming long enough to know just to breath, and except that there isn't a better way to do it haha.

I like your system CuteAlien. It's clean and simple. Nice work!

BTW really digging the array that irrlicht has built in. I never peeked at the source is it just an auto resizing vector (al la array list or list from java/c# respectively)?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: is there an event manager?

Post by CuteAlien »

Yes, irr::array is an auto-resizing vector (like std::vector).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply