Hi~~I'm newer of learning irr engine.
now I hava a problem.When I open a UI window and I input the editbox,but at the same time my scene node that proccess the input message work too .How can I prevent the message transfer to the scene node ?Actually,I just want to edit the box but not the scene no ....
Can can I transfer the irr message?
I control a player node by the keyboard.' W','S','A','D' will contrlol the behavior of it.
At the same time,I load a UI by
gEnv->loadGUI("media\\xml\\window_menu_personal_inf.xml");
there will be present a window.And the window contain a editbox.
When I press key ' W','S','A','D' in the editbox,how can I prevent the player from walking ?
thanks ...
[/img]
At the same time,I load a UI by
gEnv->loadGUI("media\\xml\\window_menu_personal_inf.xml");
there will be present a window.And the window contain a editbox.
When I press key ' W','S','A','D' in the editbox,how can I prevent the player from walking ?
thanks ...
[/img]
You have to code it. There are several way to do that, but first step is to recognize that you have two different states. One for input (or maybe even a gui-state) and one for controlling your character. So you have to code some some method to find out in which state you are. If you only want to know if the input-field is currently active you can do that by checking if it has the focus. But there might be other way - for example I am using a chat-class which knows itself if it is currenlty active and it does so by checking if it's gui is visible.
Once you know in which state you are you have again several ways to continue. You can remove or disable the input-receiving code for steering code for a while (I usually do that). Or you can ignore the input code in the movement for that time.
But there's no automatism for that - you have to code it.
Once you know in which state you are you have again several ways to continue. You can remove or disable the input-receiving code for steering code for a while (I usually do that). Or you can ignore the input code in the movement for that time.
But there's no automatism for that - you have to code it.
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Well, I don't know how you currently control your character. If you do it through the camera then I think you can just set camera->setInputReceiverEnabled(false) while the editbox has the focus. Otherwise you have to tell what you currently do.
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
I create a 3rd personal camera,i just control a character throught keyboard.
e.g 'w' meaning forword.
i afaid the method camera->setInputReceiverEnabled(false) did't suit it....
is there any more method exist for me to disable the the input?
here is the code....I create a custom animator to proccess input.and then just character ->addAnimator....
in fact,i just want to focus the editbox...I dont't want my character corresponding the key ' W', 'S', 'A', 'D'....
bool CSceneNodeAnimatorPlayer::OnEvent( const SEvent& event )
{
// ----------------------------------------------------
if ( mbFreeModeOpen && event.EventType == EET_KEY_INPUT_EVENT)
{
switch(event.KeyInput.Key)
{
case KEY_KEY_W:
{
mbKeyDowned_W = event.KeyInput.PressedDown;
break;
}
case KEY_KEY_S:
{
mbKeyDowned_S = event.KeyInput.PressedDown;
break;
}
case KEY_KEY_A:
{
mbKeyDowned_A = event.KeyInput.PressedDown;
break;
}
case KEY_KEY_D:
{
mbKeyDowned_D = event.KeyInput.PressedDown;
break;
}
default:
{
return false;
}
}
mbFreeMoving = mbKeyDowned_W || mbKeyDowned_S || mbKeyDowned_A || mbKeyDowned_D;
if(mbFreeMoving)
{
mbAutoMoving = false;
if( mpArrow )
{
mpArrow->setVisible(0);
}
}
return false;
}
}
thanks you....
e.g 'w' meaning forword.
i afaid the method camera->setInputReceiverEnabled(false) did't suit it....
is there any more method exist for me to disable the the input?
here is the code....I create a custom animator to proccess input.and then just character ->addAnimator....
in fact,i just want to focus the editbox...I dont't want my character corresponding the key ' W', 'S', 'A', 'D'....
bool CSceneNodeAnimatorPlayer::OnEvent( const SEvent& event )
{
// ----------------------------------------------------
if ( mbFreeModeOpen && event.EventType == EET_KEY_INPUT_EVENT)
{
switch(event.KeyInput.Key)
{
case KEY_KEY_W:
{
mbKeyDowned_W = event.KeyInput.PressedDown;
break;
}
case KEY_KEY_S:
{
mbKeyDowned_S = event.KeyInput.PressedDown;
break;
}
case KEY_KEY_A:
{
mbKeyDowned_A = event.KeyInput.PressedDown;
break;
}
case KEY_KEY_D:
{
mbKeyDowned_D = event.KeyInput.PressedDown;
break;
}
default:
{
return false;
}
}
mbFreeMoving = mbKeyDowned_W || mbKeyDowned_S || mbKeyDowned_A || mbKeyDowned_D;
if(mbFreeMoving)
{
mbAutoMoving = false;
if( mpArrow )
{
mpArrow->setVisible(0);
}
}
return false;
}
}
thanks you....
Well, that line
looks to me like you could add another check there. Make sure you have acces to the guienvironment and your editboxpointer and then you can do something like:
Then that code won't run anymore if the corresponding editbox has the focus and you don't move your character anymore.
Code: Select all
if ( mbFreeModeOpen && event.EventType == EET_KEY_INPUT_EVENT)
Code: Select all
if ( mbFreeModeOpen && event.EventType == EET_KEY_INPUT_EVENT
&& !guiEnv->hasFocus(myEditBox)
)
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm