Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Settings/Settings.h
- Committer:
- evanso
- Date:
- 2020-05-23
- Revision:
- 74:6827b43c689d
- Parent:
- 73:d1aea9b8da92
- Child:
- 82:3211b31e9421
File content as of revision 74:6827b43c689d:
#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, music }; /** Enum for diffent control settings parts, joystick and accelerometer*/ enum ControlsParts {joy, acc}; /** Enum for diffent sound setting parts*/ enum SoundParts {on, off}; /** Enum for diffent music setting parts*/ enum MusicParts {music_on, music_off}; /** scroll_orderStruct * @brief Struct hold differnt settings orders */ struct scroll_order_setting { SettingsParts part_previous; /**< previous settings part */ SettingsParts part_displayed; /**< Displayed settings part */ SettingsParts part_next; /**< Next settings part */ }; /** On/off sound fx Struct * @brief Struct hold differnt sound fx orders */ struct on_off_order { SoundParts part_next; /**< Next onoff part */ SoundParts part_displayed; /**< Displayed onoff part */ }; /** On/off music Struct * @brief Struct hold differnt music orders */ struct music_on_off_order { MusicParts part_next; /**< Next onoff part */ MusicParts 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 music method that set in setting menu * @return music_method_ */ MusicParts get_music_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_; /** Controls whether music are on or not */ MusicParts music_method_; /** The part of setting that is displayed */ SettingsParts displayed_settings_part_; }; #endif