1 #include <allegro5/allegro.h>
2 #include "defines.h"
3 #include "global.h"
4 #include "menu.h"
5 #include "menus.h"
6 #include "music.h"
7 
8 static int _id = DEMO_STATE_SUCCESS;
9 
id(void)10 static int id(void)
11 {
12    return _id;
13 }
14 
15 
16 static DEMO_MENU menu[] = {
17    DEMO_MENU_ITEM2(demo_text_proc, "Well done! Ted's stock is saved!"),
18    DEMO_MENU_ITEM2(demo_text_proc, " "),
19    DEMO_MENU_ITEM2(demo_text_proc, "This demo has shown only a fraction"),
20    DEMO_MENU_ITEM2(demo_text_proc, "of Allegro's capabilities."),
21    DEMO_MENU_ITEM2(demo_text_proc, " "),
22    DEMO_MENU_ITEM2(demo_text_proc, "Now it's up to you to show the world the rest!"),
23    DEMO_MENU_ITEM2(demo_text_proc, "Get coding!"),
24    DEMO_MENU_ITEM2(demo_text_proc, " "),
25    DEMO_MENU_ITEM4(demo_button_proc, "Back", DEMO_MENU_SELECTABLE, DEMO_STATE_MAIN_MENU),
26    DEMO_MENU_END
27 };
28 
29 
init(void)30 static void init(void)
31 {
32    init_demo_menu(menu, false);
33    disable_continue_game();
34    play_music(DEMO_MIDI_SUCCESS, false);
35 }
36 
37 
update(void)38 static int update(void)
39 {
40    int ret = update_demo_menu(menu);
41 
42    switch (ret) {
43       case DEMO_MENU_CONTINUE:
44          return id();
45 
46       case DEMO_MENU_BACK:
47          return DEMO_STATE_MAIN_MENU;
48 
49       default:
50          return ret;
51    };
52 }
53 
54 
draw(void)55 static void draw(void)
56 {
57    draw_demo_menu(menu);
58 }
59 
60 
create_success_menu(GAMESTATE * state)61 void create_success_menu(GAMESTATE * state)
62 {
63    state->id = id;
64    state->init = init;
65    state->update = update;
66    state->draw = draw;
67 }
68