Adding new event reciver

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
warui
Posts: 232
Joined: Wed Apr 14, 2004 12:06 pm
Location: Lodz, Poland
Contact:

Adding new event reciver

Post by warui »

I want to make new scene node with it's one OnEvent() method (inherited form IEventReciver).

Code: Select all

class CFoo : public IEventReceiver
{
public:
  virtual bool OnEvent(SEvent event);
};
As i realize, i should register somewhere my new event reciver, but where ?
Tomasz Nowakowski
Openoko - www.openoko.pl
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

The event receiver is just the communication from the Irrlicht DLL to your application for events and you can only have one.

However, what you could do is set up the OnEvent to send events to your other classes using the same format as IEvent.
Crud, how do I do this again?
joy
Posts: 124
Joined: Tue Apr 27, 2004 9:15 am
Location: Germany

Post by joy »

That is exactly what I would do. just write onevent methods for your scenenode and that let the set Event reciever give it to the onevent method you need.
warui
Posts: 232
Joined: Wed Apr 14, 2004 12:06 pm
Location: Lodz, Poland
Contact:

Post by warui »

Good idea, thanks.

But there's one thing that bugs me. How it is done that when mouse in operating with gui elements (moving windows, interact with scroll bar, ...) the default cameras (FPS and Maya) dosn't respond to events ?
Tomasz Nowakowski
Openoko - www.openoko.pl
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

There currently isn't any "OnHover" functionality that you can use to tell when the mouse is over a GUI object. But you could write your own using ICursorControl->getPosition and the IGUIElements position.

Another way that you could solve your problem is to add a check in your OnEvent. When the GUI is active, don't send the message to the camera.
Crud, how do I do this again?
agrif

Post by agrif »

wait... the FPS camera is only supposed to respond if you call camera->OnEvent()?

I never call this in my program, but the camera responds. I thought the only way to turn it off is through camera->setInputReceiverEnabled()

Oh, well. I should probably write my own camera anyway.

agrif
NovaCoder
Posts: 28
Joined: Wed May 26, 2004 11:36 am
Contact:

Post by NovaCoder »

agrif wrote:wait... the FPS camera is only supposed to respond if you call camera->OnEvent()?

I never call this in my program, but the camera responds.
Yes I noticed this as well, I'm still trying to find out what's going on....
- Nova
NovaCoder
Posts: 28
Joined: Wed May 26, 2004 11:36 am
Contact:

Post by NovaCoder »

agrif wrote:wait... the FPS camera is only supposed to respond if you call camera->OnEvent()?

I never call this in my program, but the camera responds.
Yes I noticed this as well, I'm still trying to find out what's going on....
- Nova
NovaCoder
Posts: 28
Joined: Wed May 26, 2004 11:36 am
Contact:

Post by NovaCoder »

Ok looks like it's called from CSceneManager::drawAll().

That calls the OnPostRender() method of all scene nodes (I think) so if you have a FPS camera it will then have its OnPostRender() called which it turn calls CCameraFPSSceneNode::animate() which appears to use/change the current cursor position.
- Nova
Post Reply