}
size_t badge_menu(char const *const *menu,
- size_t n,
- size_t first_visible,
- size_t selected)
+ size_t n,
+ size_t *first_visible,
+ size_t selected)
{
for(;;) {
- badge_menu_show(menu, n, first_visible, selected);
+ badge_menu_show(menu, n, *first_visible, selected);
badge_event_t ev;
return selected;
} else if((new_buttons & BADGE_EVENT_KEY_UP ) && selected != 0) {
--selected;
- if(first_visible != 0 && selected <= first_visible) {
- first_visible = selected - 1;
+ if(*first_visible != 0 && selected <= *first_visible) {
+ *first_visible = selected - 1;
}
} else if(new_buttons & BADGE_EVENT_KEY_DOWN && selected + 1 < n) {
++selected;
- if(first_visible + (MENU_ENTRIES_VISIBLE - 2 + (selected + 1 == n)) < selected) {
- first_visible = selected - (MENU_ENTRIES_VISIBLE - 2 + (selected + 1 == n));
+ if(*first_visible + (MENU_ENTRIES_VISIBLE - 2 + (selected + 1 == n)) < selected) {
+ *first_visible = selected - (MENU_ENTRIES_VISIBLE - 2 + (selected + 1 == n));
}
}
}
#!/usr/bin/make -f
CPPFLAGS = $$(pkg-config --cflags gtkmm-3.0) -I. -I ../badge
-CFLAGS = -Wall -Wextra -pedantic -std=c99 -Werror -O0 -g
-CXXFLAGS = -Wall -Wextra -pedantic -std=c++0x -Werror -O0 -g
+CFLAGS = -Wall -Wextra -pedantic -std=c99 -Werror -O0 -g -fstack-protector-all
+CXXFLAGS = -Wall -Wextra -pedantic -std=c++0x -Werror -O0 -g -fstack-protector-all
BADGE = badge
CONVERTER = level-converter
menu[j] = menu_buf[j];
}
+ size_t choice = 0;
+ size_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]);