I dont know if it's possible.... let's say i made a custom node (a camera) and want to call from my run() thread a function how can this be easly done?
Or for example i want to send a message to my node (i can execute functions with this) like a messagetype,WParam,LParam, is this possible?
If not, maybe it's a good idea to implement such feature?
Sending external messages to nodes
You can make your user defined node - see CustomSceneNode example.
If you can post windows events to irrlicht maybe is it possible if you transform structure of these events to appropriate Irrlicht event.
Also there is virtual bool postEventFromUser function defined in ISceneManager class. You can use it when you want to post events to environment, but I'm still have not trying that.
If you can post windows events to irrlicht maybe is it possible if you transform structure of these events to appropriate Irrlicht event.
Also there is virtual bool postEventFromUser function defined in ISceneManager class. You can use it when you want to post events to environment, but I'm still have not trying that.
-
gizmocuz
Well i have done it this way... maybe it's a nice feature to implement in the next release:
To implement custom messages to scene nodes change the following:
ISceneNode.h
//message handler
virtual u32 OnMessage(u32 message, u32 wParam, u32 lParam) {
return 0;
}
now in a node that need messages implement the above function.
To send messages just do:
node->OnMessage(messagetype, param1, param2).
Thanks for the help.
To implement custom messages to scene nodes change the following:
ISceneNode.h
//message handler
virtual u32 OnMessage(u32 message, u32 wParam, u32 lParam) {
return 0;
}
now in a node that need messages implement the above function.
To send messages just do:
node->OnMessage(messagetype, param1, param2).
Thanks for the help.
Seem you need event handler
. I'm not sure that u32 wParam, u32 lParam are most important parameters. I that know this message parameters are used in Wiindows, but Irrlicht works on different OS. Maybe is more important realization of any event handler that works for every scene node? At this time events are cached with switch by common event receiver. I saw in IrrlichtNX forum some good Zola's ideas about.
-
Guest
Hi Puh,
Afcourse it is possible to send mouse messages to the node this way. If you implement the above function (onmessage) you have two parameters. You can for example pass a structure to the message like this:
struct tagMouse
{
unsigned short posx;
unsigned short posy;
char bLeftMouseState;
char bMiddleMouseState;
char bRightMouseState;
... and so on
} IMOUSE;
IMOUSE mymouse;
mymouse.posx=....;
mynode->OnMessage(IMOUSE_EVENT,(u32)&mymouse,NULL);
IMOUSE_EVENT is just a number representing a mouse structure.
u32 MyNode::OnMessage(u32 message, u32 wParam, u32 lParam)
{
IMOUSE *tmouse;
switch (message)
{
case IMOUSE_EVENT:
tmouse=(IMOUSE*)wParam;
... do something
break;
case .....
}
}
Hope this example explain a bit how to use this...
Afcourse it is possible to send mouse messages to the node this way. If you implement the above function (onmessage) you have two parameters. You can for example pass a structure to the message like this:
struct tagMouse
{
unsigned short posx;
unsigned short posy;
char bLeftMouseState;
char bMiddleMouseState;
char bRightMouseState;
... and so on
} IMOUSE;
IMOUSE mymouse;
mymouse.posx=....;
mynode->OnMessage(IMOUSE_EVENT,(u32)&mymouse,NULL);
IMOUSE_EVENT is just a number representing a mouse structure.
u32 MyNode::OnMessage(u32 message, u32 wParam, u32 lParam)
{
IMOUSE *tmouse;
switch (message)
{
case IMOUSE_EVENT:
tmouse=(IMOUSE*)wParam;
... do something
break;
case .....
}
}
Hope this example explain a bit how to use this...