Key repeat is now enabled when typing text, some little cleanups, from

slayne


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@521 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
gewlitys
2003-01-02 16:58:59 +00:00
parent 74bebe800e
commit 0427622e3a
2 changed files with 10 additions and 5 deletions
+1
View File
@@ -1,4 +1,5 @@
0.2: 0.2:
- Key repeat is now enabled when typing text, from slayne
- Capital letter bug in new input code fixed, from slayne - Capital letter bug in new input code fixed, from slayne
- Oscilloscope now reacts to music when speech is disabled (OpenAL) -Mika - Oscilloscope now reacts to music when speech is disabled (OpenAL) -Mika
- Rewritten input code (better and adds joystick/pad support), from slayne - Rewritten input code (better and adds joystick/pad support), from slayne
+9 -5
View File
@@ -49,6 +49,7 @@ TFB_InitInput (int driver, int flags)
atexit (TFB_UninitInput); atexit (TFB_UninitInput);
SDL_EnableUNICODE(1); SDL_EnableUNICODE(1);
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
if ((SDL_InitSubSystem(SDL_INIT_JOYSTICK)) == -1) if ((SDL_InitSubSystem(SDL_INIT_JOYSTICK)) == -1)
{ {
@@ -116,7 +117,7 @@ ProcessKeyboardEvent(const SDL_Event *Event)
if (Event->type == SDL_KEYDOWN) if (Event->type == SDL_KEYDOWN)
{ {
if (Event->key.keysym.unicode != 0) if (Event->key.keysym.unicode != 0)
kbdbuf[kbdtail] = Event->key.keysym.unicode; kbdbuf[kbdtail] = (UNICODE) Event->key.keysym.unicode;
else else
kbdbuf[kbdtail] = KBDToUNICODE(k); kbdbuf[kbdtail] = KBDToUNICODE(k);
kbdtail = (kbdtail + 1) & (KBDBUFSIZE - 1); kbdtail = (kbdtail + 1) & (KBDBUFSIZE - 1);
@@ -401,18 +402,21 @@ _get_pause_exit_state (void)
return (InputState); return (InputState);
} }
// Status: Unimplemented
INPUT_STATE INPUT_STATE
_get_serial_keyboard_state (INPUT_REF ref, INPUT_STATE InputState) _get_serial_keyboard_state (INPUT_REF ref, INPUT_STATE InputState)
// I hope these are defined somewhere...
{ {
Uint16 key; Uint16 key;
(void) ref; (void) ref;
if ((key = GetUNICODEKey ()) == '\r') if ((key = GetUNICODEKey ()) == '\r')
key = '\n'; key = '\n';
SetInputUNICODE (&InputState, key); if (key != 0)
SetInputDevType (&InputState, KEYBOARD_DEVICE); {
SetInputUNICODE (&InputState, key);
SetInputDevType (&InputState, KEYBOARD_DEVICE);
}
else
InputState = 0;
return (InputState); return (InputState);
} }