commit db9aee2bebf410ed9e4d44b1fae35a27de40289f
Author: Simon Howard <fraggle@gmail.com>
AuthorDate: Tue Apr 29 01:09:07 2014 -0400
Commit: Simon Howard <fraggle@gmail.com>
CommitDate: Tue Apr 29 01:09:07 2014 -0400
setup: Allow backspace or del to clear controls.
Backspace or delete clears other input boxes; make it do the same for
keyboard, mouse and joystick inputs.
---
src/setup/txt_joybinput.c | 9 +++++++--
src/setup/txt_keyinput.c | 5 +++++
src/setup/txt_mouseinput.c | 9 +++++++--
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/setup/txt_joybinput.c b/src/setup/txt_joybinput.c
index 4e41f3fd..f431690b 100644
--- a/src/setup/txt_joybinput.c
+++ b/src/setup/txt_joybinput.c
@@ -161,11 +161,11 @@ static void TXT_JoystickInputDestructor(TXT_UNCAST_ARG(joystick_input))
{
}
-static int TXT_JoystickInputKeyPress(TXT_UNCAST_ARG(joystick_input), int joystick)
+static int TXT_JoystickInputKeyPress(TXT_UNCAST_ARG(joystick_input), int key)
{
TXT_CAST_ARG(txt_joystick_input_t, joystick_input);
- if (joystick == KEY_ENTER)
+ if (key == KEY_ENTER)
{
// Open a window to prompt for the new joystick press
@@ -174,6 +174,11 @@ static int TXT_JoystickInputKeyPress(TXT_UNCAST_ARG(joystick_input), int joystic
return 1;
}
+ if (key == KEY_BACKSPACE || key == KEY_DEL)
+ {
+ *joystick_input->variable = -1;
+ }
+
return 0;
}
diff --git a/src/setup/txt_keyinput.c b/src/setup/txt_keyinput.c
index a35f22e1..60fae1bf 100644
--- a/src/setup/txt_keyinput.c
+++ b/src/setup/txt_keyinput.c
@@ -146,6 +146,11 @@ static int TXT_KeyInputKeyPress(TXT_UNCAST_ARG(key_input), int key)
return 1;
}
+ if (key == KEY_BACKSPACE || key == KEY_DEL)
+ {
+ *key_input->variable = 0;
+ }
+
return 0;
}
diff --git a/src/setup/txt_mouseinput.c b/src/setup/txt_mouseinput.c
index aec7d5d9..a966c10f 100644
--- a/src/setup/txt_mouseinput.c
+++ b/src/setup/txt_mouseinput.c
@@ -125,11 +125,11 @@ static void TXT_MouseInputDestructor(TXT_UNCAST_ARG(mouse_input))
{
}
-static int TXT_MouseInputKeyPress(TXT_UNCAST_ARG(mouse_input), int mouse)
+static int TXT_MouseInputKeyPress(TXT_UNCAST_ARG(mouse_input), int key)
{
TXT_CAST_ARG(txt_mouse_input_t, mouse_input);
- if (mouse == KEY_ENTER)
+ if (key == KEY_ENTER)
{
// Open a window to prompt for the new mouse press
@@ -138,6 +138,11 @@ static int TXT_MouseInputKeyPress(TXT_UNCAST_ARG(mouse_input), int mouse)
return 1;
}
+ if (key == KEY_BACKSPACE || key == KEY_DEL)
+ {
+ *mouse_input->variable = -1;
+ }
+
return 0;
}