James Cummins / Mbed 2 deprecated el17jnc

Dependencies:   mbed

Pause/Pause.h

Committer:
JamesCummins
Date:
2019-05-06
Revision:
37:de1f584bce71
Parent:
29:42651f87522b
Child:
38:a85bc227b907

File content as of revision 37:de1f584bce71:

#ifndef PAUSE_H
#define PAUSE_H

#include "mbed.h"
#include "Gamepad.h"
#include "ClassicEngine.h"
#include "N5110.h"

/** Enum for game mode*/
enum Mode{
    CLASSIC_MODE, 
    BRICKBREAKER_MODE
    };

/** Enum for Pause Options*/
enum PauseOption{
    RESUME,
    RESTART,
    QUIT,
    HELP
    };

/**Pause selection struct*/
struct PauseSelection{
    int output;                 /**<Integer output for line to print arrows*/
    PauseOption next_state[3];  /**<Array of enums for possible next option*/
    };

class Pause {

public:
    /** 
    * @brief Create a Pause object
    */
    Pause();
    /** 
    * @brief Delete Pause object to free memory
    */
    ~Pause();
    /** 
    * @brief Initialise the pause menu with the first menu option highlighted
    */
    void init();
    /** 
    * @brief Read the user input and update the displayed menu until an option is selected
    * @param gamepad - Gamepad object to sense user interaction
    * @param lcd - N5110 object to render menu on LCD screen
    * @param fps - integer value of frames per second game is ran at
    * @returns an Enum of the pause option selected by user (RESUME, RESTART, QUIT or HELP)
    */
    PauseOption pause_menu(Gamepad &gamepad, N5110 &lcd, int fps);
    /** 
    * @brief Jump to a specified frame in the game based on user's menu choice
    * @param choice - option selected in the Pause menu
    * @param gamepad - Gamepad object to check for button press
    * @param lcd - N5110 object to interact with LCD screen
    * @param frame - integer of current no. of frames iterated through in gameplay
    * @param fps - integer of gameplay's frames per second
    * @returns i - integer of frame to jump to
    */
    int brickbreaker_action(PauseOption choice, Gamepad &gamepad, N5110 &lcd, int frame, int fps);
    /** 
    * @brief Display the help menu for classic game mode
    * @param gamepad - Gamepad object to check for button press
    * @param lcd - N5110 object to render help menu on LCD
    */
    void classic_help(Gamepad &gamepad, N5110 &lcd);
    /** 
    * @brief Display the help menu for brickbreaker game mode
    * @param gamepad - Gamepad object to check for button press
    * @param lcd - N5110 object to render help menu on LCD
    */
    void brickbreaker_help(Gamepad &gamepad, N5110 &lcd);

private:

    void display_pause_options(N5110 &lcd);
    PauseOption pause_selection(Gamepad &gamepad, N5110 &lcd);
    PauseOption _state;
    int _next_state;
};
#endif