diff --git a/sc2/ChangeLog b/sc2/ChangeLog index 9db9c9462..2baf93fb4 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,5 @@ 0.2: +- Capital letter bug in new input code fixed, from slayne - Oscilloscope now reacts to music when speech is disabled (OpenAL) -Mika - Rewritten input code (better and adds joystick/pad support), from slayne - Biadapt scaling for pure mode, from fOSSiL diff --git a/sc2/src/sc2code/libs/graphics/sdl/sdl_common.c b/sc2/src/sc2code/libs/graphics/sdl/sdl_common.c index 27cdcfcc9..6b040339e 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/sdl_common.c +++ b/sc2/src/sc2code/libs/graphics/sdl/sdl_common.c @@ -69,7 +69,6 @@ TFB_InitGraphics (int driver, int flags, int width, int height, int bpp) result = TFB_Pure_InitGraphics (driver, flags, width, height, bpp); } - SDL_EnableUNICODE (1); sprintf (caption, "The Ur-Quan Masters v%d.%d", UQM_MAJOR_VERSION, UQM_MINOR_VERSION); SDL_WM_SetCaption (caption, NULL); diff --git a/sc2/src/sc2code/libs/input/sdl/input.c b/sc2/src/sc2code/libs/input/sdl/input.c index 4bb95de2b..28f202c53 100644 --- a/sc2/src/sc2code/libs/input/sdl/input.c +++ b/sc2/src/sc2code/libs/input/sdl/input.c @@ -24,7 +24,7 @@ static Uint8 KeyboardDown[SDLK_LAST]; #define KBDBUFSIZE (1 << 8) static int kbdhead=0, kbdtail=0; -static SDLKey kbdbuf[KBDBUFSIZE]; +static UNICODE kbdbuf[KBDBUFSIZE]; static int nJoysticks = 0; static SDL_Joystick **Joysticks = 0; @@ -48,6 +48,8 @@ TFB_InitInput (int driver, int flags) atexit (TFB_UninitInput); + SDL_EnableUNICODE(1); + if ((SDL_InitSubSystem(SDL_INIT_JOYSTICK)) == -1) { fprintf (stderr, "Couldn't initialize joystick subsystem: %s\n", SDL_GetError()); @@ -113,7 +115,10 @@ ProcessKeyboardEvent(const SDL_Event *Event) if (Event->type == SDL_KEYDOWN) { - kbdbuf[kbdtail] = k; + if (Event->key.keysym.unicode != 0) + kbdbuf[kbdtail] = Event->key.keysym.unicode; + else + kbdbuf[kbdtail] = KBDToUNICODE(k); kbdtail = (kbdtail + 1) & (KBDBUFSIZE - 1); if (kbdtail == kbdhead) kbdhead = (kbdhead + 1) & (KBDBUFSIZE - 1); @@ -316,11 +321,11 @@ GetUNICODEKey (void) { if (kbdtail != kbdhead) { - SDLKey ch; + UNICODE ch; ch = kbdbuf[kbdhead]; kbdhead = (kbdhead + 1) & (KBDBUFSIZE - 1); - return KBDToUNICODE(ch); + return (ch); } return (0); }