Inject backspace as unbuffered

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

User avatar
wizzler
Just popping in
Just popping in
Posts: 10
Joined: Sat Jan 30, 2010 15:28

Inject backspace as unbuffered

Postby wizzler » Mon Feb 08, 2010 12:45

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?

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Inject backspace as unbuffered

Postby CrazyEddie » Mon Feb 08, 2010 14:03

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.

User avatar
wizzler
Just popping in
Just popping in
Posts: 10
Joined: Sat Jan 30, 2010 15:28

Re: Inject backspace as unbuffered

Postby wizzler » Mon Feb 08, 2010 17:52

Yea, I guess I should post this on the OIS forums instead. Or perhaps anyone that uses CEGUI with OIS knows a good solution?


Return to “Help”

Who is online

Users browsing this forum: No registered users and 5 guests