Page 1 of 1

[SOLVED] SDL input problems

Posted: Thu Feb 05, 2009 16:40
by hurricane
Hi,

i try find some solutions in the old topics but nothing...

For the input injection in CEGUI i use the tutorial in the wiki so the code is this (for the key up and down):

Code: Select all

      case SDL_KEYDOWN:
        // to tell CEGUI that a key was pressed, we inject the scancode.
        CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode);
       
        // as for the character it's a litte more complicated. we'll use for translated unicode value.
        // this is described in more detail below.
        if ((e.key.keysym.unicode != 0)
        {
          CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode);
        }
        break;
   
      // key up
      case SDL_KEYUP:
        // like before we inject the scancode directly.
        CEGUI::System::getSingleton().injectKeyUp(e.key.keysym.scancode);
        break;



But i have this problems:

1) the DEL key don't work
2) the arrows keys (UP,DOWN,LEFT,RIGHT) don't work

ps i am testing this inputs in a default cegui editbox

What is the problem?

thanks

Martin

Posted: Thu Feb 05, 2009 19:34
by hurricane
woooooow

i solved this problem with this key-conversion-table:

http://www.cegui.org.uk/wiki/index.php/ ... I_keytable

ps the tutorial say that in windows the keys value (SDL -> CEGUI) are tha same but i had this problems...

thanks, bye

Posted: Fri Feb 06, 2009 09:29
by CrazyEddie
Hi.

can you link to the tutorial that incorrectly says the SDL scan codes are the same as CEGUI ones, so we can perhaps fix it (I'm not sure which one you mean :) ).

Thanks,

CE.

Posted: Fri Feb 06, 2009 09:48
by hurricane
CrazyEddie wrote:Hi.

can you link to the tutorial that incorrectly says the SDL scan codes are the same as CEGUI ones, so we can perhaps fix it (I'm not sure which one you mean :) ).

Thanks,

CE.


http://www.cegui.org.uk/wiki/index.php/ ... ting_Input

you say:

Luckily the key code is just the SDL scancode, so we inject that directly. (This only seems to be true on windows. On other platforms you will need to use a translation function. One can be found here SDL to CEGUI keytable)


i am in windows but i must use a translation function :(

Posted: Fri Feb 06, 2009 12:12
by CrazyEddie
Hi,

Thanks for pointing us to the offending Wiki article.

I guess it's possible that when that article was originally written, no translation was required, but subsequently a translation became necessary.

CE.