Consolidate controller default bindings, fix gamepad bindings

This commit is contained in:
2026-05-21 21:47:22 -04:00
parent 9c1e94894f
commit 14ed90b5f4
4 changed files with 38 additions and 18 deletions

6
.gitmodules vendored
View File

@@ -12,13 +12,13 @@
url = git@github.com:libsdl-org/SDL_ttf.git
[submodule "deps/libakgl"]
path = deps/libakgl
url = https://source.home.aklabs.net/andrew/libakgl.git
url = https://source.starfort.tech/andrew/libakgl.git
[submodule "deps/libsdlerror"]
path = deps/libakerror
url = https://source.home.aklabs.net/andrew/libsdlerror.git
url = https://source.starfort.tech/andrew/libakerror.git
[submodule "deps/libakstdlib"]
path = deps/libakstdlib
url = https://source.home.aklabs.net/andrew/libakstdlib.git
url = https://source.starfort.tech/andrew/libakstdlib.git
[submodule "deps/jansson"]
path = deps/jansson
url = git@github.com:akheron/jansson.git

2
deps/libakgl vendored

View File

@@ -287,6 +287,38 @@ akerr_ErrorContext AKERR_NOIGNORE *akgltest_controller_bind_universal(char *acto
control.event_on = SDL_EVENT_KEY_DOWN;
control.handler_on = &music_toggle;
PASS(e, akgl_controller_pushmap(mapid, &control));
// Save the game
control.key = SDLK_S;
control.event_on = SDL_EVENT_KEY_DOWN;
control.handler_on = &savegame;
PASS(e, akgl_controller_pushmap(AKGLTEST_CONTROLMAP_INGAMEACTOR, &control));
// Menu selection
control.key = SDLK_RETURN;
control.event_on = SDL_EVENT_KEY_DOWN;
control.handler_on = &akgltest_set_gamemode_running;
PASS(e, akgl_controller_pushmap(AKGLTEST_CONTROLMAP_MENU, &control));
if ( jsid != 0 ) {
// Gamepad Menu selection. Use whatever button they pushed as the action
control.button = SDL_GAMEPAD_BUTTON_START;
control.event_on = SDL_EVENT_GAMEPAD_BUTTON_UP;
control.handler_on = &akgltest_set_gamemode_running;
PASS(e, akgl_controller_pushmap(AKGLTEST_CONTROLMAP_MENU, &control));
// Toggle the music
control.button = SDL_GAMEPAD_BUTTON_SOUTH;
control.event_on = SDL_EVENT_GAMEPAD_BUTTON_UP;
control.handler_on = &music_toggle;
PASS(e, akgl_controller_pushmap(mapid, &control));
// Quit
control.button = SDL_GAMEPAD_BUTTON_EAST;
control.event_on = SDL_EVENT_GAMEPAD_BUTTON_UP;
control.handler_on = &akgltest_set_gamemode_menu;
PASS(e, akgl_controller_pushmap(mapid, &control));
}
}
@@ -306,19 +338,7 @@ akerr_ErrorContext AKERR_NOIGNORE *akgltest_controller_get_defaults(void *appsta
PASS(e, akgltest_controller_bind_universal("player", AKGLTEST_CONTROLMAP_MENU, kbid, jsid));
PASS(e, akgltest_controller_bind_universal("menupointer", AKGLTEST_CONTROLMAP_INGAMEACTOR, kbid, jsid));
// Save the game
control.key = SDLK_S;
control.event_on = SDL_EVENT_KEY_DOWN;
control.handler_on = &savegame;
PASS(e, akgl_controller_pushmap(AKGLTEST_CONTROLMAP_INGAMEACTOR, &control));
// Menu selection
control.key = SDLK_RETURN;
control.event_on = SDL_EVENT_KEY_DOWN;
control.handler_on = &akgltest_set_gamemode_running;
PASS(e, akgl_controller_pushmap(AKGLTEST_CONTROLMAP_MENU, &control));
SUCCEED_RETURN(e);
}