summaryrefslogtreecommitdiff
path: root/src/setup
diff options
context:
space:
mode:
authorSimon Howard2015-04-15 20:52:23 -0400
committerSimon Howard2015-04-15 20:52:23 -0400
commitec72b141f47cd1a5b061f9bc87c1a02e2722be59 (patch)
tree3fd481e267b95d3c4c067c36a6285bd365a66016 /src/setup
parent6a1179122850be4da020b45f5dd1bf1c8c068b09 (diff)
downloadchocolate-doom-ec72b141f47cd1a5b061f9bc87c1a02e2722be59.tar.gz
chocolate-doom-ec72b141f47cd1a5b061f9bc87c1a02e2722be59.tar.bz2
chocolate-doom-ec72b141f47cd1a5b061f9bc87c1a02e2722be59.zip
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.
Diffstat (limited to 'src/setup')
-rw-r--r--src/setup/joystick.c26
1 files 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);