3a1c3d229ee20b8cf87d3d54d2f1a2b14047d197
[hackover2013-badge-firmware.git] / mock / badge_main_loop.c
1 #include "badge_main_loop.h"
2
3 #include "jumpnrun/jumpnrun.h"
4 #include "ui/display.h"
5 #include "ui/event.h"
6 #include "ui/menu.h"
7 #include "ui/sprite.h"
8
9 #include <stdint.h>
10 #include <stdio.h>
11 #include <string.h>
12 #include <unistd.h>
13
14 void badge_main_loop(void) {
15 char const *const menu[] = {
16 "smb",
17 "skynet",
18 "wrongturn",
19 "lubiXOXO",
20 "lubilove",
21 "gnobbel",
22 "foo",
23 "mean",
24 "xyzzy",
25 "abc",
26 "nonsense"
27 };
28
29 size_t choice = badge_menu(menu, ARRAY_SIZE(menu), 0, 0);
30
31 printf("%zu\n", choice);
32
33 for(;;) {
34 FILE *fd = fopen("../badge/jumpnrun/levels.txt", "r");
35 char buf[12];
36
37 while(fgets(buf, sizeof(buf), fd)) {
38 buf[strlen(buf) - 1] = '\0';
39 char lvname[256];
40 sprintf(lvname, "../badge/jumpnrun/%s.lvl", buf);
41 while(jumpnrun_play(lvname) != JUMPNRUN_WON)
42 ;
43 }
44
45 fclose(fd);
46 }
47 }
This page took 0.041315 seconds and 3 git commands to generate.