Ben Evans / Mbed 2 deprecated Defender_Game

Dependencies:   mbed

Settings/Settings.h

Committer:
evanso
Date:
2020-05-23
Revision:
73:d1aea9b8da92
Parent:
70:8c4572d17441
Child:
74:6827b43c689d

File content as of revision 73:d1aea9b8da92:

#ifndef SETTINGS_H
#define SETTINGS_H

// Included libraries ----------------------------------------------------------
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Sprites.h"

/** Enum for diffent menu parts*/
enum SettingsParts {contrast, controls, sound_fx };

/** Enum for diffent control settings parts, joystick and accelerometer*/
enum ControlsParts {joy, acc};

/** Enum for diffent sound setting parts*/
enum SoundParts {on, off};

/** scroll_orderStruct
 * @brief Struct hold differnt settings orders
 */   
struct scroll_order_setting {
    SettingsParts  part_next; /**< Next settings part */
    SettingsParts  part_displayed; /**< Displayed settings part */
};

/** On/off Struct
 * @brief Struct hold differnt settings orders
 */   
struct on_off_order {
    SoundParts part_next; /**< Next onoff part */
    SoundParts part_displayed; /**< Displayed onoff part */
};

/** Controll_orderStruct
 * @brief Struct hold differnt controls orders
 */   
struct control_order {
    ControlsParts part_next; /**< Next controls part */
    ControlsParts part_displayed; /**< Displayed controls part */
};

/** Settings class
 * @brief Change change contrast, control method 
 * @author Benjamin Evans, University of Leeds
 * @date May 2020
 */      
class Settings{
    public:
        /** Constructor */
        Settings();
        
        /** Destructor */
        ~Settings();
        
        /** Initalises Settings*/
        void init();
        
        /** Draws the settings screen
         * @param lcd @details N5110 object
         * @param pad @details Gamepad object
         */
        void display_settings_screen(N5110 &lcd, float pot_read);
        
        /** Changes the current displayed setting part
         * @param pressed @details Buttom A pressed 
         */
        void change_setting(bool pressed);
        
        /** Scrolls through the diffent settings parts
         * @param d_ @details Direction of joystick
         */
        void settings_scroll(Direction d_);
        
    // Accessors and mutators --------------------------------------------------
        
        /** Return the control method that set in setting menu  
         * @return control_method_
         */
        ControlsParts get_control_method();
        
        /** Return the sound method that set in setting menu  
         * @return sound_method_
         */
        SoundParts get_sound_method();
        
        /** Return the setting part that is displayed 
         * @return get_displayed_settings_part_
         */
        SettingsParts get_displayed_settings_part();
        
    private:   
       
    // Varibles ---------------------------------------------------------------- 
        
        /** LCD contrast */
        int lcd_contrast; 
            
        /** Control method of the spaceship */
        ControlsParts control_method_; 
       
        /** Controls whether sound fx are on or not */
        SoundParts sound_method_;
        
        /** The part of setting that is displayed */ 
        SettingsParts displayed_settings_part_;
    
};
#endif