![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Adam Baker 201166301
Dependencies: mbed Gamepad N5110
Menu/Menu.h@44:03059810630d, 2019-05-09 (annotated)
- Committer:
- adambakerwa
- Date:
- Thu May 09 10:51:42 2019 +0000
- Revision:
- 44:03059810630d
- Parent:
- 43:11c5d098ce9d
- Child:
- 46:69d2d87f78a0
Final Commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
adambakerwa | 36:6f452777b9ce | 1 | #ifndef MENU_H |
adambakerwa | 36:6f452777b9ce | 2 | #define MENU_H |
adambakerwa | 36:6f452777b9ce | 3 | |
adambakerwa | 36:6f452777b9ce | 4 | #include "mbed.h" |
adambakerwa | 36:6f452777b9ce | 5 | #include "Gamepad.h" |
adambakerwa | 36:6f452777b9ce | 6 | #include "N5110.h" |
adambakerwa | 38:51ed5820ffe5 | 7 | |
adambakerwa | 41:4b20f909bbcb | 8 | /** Menu Class |
adambakerwa | 41:4b20f909bbcb | 9 | * @brief Library for interfacing with ELEC2645 Gamepad PCB, University of Leeds |
adambakerwa | 41:4b20f909bbcb | 10 | * @author Adam P. Baker |
adambakerwa | 44:03059810630d | 11 | * @date 9 May 2019 |
adambakerwa | 41:4b20f909bbcb | 12 | */ |
adambakerwa | 36:6f452777b9ce | 13 | |
adambakerwa | 36:6f452777b9ce | 14 | class Menu |
adambakerwa | 36:6f452777b9ce | 15 | { |
adambakerwa | 36:6f452777b9ce | 16 | public: |
adambakerwa | 43:11c5d098ce9d | 17 | /** Constructor */ |
adambakerwa | 36:6f452777b9ce | 18 | Menu(); |
adambakerwa | 43:11c5d098ce9d | 19 | |
adambakerwa | 43:11c5d098ce9d | 20 | /** Deconstructor */ |
adambakerwa | 36:6f452777b9ce | 21 | ~Menu(); |
adambakerwa | 43:11c5d098ce9d | 22 | |
adambakerwa | 43:11c5d098ce9d | 23 | /** intialises */ |
adambakerwa | 41:4b20f909bbcb | 24 | void init(); |
adambakerwa | 43:11c5d098ce9d | 25 | |
adambakerwa | 43:11c5d098ce9d | 26 | /** runs the title sequence |
adambakerwa | 43:11c5d098ce9d | 27 | *@param N5110 class which controlls lcd screen |
adambakerwa | 43:11c5d098ce9d | 28 | *@param Gamepad class for working with the gamepad |
adambakerwa | 41:4b20f909bbcb | 29 | */ |
adambakerwa | 37:23b6312c8315 | 30 | void title_intro(N5110 &lcd, Gamepad &pad); |
adambakerwa | 43:11c5d098ce9d | 31 | |
adambakerwa | 43:11c5d098ce9d | 32 | /**holds title screen and flashes 'press start' |
adambakerwa | 43:11c5d098ce9d | 33 | *@param N5110 class which controlls lcd screen |
adambakerwa | 43:11c5d098ce9d | 34 | *@param Gamepad class for working with the gamepad |
adambakerwa | 43:11c5d098ce9d | 35 | *@returns _start (1 when pressed, else 0) (int) |
adambakerwa | 41:4b20f909bbcb | 36 | */ |
adambakerwa | 37:23b6312c8315 | 37 | int press_start(N5110 &lcd, Gamepad &pad); |
adambakerwa | 40:f53c70793975 | 38 | |
adambakerwa | 43:11c5d098ce9d | 39 | /** displays main menu screen and takes in input to select next state |
adambakerwa | 43:11c5d098ce9d | 40 | *@param Gamepad class for working with the gamepad |
adambakerwa | 43:11c5d098ce9d | 41 | *@param N5110 class which controlls lcd screen |
adambakerwa | 43:11c5d098ce9d | 42 | *@returns _input (1 when pressed, else 0) (int) |
adambakerwa | 41:4b20f909bbcb | 43 | */ |
adambakerwa | 40:f53c70793975 | 44 | int select_input_main(Gamepad &pad, N5110 &lcd); |
adambakerwa | 43:11c5d098ce9d | 45 | |
adambakerwa | 43:11c5d098ce9d | 46 | /** displays continue menu screen and takes in input to select next state |
adambakerwa | 43:11c5d098ce9d | 47 | *@param Gamepad class for working with the gamepad |
adambakerwa | 43:11c5d098ce9d | 48 | *@param N5110 class which controlls lcd screen |
adambakerwa | 43:11c5d098ce9d | 49 | *@returns _input (1 when pressed, else 0) (int) |
adambakerwa | 41:4b20f909bbcb | 50 | */ |
adambakerwa | 40:f53c70793975 | 51 | int select_input_continue(Gamepad &pad, N5110 &lcd); |
adambakerwa | 43:11c5d098ce9d | 52 | |
adambakerwa | 43:11c5d098ce9d | 53 | /** displays highscore screen |
adambakerwa | 43:11c5d098ce9d | 54 | *@param N5110 class which controlls lcd screen |
adambakerwa | 43:11c5d098ce9d | 55 | *@param highest level reached by user (int) |
adambakerwa | 41:4b20f909bbcb | 56 | */ |
adambakerwa | 40:f53c70793975 | 57 | void print_highscore(N5110 &lcd, int highscore); |
adambakerwa | 43:11c5d098ce9d | 58 | |
adambakerwa | 43:11c5d098ce9d | 59 | /** displays continue menu screen and takes in input to select next state |
adambakerwa | 43:11c5d098ce9d | 60 | *@param Gamepad class for working with the gamepad |
adambakerwa | 43:11c5d098ce9d | 61 | *@param N5110 class which controlls lcd screen |
adambakerwa | 43:11c5d098ce9d | 62 | *@returns contrast level (float) |
adambakerwa | 41:4b20f909bbcb | 63 | */ |
adambakerwa | 40:f53c70793975 | 64 | float print_settings(Gamepad &pad, N5110 &lcd); |
adambakerwa | 36:6f452777b9ce | 65 | private: |
adambakerwa | 36:6f452777b9ce | 66 | |
adambakerwa | 43:11c5d098ce9d | 67 | void print_main_menu(N5110 &lcd); //prints menu class visuals |
adambakerwa | 41:4b20f909bbcb | 68 | void print_continue_menu(N5110 &lcd); //prints continue class visuals |
adambakerwa | 40:f53c70793975 | 69 | |
adambakerwa | 41:4b20f909bbcb | 70 | void menu_decoration(N5110 &lcd); //prints menu border decoration |
adambakerwa | 40:f53c70793975 | 71 | |
adambakerwa | 41:4b20f909bbcb | 72 | void intro_b(N5110 &lcd, Gamepad &pad); //display b with note |
adambakerwa | 41:4b20f909bbcb | 73 | void intro_bl(N5110 &lcd, Gamepad &pad); //display bl with note |
adambakerwa | 41:4b20f909bbcb | 74 | void intro_blo(N5110 &lcd, Gamepad &pad); //display blo with note |
adambakerwa | 41:4b20f909bbcb | 75 | void intro_bloc(N5110 &lcd, Gamepad &pad); //display bloc with note |
adambakerwa | 43:11c5d098ce9d | 76 | void intro_block(N5110 &lcd, Gamepad &pad); //display block with note |
adambakerwa | 41:4b20f909bbcb | 77 | void intro_block_h(N5110 &lcd, Gamepad &pad); //display block h with note |
adambakerwa | 41:4b20f909bbcb | 78 | void intro_block_he(N5110 &lcd, Gamepad &pad); //display block he with note |
adambakerwa | 41:4b20f909bbcb | 79 | void intro_block_hea(N5110 &lcd, Gamepad &pad); //display block hea with note |
adambakerwa | 41:4b20f909bbcb | 80 | void intro_block_head(N5110 &lcd, Gamepad &pad); //display block head with note |
adambakerwa | 36:6f452777b9ce | 81 | |
adambakerwa | 41:4b20f909bbcb | 82 | void B(int x, int y, N5110 &lcd); //prints B HEAD sprite |
adambakerwa | 41:4b20f909bbcb | 83 | void BL(int x, int y, N5110 &lcd); //prints BL sprite |
adambakerwa | 41:4b20f909bbcb | 84 | void BLO(int x, int y, N5110 &lcd); //prints BLO sprite |
adambakerwa | 41:4b20f909bbcb | 85 | void BLOC(int x, int y, N5110 &lcd); //prints BLOC sprite |
adambakerwa | 41:4b20f909bbcb | 86 | void BLOCK(int x, int y, N5110 &lcd); //prints BLOCK sprite |
adambakerwa | 41:4b20f909bbcb | 87 | void BLOCK_H(int x, int y, N5110 &lcd); //prints BLOCK H sprite |
adambakerwa | 41:4b20f909bbcb | 88 | void BLOCK_HE(int x, int y, N5110 &lcd); //prints BLOCK HE sprite |
adambakerwa | 41:4b20f909bbcb | 89 | void BLOCK_HEA(int x, int y, N5110 &lcd); //prints BLOCK HEA sprite |
adambakerwa | 41:4b20f909bbcb | 90 | void BLOCK_HEAD(int x, int y, N5110 &lcd); //prints BLOCK HEAD sprite |
adambakerwa | 40:f53c70793975 | 91 | |
adambakerwa | 37:23b6312c8315 | 92 | int _start; |
adambakerwa | 37:23b6312c8315 | 93 | int _count; |
adambakerwa | 40:f53c70793975 | 94 | |
adambakerwa | 36:6f452777b9ce | 95 | int _select; |
adambakerwa | 36:6f452777b9ce | 96 | int _input; |
adambakerwa | 36:6f452777b9ce | 97 | int _stop; |
adambakerwa | 37:23b6312c8315 | 98 | bool _flash; |
adambakerwa | 40:f53c70793975 | 99 | |
adambakerwa | 36:6f452777b9ce | 100 | }; |
adambakerwa | 36:6f452777b9ce | 101 | |
adambakerwa | 36:6f452777b9ce | 102 | #endif |