Page 1 of 1

Inject backspace as unbuffered

Posted: Mon Feb 08, 2010 12:45
by wizzler
I'm using OIS with buffered key input which injects char and keydown.

Code: Select all

bool PlayState::keyPressed(const OIS::KeyEvent& arg)
{
   CEGUI::System& sys = CEGUI::System::getSingleton();
    sys.injectKeyDown(arg.key);
    sys.injectChar(arg.text);


When I press Enter, I activate and show an editbox.

Code: Select all

   case OIS::KC_RETURN:
      {
         CEGUI::Window* chatBox = mCEGUIWinMgr->getWindow("/ChatBox/Text");
         
         if (chatBox->isActive())
         {
            chatBox->hide();
            chatBox->deactivate();
         }
         else
         {
            chatBox->show();
            chatBox->activate();
         }
      }


Everything works fine except that I want to make the backspace unbuffered so that you don't have to press it multiple times to remove text.

How do you recommend doing so? Should I just make a case where; when the editbox is activated, I inject backspace as unbuffered?

Re: Inject backspace as unbuffered

Posted: Mon Feb 08, 2010 14:03
by CrazyEddie
I'm no expert on OIS, so take this reply as you find it ;)

What you need is for OIS to generate multiple calls to PlayState::keyPressed(const OIS::KeyEvent& arg) while the key is held down - I would have thought that switching from buffered to unbuffered would have no effect on this auto-repeating keys.

What do the OIS guys say on the subject? :)

CE.

Re: Inject backspace as unbuffered

Posted: Mon Feb 08, 2010 17:52
by wizzler
Yea, I guess I should post this on the OIS forums instead. Or perhaps anyone that uses CEGUI with OIS knows a good solution?