Keyboard fixes.. thx to 'ob1kenewb'

origin
stpohle 23 years ago
parent e2516eaad9
commit 9d41a6c1c7

@ -35,7 +35,7 @@ int keybinput_loop (_keybinput *ki, SDL_Event *event) {
} }
else if (key >= ' ' && key <= 'z') { else if (key >= ' ' && key <= 'z') {
if (ki->curpos < 255) { if (ki->curpos < 255) {
ki->text[ki->curpos++] = key; ki->text[ki->curpos++] = event->key.keysym.unicode;
ki->text[ki->curpos] = 0; ki->text[ki->curpos] = 0;
ki->changed = 1; ki->changed = 1;
} }

@ -27,6 +27,7 @@ main (int argc, char **argv)
sprintf (text,"Bomberclone %s", VERSION); sprintf (text,"Bomberclone %s", VERSION);
SDL_WM_SetCaption(text , NULL); SDL_WM_SetCaption(text , NULL);
SDL_EnableUNICODE(1);
game_init (argv); game_init (argv);
d_printf ("\n\n ***** Bomberclone Version %s \n\n",VERSION); d_printf ("\n\n ***** Bomberclone Version %s \n\n",VERSION);

@ -251,7 +251,7 @@ menu_get_text (char *title, char *text, int len)
if (!keypressed && keys[i] && event.type == SDL_KEYDOWN) { if (!keypressed && keys[i] && event.type == SDL_KEYDOWN) {
if (t[curpos] == 0) if (t[curpos] == 0)
t[curpos + 1] = 0; t[curpos + 1] = 0;
t[curpos] = i; t[curpos] = event.key.keysym.unicode;
if (curpos < strlen (t) && curpos < len - 1) if (curpos < strlen (t) && curpos < len - 1)
curpos++; curpos++;
keypressed = 1; keypressed = 1;

Loading…
Cancel
Save