diff options
author | Simon Howard | 2007-06-13 19:12:13 +0000 |
---|---|---|
committer | Simon Howard | 2007-06-13 19:12:13 +0000 |
commit | e4127187e0e5de9c94a92301b4dc780bc9153fb8 (patch) | |
tree | b0c3c6205739d10d6c1c98c31d70d07f63314e2a /setup/txt_joybinput.c | |
parent | 22d473c19cddb35c8ba90fbe52beb7dff8377688 (diff) | |
download | chocolate-doom-e4127187e0e5de9c94a92301b4dc780bc9153fb8.tar.gz chocolate-doom-e4127187e0e5de9c94a92301b4dc780bc9153fb8.tar.bz2 chocolate-doom-e4127187e0e5de9c94a92301b4dc780bc9153fb8.zip |
Working joystick code.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 903
Diffstat (limited to 'setup/txt_joybinput.c')
-rw-r--r-- | setup/txt_joybinput.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/setup/txt_joybinput.c b/setup/txt_joybinput.c index 56aaa47e..0f05eaf4 100644 --- a/setup/txt_joybinput.c +++ b/setup/txt_joybinput.c @@ -64,6 +64,8 @@ static void PromptWindowClosed(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(joystick)) SDL_JoystickClose(joystick); TXT_SDL_SetEventCallback(NULL, NULL); + SDL_JoystickEventState(SDL_DISABLE); + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); } static void OpenErrorWindow(void) @@ -86,6 +88,11 @@ static void OpenPromptWindow(txt_joystick_input_t *joystick_input) txt_label_t *label; SDL_Joystick *joystick; + if (SDL_Init(SDL_INIT_JOYSTICK) < 0) + { + return; + } + // Check the current joystick is valid joystick = SDL_JoystickOpen(joystick_index); @@ -111,6 +118,8 @@ static void OpenPromptWindow(txt_joystick_input_t *joystick_input) TXT_SDL_SetEventCallback(EventCallback, joystick_input); TXT_SignalConnect(window, "closed", PromptWindowClosed, joystick); joystick_input->prompt_window = window; + + SDL_JoystickEventState(SDL_ENABLE); } static void TXT_JoystickInputSizeCalc(TXT_UNCAST_ARG(joystick_input)) |