Cut out text input from SDL2 until it can be tested
This commit is contained in:
@@ -33,13 +33,16 @@
|
|||||||
static int kbdhead=0, kbdtail=0;
|
static int kbdhead=0, kbdtail=0;
|
||||||
static UniChar kbdbuf[KBDBUFSIZE];
|
static UniChar kbdbuf[KBDBUFSIZE];
|
||||||
static UniChar lastchar;
|
static UniChar lastchar;
|
||||||
|
#ifdef SDL_MAJOR_VERSION == 1
|
||||||
static unsigned int num_keys = 0;
|
static unsigned int num_keys = 0;
|
||||||
static int *kbdstate = NULL;
|
static int *kbdstate = NULL;
|
||||||
// Holds all SDL keys +1 for holding invalid values
|
// Holds all SDL keys +1 for holding invalid values
|
||||||
|
#endif // Later versions of SDL use the text input API instead
|
||||||
|
|
||||||
static volatile int *menu_vec;
|
static volatile int *menu_vec;
|
||||||
static int num_menu;
|
static int num_menu;
|
||||||
// The last vector element is the character repeat "key"
|
// The last vector element is the character repeat "key"
|
||||||
|
// This is only used in SDL1 input but it's mostly harmless everywhere else
|
||||||
#define KEY_MENU_ANY (num_menu - 1)
|
#define KEY_MENU_ANY (num_menu - 1)
|
||||||
static volatile int *flight_vec;
|
static volatile int *flight_vec;
|
||||||
static int num_templ;
|
static int num_templ;
|
||||||
@@ -193,8 +196,10 @@ initKeyConfig (void)
|
|||||||
static void
|
static void
|
||||||
resetKeyboardState (void)
|
resetKeyboardState (void)
|
||||||
{
|
{
|
||||||
|
#if SDL_MAJOR_VERSION == 1
|
||||||
memset (kbdstate, 0, sizeof (int) * num_keys);
|
memset (kbdstate, 0, sizeof (int) * num_keys);
|
||||||
menu_vec[KEY_MENU_ANY] = 0;
|
menu_vec[KEY_MENU_ANY] = 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -221,9 +226,11 @@ TFB_InitInput (int driver, int flags)
|
|||||||
(void)driver;
|
(void)driver;
|
||||||
(void)flags;
|
(void)flags;
|
||||||
|
|
||||||
|
#if SDL_MAJOR_VERSION == 1
|
||||||
SDL_EnableUNICODE(1);
|
SDL_EnableUNICODE(1);
|
||||||
(void)SDL_GetKeyState (&num_keys);
|
(void)SDL_GetKeyState (&num_keys);
|
||||||
kbdstate = (int *)HMalloc (sizeof (int) * (num_keys + 1));
|
kbdstate = (int *)HMalloc (sizeof (int) * (num_keys + 1));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_JOYSTICK
|
#ifdef HAVE_JOYSTICK
|
||||||
@@ -329,6 +336,8 @@ ProcessMouseEvent (const SDL_Event *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SDL_MAJOR_VERSION == 1
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
is_numpad_char_event (const SDL_Event *Event)
|
is_numpad_char_event (const SDL_Event *Event)
|
||||||
{
|
{
|
||||||
@@ -397,6 +406,22 @@ ProcessInputEvent (const SDL_Event *Event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
void
|
||||||
|
ProcessInputEvent (const SDL_Event *Event)
|
||||||
|
{
|
||||||
|
if (!InputInitialized)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ProcessMouseEvent (Event);
|
||||||
|
|
||||||
|
/* TODO: Block numpad input when NUM_LOCK is on */
|
||||||
|
VControl_HandleEvent (Event);
|
||||||
|
|
||||||
|
/* TODO: Handle SDL_TEXTINPUT events */
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
TFB_ResetControls (void)
|
TFB_ResetControls (void)
|
||||||
|
|||||||
Reference in New Issue
Block a user