Fix spacing; tabs to 4 spaces

This commit is contained in:
DamianS-eng 2025-03-14 17:18:44 -04:00 committed by Sam Lantinga
parent 60857935ca
commit 3b90ce4995
1 changed files with 35 additions and 35 deletions

View File

@ -242,23 +242,23 @@ static SDL_AppResult handle_key_event_(SnakeContext *ctx, SDL_Scancode key_code)
} }
static SDL_AppResult handle_hat_event_(SnakeContext *ctx, Uint8 hat) { static SDL_AppResult handle_hat_event_(SnakeContext *ctx, Uint8 hat) {
switch (hat) { switch (hat) {
case SDL_HAT_RIGHT: case SDL_HAT_RIGHT:
snake_redir(ctx, SNAKE_DIR_RIGHT); snake_redir(ctx, SNAKE_DIR_RIGHT);
break; break;
case SDL_HAT_UP: case SDL_HAT_UP:
snake_redir(ctx, SNAKE_DIR_UP); snake_redir(ctx, SNAKE_DIR_UP);
break; break;
case SDL_HAT_LEFT: case SDL_HAT_LEFT:
snake_redir(ctx, SNAKE_DIR_LEFT); snake_redir(ctx, SNAKE_DIR_LEFT);
break; break;
case SDL_HAT_DOWN: case SDL_HAT_DOWN:
snake_redir(ctx, SNAKE_DIR_DOWN); snake_redir(ctx, SNAKE_DIR_DOWN);
break; break;
default: default:
break; break;
} }
return SDL_APP_CONTINUE; return SDL_APP_CONTINUE;
} }
SDL_AppResult SDL_AppIterate(void *appstate) SDL_AppResult SDL_AppIterate(void *appstate)
@ -329,7 +329,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
} }
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK)) { if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK)) {
SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
return SDL_APP_FAILURE; return SDL_APP_FAILURE;
} }
@ -357,20 +357,20 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
switch (event->type) { switch (event->type) {
case SDL_EVENT_QUIT: case SDL_EVENT_QUIT:
return SDL_APP_SUCCESS; return SDL_APP_SUCCESS;
case SDL_EVENT_JOYSTICK_ADDED: case SDL_EVENT_JOYSTICK_ADDED:
if (joystick == NULL) { if (joystick == NULL) {
joystick = SDL_OpenJoystick(event->jdevice.which); joystick = SDL_OpenJoystick(event->jdevice.which);
if (!joystick) { if (!joystick) {
SDL_Log("Failed to open joystick ID %u: %s", (unsigned int) event->jdevice.which, SDL_GetError()); SDL_Log("Failed to open joystick ID %u: %s", (unsigned int) event->jdevice.which, SDL_GetError());
} }
} }
case SDL_EVENT_JOYSTICK_REMOVED: case SDL_EVENT_JOYSTICK_REMOVED:
if (joystick && (SDL_GetJoystickID(joystick) == event->jdevice.which)) { if (joystick && (SDL_GetJoystickID(joystick) == event->jdevice.which)) {
SDL_CloseJoystick(joystick); SDL_CloseJoystick(joystick);
joystick = NULL; joystick = NULL;
} }
case SDL_EVENT_JOYSTICK_HAT_MOTION: case SDL_EVENT_JOYSTICK_HAT_MOTION:
return handle_hat_event_(ctx, event->jhat.value); return handle_hat_event_(ctx, event->jhat.value);
case SDL_EVENT_KEY_DOWN: case SDL_EVENT_KEY_DOWN:
return handle_key_event_(ctx, event->key.scancode); return handle_key_event_(ctx, event->key.scancode);
} }
@ -379,9 +379,9 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
void SDL_AppQuit(void *appstate, SDL_AppResult result) void SDL_AppQuit(void *appstate, SDL_AppResult result)
{ {
if (joystick) { if (joystick) {
SDL_CloseJoystick(joystick); SDL_CloseJoystick(joystick);
} }
if (appstate != NULL) { if (appstate != NULL) {
AppState *as = (AppState *)appstate; AppState *as = (AppState *)appstate;
SDL_DestroyRenderer(as->renderer); SDL_DestroyRenderer(as->renderer);