Use C99 bool internally in SDL

This commit is contained in:
Sam Lantinga
2024-08-22 09:21:26 -07:00
parent 6501e90018
commit 8f546bb3c9
450 changed files with 6046 additions and 6033 deletions

View File

@@ -495,10 +495,10 @@ static void VIRTUAL_JoystickDetect(void)
{
}
static SDL_bool VIRTUAL_JoystickIsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name)
static bool VIRTUAL_JoystickIsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name)
{
// We don't override any other drivers... or do we?
return SDL_FALSE;
return false;
}
static const char *VIRTUAL_JoystickGetDeviceName(int device_index)
@@ -580,13 +580,13 @@ static int VIRTUAL_JoystickOpen(SDL_Joystick *joystick, int device_index)
}
if (hwdata->desc.SetLED) {
SDL_SetBooleanProperty(SDL_GetJoystickProperties(joystick), SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN, SDL_TRUE);
SDL_SetBooleanProperty(SDL_GetJoystickProperties(joystick), SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN, true);
}
if (hwdata->desc.Rumble) {
SDL_SetBooleanProperty(SDL_GetJoystickProperties(joystick), SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN, SDL_TRUE);
SDL_SetBooleanProperty(SDL_GetJoystickProperties(joystick), SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN, true);
}
if (hwdata->desc.RumbleTriggers) {
SDL_SetBooleanProperty(SDL_GetJoystickProperties(joystick), SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN, SDL_TRUE);
SDL_SetBooleanProperty(SDL_GetJoystickProperties(joystick), SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN, true);
}
return 0;
}
@@ -671,7 +671,7 @@ static int VIRTUAL_JoystickSendEffect(SDL_Joystick *joystick, const void *data,
return result;
}
static int VIRTUAL_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled)
static int VIRTUAL_JoystickSetSensorsEnabled(SDL_Joystick *joystick, bool enabled)
{
int result;
@@ -780,14 +780,14 @@ static void VIRTUAL_JoystickQuit(void)
}
}
static SDL_bool VIRTUAL_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
static bool VIRTUAL_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
{
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
Uint8 current_button = 0;
Uint8 current_axis = 0;
if (!hwdata || hwdata->desc.type != SDL_JOYSTICK_TYPE_GAMEPAD) {
return SDL_FALSE;
return false;
}
if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_GAMEPAD_BUTTON_SOUTH))) {
@@ -950,7 +950,7 @@ static SDL_bool VIRTUAL_JoystickGetGamepadMapping(int device_index, SDL_GamepadM
out->righttrigger.target = current_axis++;
}
return SDL_TRUE;
return true;
}
SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver = {

View File

@@ -47,7 +47,7 @@ typedef struct VirtualSensorEvent
typedef struct joystick_hwdata
{
SDL_JoystickID instance_id;
SDL_bool attached;
bool attached;
char *name;
SDL_JoystickType type;
SDL_GUID guid;
@@ -59,7 +59,7 @@ typedef struct joystick_hwdata
SDL_JoystickBallData *balls;
SDL_JoystickTouchpadInfo *touchpads;
SDL_JoystickSensorInfo *sensors;
SDL_bool sensors_enabled;
bool sensors_enabled;
int num_sensor_events;
int max_sensor_events;
VirtualSensorEvent *sensor_events;