diff --git a/.gitmodules b/.gitmodules index fac6899..ea0ee05 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/deps/libakerror b/deps/libakerror index 03e9b8a..be2dba8 160000 --- a/deps/libakerror +++ b/deps/libakerror @@ -1 +1 @@ -Subproject commit 03e9b8a96dadfe1439d6bb68dc40bea334f08ce8 +Subproject commit be2dba8416d98a3b23f2cd39747fff4275177fc8 diff --git a/deps/libakgl b/deps/libakgl index f695a03..e3edd5b 160000 --- a/deps/libakgl +++ b/deps/libakgl @@ -1 +1 @@ -Subproject commit f695a035c8978129217201d60dfc4fc5e485882a +Subproject commit e3edd5b85575c774acc58ec1056488ffeb556953 diff --git a/src/akgltest.c b/src/akgltest.c index aa90dae..6b8a4c5 100644 --- a/src/akgltest.c +++ b/src/akgltest.c @@ -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); }