X-Git-Url: https://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/6fc75eb6ef197f7eefb586c09ca2bc79a50e7fd6..b2d84a4b240edc1e4e15793180529eacce45cec8:/mock/badge_main_loop.c?ds=inline diff --git a/mock/badge_main_loop.c b/mock/badge_main_loop.c index e893c18..376661b 100644 --- a/mock/badge_main_loop.c +++ b/mock/badge_main_loop.c @@ -13,9 +13,11 @@ #define MAX_LEVELS 1024 +#define PATH_PREFIX "../badge/jumpnrun/levels/" + void badge_main_loop(void) { char menu_buf[MAX_LEVELS][32]; - FILE *fd = fopen("../badge/jumpnrun/levels.txt", "r"); + FILE *fd = fopen("levels.txt", "r"); int i; @@ -30,11 +32,14 @@ void badge_main_loop(void) { menu[j] = menu_buf[j]; } + uint8_t choice = 0; + uint8_t first_visible = 0; + for(;;) { - size_t choice = badge_menu(menu, ARRAY_SIZE(menu), 0, 0); + choice = badge_menu(menu, ARRAY_SIZE(menu), &first_visible, choice); char lvname[256]; - sprintf(lvname, "../badge/jumpnrun/%s.lvl", menu[choice]); + sprintf(lvname, PATH_PREFIX "%s.lvl", menu[choice]); - jumpnrun_play(lvname); + jumpnrun_play_level(lvname); } }