ELEC2645 (2018/19) / Mbed 2 deprecated el17ebs

Dependencies:   mbed FATFileSystem

Committer:
ellisbhastroud
Date:
Fri Mar 29 18:45:40 2019 +0000
Revision:
3:a8960004d261
Parent:
2:81cfa8310f55
Child:
4:035448357749
Menu Working, Game Mechanisms Developed. Can now use joystick and button to shoot golf ball with power dependant on joystick magnitude.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ellisbhastroud 1:6179c2d67d19 1 #ifndef MENU_H
ellisbhastroud 1:6179c2d67d19 2 #define MENU_H
ellisbhastroud 1:6179c2d67d19 3
ellisbhastroud 1:6179c2d67d19 4 #include "mbed.h"
ellisbhastroud 1:6179c2d67d19 5 #include "N5110.h"
ellisbhastroud 1:6179c2d67d19 6 #include "Gamepad.h"
ellisbhastroud 1:6179c2d67d19 7
ellisbhastroud 1:6179c2d67d19 8 /** Enum for menu options */
ellisbhastroud 1:6179c2d67d19 9 enum MenuChoices {
ellisbhastroud 2:81cfa8310f55 10 START, /**< Begin Game */
ellisbhastroud 2:81cfa8310f55 11 HIGHSCORES, /**< View Highscores */
ellisbhastroud 2:81cfa8310f55 12 SETTINGS, /**< View Settings */
ellisbhastroud 1:6179c2d67d19 13 };
ellisbhastroud 1:6179c2d67d19 14
ellisbhastroud 1:6179c2d67d19 15 /** Menu Class
ellisbhastroud 3:a8960004d261 16 * @brief Library for navigating menu options
ellisbhastroud 1:6179c2d67d19 17 * @author Ellis Blackford Stroud
ellisbhastroud 1:6179c2d67d19 18 * @date May, 2018
ellisbhastroud 1:6179c2d67d19 19 */
ellisbhastroud 1:6179c2d67d19 20
ellisbhastroud 1:6179c2d67d19 21 class Menu {
ellisbhastroud 1:6179c2d67d19 22
ellisbhastroud 1:6179c2d67d19 23 public:
ellisbhastroud 1:6179c2d67d19 24
ellisbhastroud 1:6179c2d67d19 25 /** Constructor */
ellisbhastroud 1:6179c2d67d19 26 Menu();
ellisbhastroud 1:6179c2d67d19 27
ellisbhastroud 1:6179c2d67d19 28 /** Destructor */
ellisbhastroud 1:6179c2d67d19 29 ~Menu();
ellisbhastroud 1:6179c2d67d19 30
ellisbhastroud 3:a8960004d261 31 void init();
ellisbhastroud 3:a8960004d261 32
ellisbhastroud 1:6179c2d67d19 33 /** Prints opening message */
ellisbhastroud 1:6179c2d67d19 34 void print_welcome(N5110 &lcd);
ellisbhastroud 1:6179c2d67d19 35
ellisbhastroud 1:6179c2d67d19 36 /** Prints menu screen */
ellisbhastroud 1:6179c2d67d19 37 void print_menu(N5110 &lcd);
ellisbhastroud 1:6179c2d67d19 38
ellisbhastroud 3:a8960004d261 39 /** Prints start screen */
ellisbhastroud 3:a8960004d261 40 bool check_start(N5110 &lcd, Gamepad &pad);
ellisbhastroud 3:a8960004d261 41
ellisbhastroud 2:81cfa8310f55 42 /** Prints highscore screen */
ellisbhastroud 2:81cfa8310f55 43 void print_highscores(N5110 &lcd);
ellisbhastroud 2:81cfa8310f55 44
ellisbhastroud 2:81cfa8310f55 45 /** Prints settings screen */
ellisbhastroud 2:81cfa8310f55 46 void print_settings(N5110 &lcd);
ellisbhastroud 2:81cfa8310f55 47
ellisbhastroud 3:a8960004d261 48 /** Changes screen to menu choice and returns start game message
ellisbhastroud 3:a8960004d261 49 * @returns a bool: true to start game, false to stay in menu
ellisbhastroud 3:a8960004d261 50 */
ellisbhastroud 3:a8960004d261 51 bool menu_change(N5110 &lcd, Gamepad &pad);
ellisbhastroud 3:a8960004d261 52
ellisbhastroud 3:a8960004d261 53 /** Returns to menu screen */
ellisbhastroud 3:a8960004d261 54 void menu_return(N5110 &lcd, Gamepad &pad);
ellisbhastroud 3:a8960004d261 55
ellisbhastroud 3:a8960004d261 56 /** Updates cursor and returns menu choice
ellisbhastroud 3:a8960004d261 57 * @returns an enum: START, HIGHSCORES, SETTINGS
ellisbhastroud 3:a8960004d261 58 */
ellisbhastroud 3:a8960004d261 59 void menu_select(Gamepad &pad, N5110 &lcd);
ellisbhastroud 2:81cfa8310f55 60
ellisbhastroud 2:81cfa8310f55 61
ellisbhastroud 3:a8960004d261 62 private:
ellisbhastroud 2:81cfa8310f55 63
ellisbhastroud 2:81cfa8310f55 64
ellisbhastroud 3:a8960004d261 65 void draw_cursor(N5110 &lcd);
ellisbhastroud 3:a8960004d261 66
ellisbhastroud 3:a8960004d261 67 MenuChoices _cursor_pos;
ellisbhastroud 1:6179c2d67d19 68
ellisbhastroud 1:6179c2d67d19 69 };
ellisbhastroud 1:6179c2d67d19 70
ellisbhastroud 1:6179c2d67d19 71 #endif