mirror of
https://github.com/encounter/SDL.git
synced 2025-12-09 21:47:44 +00:00
Implemented SDL_GetHintBoolean() to make it easier to check boolean hints
This commit is contained in:
@@ -352,11 +352,9 @@ Android_RemoveJoystick(int device_id)
|
||||
int
|
||||
SDL_SYS_JoystickInit(void)
|
||||
{
|
||||
const char *hint;
|
||||
SDL_SYS_JoystickDetect();
|
||||
|
||||
hint = SDL_GetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK);
|
||||
if (!hint || SDL_atoi(hint)) {
|
||||
if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE)) {
|
||||
/* Default behavior, accelerometer as joystick */
|
||||
Android_AddJoystick(ANDROID_ACCELEROMETER_DEVICE_ID, ANDROID_ACCELEROMETER_NAME, SDL_TRUE, 0, 3, 0, 0);
|
||||
}
|
||||
|
||||
@@ -127,13 +127,11 @@ SDL_SYS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *contr
|
||||
}
|
||||
#if TARGET_OS_TV
|
||||
else if (controller.microGamepad) {
|
||||
const char *hint = SDL_GetHint(SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION);
|
||||
|
||||
device->naxes = 2; /* treat the touch surface as two axes */
|
||||
device->nhats = 0; /* apparently the touch surface-as-dpad is buggy */
|
||||
device->nbuttons = 3; /* AX, pause button */
|
||||
|
||||
controller.microGamepad.allowsRotation = (hint != NULL && *hint != '0');
|
||||
controller.microGamepad.allowsRotation = SDL_GetHintBoolean(SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION, SDL_FALSE);
|
||||
}
|
||||
#endif /* TARGET_OS_TV */
|
||||
|
||||
@@ -279,8 +277,7 @@ SDL_SYS_JoystickInit(void)
|
||||
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
|
||||
|
||||
#if !TARGET_OS_TV
|
||||
const char *hint = SDL_GetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK);
|
||||
if (!hint || SDL_atoi(hint)) {
|
||||
if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE)) {
|
||||
/* Default behavior, accelerometer as joystick */
|
||||
SDL_SYS_AddJoystickDevice(nil, SDL_TRUE);
|
||||
}
|
||||
|
||||
@@ -40,8 +40,7 @@ SDL_XInputUseOldJoystickMapping()
|
||||
{
|
||||
static int s_XInputUseOldJoystickMapping = -1;
|
||||
if (s_XInputUseOldJoystickMapping < 0) {
|
||||
const char *hint = SDL_GetHint(SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING);
|
||||
s_XInputUseOldJoystickMapping = (hint && *hint == '1') ? 1 : 0;
|
||||
s_XInputUseOldJoystickMapping = SDL_GetHintBoolean(SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING, SDL_FALSE);
|
||||
}
|
||||
return (s_XInputUseOldJoystickMapping > 0);
|
||||
}
|
||||
@@ -54,10 +53,7 @@ SDL_bool SDL_XINPUT_Enabled(void)
|
||||
int
|
||||
SDL_XINPUT_JoystickInit(void)
|
||||
{
|
||||
const char *env = SDL_GetHint(SDL_HINT_XINPUT_ENABLED);
|
||||
if (env && !SDL_atoi(env)) {
|
||||
s_bXInputEnabled = SDL_FALSE;
|
||||
}
|
||||
s_bXInputEnabled = SDL_GetHintBoolean(SDL_HINT_XINPUT_ENABLED, SDL_TRUE);
|
||||
|
||||
if (s_bXInputEnabled && WIN_LoadXInputDLL() < 0) {
|
||||
s_bXInputEnabled = SDL_FALSE; /* oh well. */
|
||||
|
||||
Reference in New Issue
Block a user