Page 1 of 1

Ноw can I send from one part of program keyevent

Posted: Mon Dec 05, 2005 09:24
by b-s-a
I try to use this command:

Code: Select all

System::getSingleton().injectKeyDown(Ogre::KC_F12)


But my event listener (which successfully listen for keyboard events) do not catch it. Why?

Code: Select all

void Listener::keyPressed(KeyEvent* key) {
   printf("key pressed (%d)\n", key->getKey() );
   if (key->getKey() == KC_F12 )
      mShutdownRequested = true;
   key->consume();
}

Re: >w can I send from one part of program keyevent to the

Posted: Mon Dec 05, 2005 09:34
by lindquist
CEGUI does not fire Ogre keyboard events. It works the other way around. You should inject CEGUI key down Ogre.

Furthermore the value that you must pass to CEGUI is not the same as in Ogre, IIRC there is a ogre->cegui converter snippet on their wiki.

When you get the injection right, it will trigger KeyDown events in CEGUI which you can catch by subscribing event handlers to the Window::EventKeyDown event.

Re: How can I send from one part of program keyevent to the

Posted: Mon Dec 05, 2005 12:42
by b-s-a
Where can I find key codes for CEGUI::System::getSingleton().injectKeyDown?

Re: How can I send from one part of program keyevent to the

Posted: Mon Dec 05, 2005 19:25
by lindquist
They're in cegui_mk2/include/CEGUIInputEvent.h