#endif
#include "init.h"
+#include "ui/browser.h"
#include "ui/display.h"
#include "ui/event.h"
#include "ui/font.h"
#include "ui/menu.h"
#include "ui/sprite.h"
+#include "ui/vanity.h"
#include "util/util.h"
#include "jumpnrun/jumpnrun.h"
#endif
-void usbmode(void) {
- badge_framebuffer fb = { { { 0 } } };
+static void usbmode(void) {
+ badge_event_stop();
- badge_framebuffer_render_text(&fb, 23, 30, "USB-Modus");
+ badge_framebuffer fb = { { { 0 } } };
+
+ badge_framebuffer_render_text(&fb, 23, 30, "USB-Modus");
/*
badge_framebuffer_render_number(&fb, 23, 50, sizeof(jumpnrun_tile));
badge_framebuffer_render_number(&fb, 33, 50, sizeof(jumpnrun_item));
badge_framebuffer_render_number(&fb, 48, 50, sizeof(jumpnrun_enemy));
*/
- badge_framebuffer_flush(&fb);
- usbMSCInit();
- for(;;);
+ badge_framebuffer_flush(&fb);
+ usbMSCInit();
+ for(;;);
}
-void scrolltest(void) {
- char menu_buf[][15] = {
- "foo",
- "bar",
- "baz",
- "qux",
- "foo",
- "bar",
- "baz",
- "qux",
- "foo",
- "bar",
- "baz",
- "qux",
- "foo",
- "bar",
- "baz",
- "qux",
- };
+static void fahrplan(void) {
+ f_chdir("/fahrplan");
+ badge_browse_textfiles("fahrplan.lst");
+}
- char const * menu_index[] = {
- menu_buf[0],
- menu_buf[1],
- menu_buf[2],
- menu_buf[3],
- menu_buf[4],
- menu_buf[5],
- menu_buf[6],
- menu_buf[7],
- menu_buf[8],
- menu_buf[9],
- menu_buf[10],
- menu_buf[11],
- menu_buf[12],
- menu_buf[13],
- menu_buf[14],
- menu_buf[15]
+uint8_t main_menu_show(uint8_t selected) {
+ char const menu_buf[][15] = {
+ "Vanity-Screen",
+ "Super Hackio",
+ "Fahrplan",
+ "USB-Modus"
};
- badge_scroll_text(menu_index, 16);
+ char const *menu[ARRAY_SIZE(menu_buf)];
+ for(uint8_t i = 0; i < ARRAY_SIZE(menu_buf); ++i) {
+ menu[i] = menu_buf[i];
+ }
+
+ f_chdir("/");
+ // first_visible = 0, weil MenĂ¼ so kurz. Ggf. Parameter aus main_menu empfangen und merken.
+ size_t first_visible = 0;
+ return (uint8_t) badge_menu(menu, ARRAY_SIZE(menu), &first_visible, selected);
+}
+
+void main_menu(void) {
+ uint8_t selected = 0;
+
+ for(;;) {
+ selected = main_menu_show(selected);
+ switch(selected) {
+ case 0: badge_vanity_show(); break;
+ case 1: jumpnrun_play (); break;
+ case 2: fahrplan (); break;
+ case 3: usbmode (); break;
+ }
+ }
}
int main(void)
}
badge_event_start();
-
- if(badge_input_raw() & BADGE_EVENT_KEY_UP) {
- scrolltest();
- }
-
- jumpnrun_play();
- usbmode();
+ main_menu();
return 0;
}