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.
Diff: Settings/Settings.h
- Revision:
- 69:753ba27325ce
- Parent:
- 44:2d957de3bce3
- Child:
- 70:8c4572d17441
--- a/Settings/Settings.h Thu May 21 22:46:23 2020 +0000 +++ b/Settings/Settings.h Fri May 22 13:02:26 2020 +0000 @@ -5,6 +5,40 @@ #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*/ +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 @@ -22,14 +56,33 @@ /** 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 -------------------------------------------------- - /** Set the LCD contrast during game when start button is pressed - * @param + /** Return the control method that set in setting menu + * @return control_method_ */ - void set_lcd_contrast(int pot_value); + ControlsParts get_control_method(); + + /** Return the sound method that set in setting menu + * @return sound_method_ + */ + ControlsParts get_sound_method(); private: @@ -38,10 +91,14 @@ /** LCD contrast */ int lcd_contrast; - /** Control method of the spaceship - * @details false = joystick, true = accelerometer - */ - bool control_method; - + /** 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 \ No newline at end of file