Hi all again...
I solved my previous But now I have a question that can i use EET_GUI_EVENT and EET_KEY_INPUT_EVENT together?
I think that my problem is that I should set two event receivers for them.
I tried but It doesn't .... How ???? do you guys have any idea or advice???
EET_GUI_EVENT and EET_KEY_INPUT_EVENT together?????
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
Re: EET_GUI_EVENT and EET_KEY_INPUT_EVENT together?????
As far as i know, Irrlicht only sends one event at a time. So one event receiver is sufficient.
"Whoops..."
Oh really
So means that I really can not use like this...
So means that I really can not use like this...
Code: Select all
case EET_KEY_INPUT_EVENT:
KeyIsDown[event.KeyInput.Key] = event.KeyInput.PressedDown;
if (IsKeyDown(irr::KEY_KEY_Q))
{
exit(0);
}
if (IsKeyDown(irr::KEY_SPACE))
{
gPause = !gPause;
}
if (IsKeyDown(irr::KEY_KEY_W))
{
gWireframe = !gWireframe;
}
break;
case EET_GUI_EVENT:
s32 id = event.GUIEvent.Caller->getID();
switch(event.GUIEvent.EventType)
{
case EGET_CHECKBOX_CHANGED:
{
IGUICheckBox *cb = (IGUICheckBox *)event.GUIEvent.Caller;
switch ( id )
{
case GUI_ID_CHECKBOX_VISIBLE:
{
button->setVisible( cb->isChecked() );
}
break;
case GUI_ID_CHECKBOX_ENABLED:
{
button->setEnabled( cb->isChecked() );
}
break;
}
break;
}
break;
default:
break;
}
}
return false;
}
// This is used to check whether a key is being held down
virtual bool IsKeyDown(EKEY_CODE keyCode) const
{
return KeyIsDown[keyCode];
}
MyEventReceiver()
{
for (u32 i=0; i<KEY_KEY_CODES_COUNT; ++i)
KeyIsDown[i] = false;
}
MyEventReceiver(IrrlichtDevice * device, IGUIButton* button)
{
device->setEventReceiver(this);
}
private:
// We use this array to store the current state of each key
bool KeyIsDown[KEY_KEY_CODES_COUNT];
But I want to use Is there any way????
};
http://irrlicht.sourceforge.net/docu/example009.html
Look at the event receiver in there, shows how it catches both event types.
I believe that's what you want.
Look at the event receiver in there, shows how it catches both event types.
I believe that's what you want.
if (msg.getRubbishFactor() > rubbishLimit) { ignorePost(); cout << how it should be done << "\n"; }
hi Kingdutch Tnx for the reply It looks like main window is without events... Just screening..
In my case when my game should be stopped when GUI interface appear.
One more things again Can i show button when checkbox is checked...
Is there any idea. I can not find in here...
always thanks for kind replies all
In my case when my game should be stopped when GUI interface appear.
One more things again Can i show button when checkbox is checked...
Is there any idea. I can not find in here...
always thanks for kind replies all