diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-09-20 13:43:18 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-09-20 16:56:30 +0200 |
| commit | 87b4ef3a15af505f5ed5150ee1dadd2e2bc94c17 (patch) | |
| tree | f3d317088514089d0f84fb553cf9e307dffca549 /src/menu | |
| parent | 14df82ee4db71509f4ec4968df439d4659ca1ac3 (diff) | |
| download | jancity-87b4ef3a15af505f5ed5150ee1dadd2e2bc94c17.tar.gz | |
Remap calls to pad/mouse/keyboard to input
Diffstat (limited to 'src/menu')
| -rw-r--r-- | src/menu/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/menu/privinc/menu_private.h | 2 | ||||
| -rw-r--r-- | src/menu/src/gamecfg_menu.c | 4 | ||||
| -rw-r--r-- | src/menu/src/hostjoin_menu.c | 2 | ||||
| -rw-r--r-- | src/menu/src/main_menu.c | 2 | ||||
| -rw-r--r-- | src/menu/src/menu.c | 6 |
6 files changed, 12 insertions, 6 deletions
diff --git a/src/menu/CMakeLists.txt b/src/menu/CMakeLists.txt index 50246c4..940b26b 100644 --- a/src/menu/CMakeLists.txt +++ b/src/menu/CMakeLists.txt @@ -5,4 +5,4 @@ add_library(menu "src/main_menu.c" ) target_include_directories(menu PUBLIC "inc" PRIVATE "privinc") -target_link_libraries(menu PRIVATE camera game gfx gui system) +target_link_libraries(menu PRIVATE camera game gfx gui input system) diff --git a/src/menu/privinc/menu_private.h b/src/menu/privinc/menu_private.h index 1ab267b..0276b20 100644 --- a/src/menu/privinc/menu_private.h +++ b/src/menu/privinc/menu_private.h @@ -2,6 +2,7 @@ #define MENU_PRIVATE_H #include <camera.h> +#include <input.h> #include <peripheral.h> #include <stdbool.h> @@ -14,6 +15,7 @@ struct menu_common { struct camera cam; union peripheral p; + struct input in; }; int menu_update(struct menu_common *c, diff --git a/src/menu/src/gamecfg_menu.c b/src/menu/src/gamecfg_menu.c index 2cdd48f..12184f5 100644 --- a/src/menu/src/gamecfg_menu.c +++ b/src/menu/src/gamecfg_menu.c @@ -23,8 +23,8 @@ static int update(struct menu_common *const c, void *const arg) m->r.w = screen_w / 2; m->r.h = screen_h / 2; - if (gui_update(&m->cnt.common, &c->p, &c->cam) - || gui_update(&m->bcnt.common, &c->p, &c->cam)) + if (gui_update(&m->cnt.common, &c->p, &c->cam, &c->in) + || gui_update(&m->bcnt.common, &c->p, &c->cam, &c->in)) return -1; return 0; diff --git a/src/menu/src/hostjoin_menu.c b/src/menu/src/hostjoin_menu.c index 33ad3c8..49d5ec9 100644 --- a/src/menu/src/hostjoin_menu.c +++ b/src/menu/src/hostjoin_menu.c @@ -16,7 +16,7 @@ static int update(struct menu_common *const c, void *const arg) { struct menu_hostjoin *const m = arg; - if (gui_update(&m->cnt.common, &c->p, &c->cam)) + if (gui_update(&m->cnt.common, &c->p, &c->cam, &c->in)) return -1; return 0; diff --git a/src/menu/src/main_menu.c b/src/menu/src/main_menu.c index 9a99e7c..0c9ddb0 100644 --- a/src/menu/src/main_menu.c +++ b/src/menu/src/main_menu.c @@ -18,7 +18,7 @@ static int update(struct menu_common *const c, void *const arg) { struct main_menu *const m = arg; - if (gui_update(&m->play.common, &c->p, &c->cam)) + if (gui_update(&m->play.common, &c->p, &c->cam, &c->in)) return -1; return 0; diff --git a/src/menu/src/menu.c b/src/menu/src/menu.c index 200023c..ba90708 100644 --- a/src/menu/src/menu.c +++ b/src/menu/src/menu.c @@ -3,6 +3,7 @@ #include <camera.h> #include <game.h> #include <gfx.h> +#include <input.h> #include <peripheral.h> #include <system.h> #include <stdbool.h> @@ -19,7 +20,8 @@ int menu_update(struct menu_common *const c, { system_loop(); peripheral_update(&c->p); - camera_update(&c->cam, &c->p); + input_update(&c->in, &c->p); + camera_update(&c->cam, &c->p, &c->in); if (update && update(c, arg)) return -1; @@ -32,6 +34,8 @@ int menu_update(struct menu_common *const c, if (render && render(c, arg)) return -1; + else if (input_render(&c->in, &c->p)) + return -1; switch (c->p.common.type) { |
