- char const *const menu[] = {
- "smb",
- "skynet",
- "wrongturn",
- "lubiXOXO",
- "lubilove",
- "gnobbel",
- "foo",
- "mean",
- "xyzzy",
- "abc",
- "nonsense"
- };
-
- size_t choice = badge_menu(menu, ARRAY_SIZE(menu), 0, 0);
-
- printf("%zu\n", choice);
+ char menu_buf[MAX_LEVELS][32];
+ FILE *fd = fopen("levels.txt", "r");
+
+ int i;
+
+ for(i = 0; i < MAX_LEVELS && fgets(menu_buf[i], sizeof(menu_buf[i]), fd); ++i) {
+ menu_buf[i][strlen(menu_buf[i]) - 1] = '\0';
+ }
+
+ fclose(fd);
+
+ char const *menu[i];
+ for(int j = 0; j < i; ++j) {
+ menu[j] = menu_buf[j];
+ }
+
+ size_t choice = 0;
+ size_t first_visible = 0;