commit ec72b141f47cd1a5b061f9bc87c1a02e2722be59
Author: Simon Howard <fraggle@soulsphere.org>
AuthorDate: Wed Apr 15 20:52:23 2015 -0400
Commit: Simon Howard <fraggle@soulsphere.org>
CommitDate: Wed Apr 15 20:52:23 2015 -0400
setup: Remove "enable gamepad" checkbox.
This control seemed redundant, as we have the control below it that
selects the gamepad to use. So remove it and set the usejoystick
variable automatically based on whether joystick_index has been
configured to point to a valid device.
---
src/setup/joystick.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/setup/joystick.c b/src/setup/joystick.c
index cad1a92f..22b1a089 100644
--- a/src/setup/joystick.c
+++ b/src/setup/joystick.c
@@ -568,7 +568,7 @@ static int OpenAllJoysticks(void)
result = 0;
- for (i=0; i<num_joysticks; ++i)
+ for (i = 0; i < num_joysticks; ++i)
{
all_joysticks[i] = SDL_JoystickOpen(i);
@@ -604,7 +604,7 @@ static void CloseAllJoysticks(void)
num_joysticks = SDL_NumJoysticks();
- for (i=0; i<num_joysticks; ++i)
+ for (i = 0; i < num_joysticks; ++i)
{
if (all_joysticks[i] != NULL)
{
@@ -635,6 +635,7 @@ static int CalibrationEventCallback(SDL_Event *event, void *user_data)
// At this point, we have a button press.
// In the first "center" stage, we're just trying to work out which
// joystick is being configured and which button the user is pressing.
+ usejoystick = 1;
joystick_index = event->jbutton.which;
calibrate_button = event->jbutton.button;
@@ -643,7 +644,6 @@ static int CalibrationEventCallback(SDL_Event *event, void *user_data)
if (IsKnownJoystick(joystick_index))
{
LoadKnownConfiguration();
- usejoystick = 1;
TXT_CloseWindow(calibration_window);
}
else
@@ -661,11 +661,12 @@ static int CalibrationEventCallback(SDL_Event *event, void *user_data)
static void NoJoystick(void)
{
- TXT_MessageBox(NULL, "No joysticks or gamepads could be found.\n\n"
+ TXT_MessageBox(NULL, "No gamepads or joysticks could be found.\n\n"
"Try configuring your controller from within\n"
"your OS first. Maybe you need to install\n"
"some drivers or otherwise configure it.");
+ usejoystick = 0;
joystick_index = -1;
SetJoystickButtonLabel();
}
@@ -707,7 +708,7 @@ static void CalibrateJoystick(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
TXT_SignalConnect(calibration_window, "closed", CalibrateWindowClosed, NULL);
// Start calibration
-
+ usejoystick = 0;
joystick_index = -1;
}
@@ -736,7 +737,6 @@ void ConfigJoystick(void)
TXT_SetWindowHelpURL(window, WINDOW_HELP_URL);
TXT_AddWidgets(window,
- TXT_NewCheckBox("Enable gamepad/joystick", &usejoystick),
joystick_table = TXT_NewTable(2),
TXT_NewSeparator("Axes"),
axis_table = TXT_NewTable(2),
@@ -744,6 +744,13 @@ void ConfigJoystick(void)
button_table = TXT_NewTable(4),
NULL);
+ TXT_SetColumnWidths(joystick_table, 13, 40);
+
+ TXT_AddWidgets(joystick_table,
+ TXT_NewLabel("Controller"),
+ joystick_button = TXT_NewButton("zzzz"),
+ NULL);
+
TXT_SetColumnWidths(axis_table, 20, 15);
TXT_AddWidgets(axis_table,
@@ -761,13 +768,6 @@ void ConfigJoystick(void)
JOYSTICK_AXIS_HORIZONTAL),
NULL);
- TXT_SetColumnWidths(joystick_table, 20, 15);
-
- TXT_AddWidgets(joystick_table,
- TXT_NewLabel("Current controller"),
- joystick_button = TXT_NewButton("zzzz"),
- NULL);
-
TXT_SetColumnWidths(button_table, 16, 12, 14, 11);
AddJoystickControl(button_table, "Fire/Attack", &joybfire);