mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-07 20:08:13 +00:00
Update for SDL3 coding style (#6717)
I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base. In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted. The script I ran for the src directory is added as build-scripts/clang-format-src.sh This fixes: #6592 #6593 #6594
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
//#include "../../core/android/SDL_android.h"
|
||||
|
||||
#ifndef LOOPER_ID_USER
|
||||
#define LOOPER_ID_USER 3
|
||||
#define LOOPER_ID_USER 3
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
@@ -40,13 +40,12 @@ typedef struct
|
||||
SDL_SensorID instance_id;
|
||||
} SDL_AndroidSensor;
|
||||
|
||||
static ASensorManager* SDL_sensor_manager;
|
||||
static ALooper* SDL_sensor_looper;
|
||||
static ASensorManager *SDL_sensor_manager;
|
||||
static ALooper *SDL_sensor_looper;
|
||||
static SDL_AndroidSensor *SDL_sensors;
|
||||
static int SDL_sensors_count;
|
||||
|
||||
static int
|
||||
SDL_ANDROID_SensorInit(void)
|
||||
static int SDL_ANDROID_SensorInit(void)
|
||||
{
|
||||
int i, sensors_count;
|
||||
ASensorList sensors;
|
||||
@@ -81,25 +80,21 @@ SDL_ANDROID_SensorInit(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_ANDROID_SensorGetCount(void)
|
||||
static int SDL_ANDROID_SensorGetCount(void)
|
||||
{
|
||||
return SDL_sensors_count;
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_ANDROID_SensorDetect(void)
|
||||
static void SDL_ANDROID_SensorDetect(void)
|
||||
{
|
||||
}
|
||||
|
||||
static const char *
|
||||
SDL_ANDROID_SensorGetDeviceName(int device_index)
|
||||
static const char *SDL_ANDROID_SensorGetDeviceName(int device_index)
|
||||
{
|
||||
return ASensor_getName(SDL_sensors[device_index].asensor);
|
||||
}
|
||||
|
||||
static SDL_SensorType
|
||||
SDL_ANDROID_SensorGetDeviceType(int device_index)
|
||||
static SDL_SensorType SDL_ANDROID_SensorGetDeviceType(int device_index)
|
||||
{
|
||||
switch (ASensor_getType(SDL_sensors[device_index].asensor)) {
|
||||
case 0x00000001:
|
||||
@@ -111,20 +106,17 @@ SDL_ANDROID_SensorGetDeviceType(int device_index)
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_ANDROID_SensorGetDeviceNonPortableType(int device_index)
|
||||
static int SDL_ANDROID_SensorGetDeviceNonPortableType(int device_index)
|
||||
{
|
||||
return ASensor_getType(SDL_sensors[device_index].asensor);
|
||||
}
|
||||
|
||||
static SDL_SensorID
|
||||
SDL_ANDROID_SensorGetDeviceInstanceID(int device_index)
|
||||
static SDL_SensorID SDL_ANDROID_SensorGetDeviceInstanceID(int device_index)
|
||||
{
|
||||
return SDL_sensors[device_index].instance_id;
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_ANDROID_SensorOpen(SDL_Sensor *sensor, int device_index)
|
||||
static int SDL_ANDROID_SensorOpen(SDL_Sensor *sensor, int device_index)
|
||||
{
|
||||
struct sensor_hwdata *hwdata;
|
||||
int delay_us, min_delay_us;
|
||||
@@ -159,15 +151,14 @@ SDL_ANDROID_SensorOpen(SDL_Sensor *sensor, int device_index)
|
||||
sensor->hwdata = hwdata;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_ANDROID_SensorUpdate(SDL_Sensor *sensor)
|
||||
|
||||
static void SDL_ANDROID_SensorUpdate(SDL_Sensor *sensor)
|
||||
{
|
||||
int events;
|
||||
ASensorEvent event;
|
||||
struct android_poll_source* source;
|
||||
struct android_poll_source *source;
|
||||
|
||||
if (ALooper_pollAll(0, NULL, &events, (void**)&source) == LOOPER_ID_USER) {
|
||||
if (ALooper_pollAll(0, NULL, &events, (void **)&source) == LOOPER_ID_USER) {
|
||||
SDL_zero(event);
|
||||
while (ASensorEventQueue_getEvents(sensor->hwdata->eventqueue, &event, 1) > 0) {
|
||||
SDL_PrivateSensorUpdate(sensor, 0, event.data, SDL_arraysize(event.data));
|
||||
@@ -175,8 +166,7 @@ SDL_ANDROID_SensorUpdate(SDL_Sensor *sensor)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_ANDROID_SensorClose(SDL_Sensor *sensor)
|
||||
static void SDL_ANDROID_SensorClose(SDL_Sensor *sensor)
|
||||
{
|
||||
if (sensor->hwdata) {
|
||||
ASensorEventQueue_disableSensor(sensor->hwdata->eventqueue, sensor->hwdata->asensor);
|
||||
@@ -186,8 +176,7 @@ SDL_ANDROID_SensorClose(SDL_Sensor *sensor)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_ANDROID_SensorQuit(void)
|
||||
static void SDL_ANDROID_SensorQuit(void)
|
||||
{
|
||||
if (SDL_sensors) {
|
||||
SDL_free(SDL_sensors);
|
||||
@@ -196,8 +185,7 @@ SDL_ANDROID_SensorQuit(void)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_SensorDriver SDL_ANDROID_SensorDriver =
|
||||
{
|
||||
SDL_SensorDriver SDL_ANDROID_SensorDriver = {
|
||||
SDL_ANDROID_SensorInit,
|
||||
SDL_ANDROID_SensorGetCount,
|
||||
SDL_ANDROID_SensorDetect,
|
||||
|
Reference in New Issue
Block a user