Ben Evans University Second Year Project. Game Called Defender.
Embed:
(wiki syntax)
Show/hide line numbers
Settings.h
00001 #ifndef SETTINGS_H 00002 #define SETTINGS_H 00003 00004 // Included Headers ------------------------------------------------------------ 00005 #include "mbed.h" 00006 #include "N5110.h" 00007 #include "Gamepad.h" 00008 #include "Sprites.h" 00009 00010 /** Enum for different menu parts*/ 00011 enum SettingsParts {contrast, controls, sound_fx, music }; 00012 00013 /** Enum for different control settings parts, joystick and accelerometer*/ 00014 enum ControlsParts {joy, acc}; 00015 00016 /** Enum for different sound setting parts*/ 00017 enum SoundParts {on, off}; 00018 00019 /** Enum for different music setting parts*/ 00020 enum MusicParts {music_on, music_off}; 00021 00022 /** scroll_order Struct 00023 * @brief Struct hold differnt settings orders 00024 */ 00025 struct scroll_order_setting { 00026 SettingsParts part_previous; /**< Previous settings part */ 00027 SettingsParts part_displayed; /**< Displayed settings part */ 00028 SettingsParts part_next; /**< Next settings part */ 00029 }; 00030 00031 /** On/off sound fx Struct 00032 * @brief Struct hold different sound fx orders 00033 */ 00034 struct on_off_order { 00035 SoundParts part_next; /**< Next onoff part */ 00036 SoundParts part_displayed; /**< Displayed onoff part */ 00037 }; 00038 00039 /** On/off music Struct 00040 * @brief Struct hold differnt music orders 00041 */ 00042 struct music_on_off_order { 00043 MusicParts part_next; /**< Next onoff part */ 00044 MusicParts part_displayed; /**< Displayed onoff part */ 00045 }; 00046 00047 /** Controll_order Struct 00048 * @brief Struct hold differnt controls orders 00049 */ 00050 struct control_order { 00051 ControlsParts part_next; /**< Next controls part */ 00052 ControlsParts part_displayed; /**< Displayed controls part */ 00053 }; 00054 00055 /** Settings class 00056 * @brief Change change contrast, control method 00057 * @author Benjamin Evans, University of Leeds 00058 * @date May 2020 00059 */ 00060 class Settings{ 00061 public: 00062 /** Constructor */ 00063 Settings(); 00064 00065 /** Destructor */ 00066 ~Settings(); 00067 00068 /** Initialises Settings*/ 00069 void init(); 00070 00071 /** Draws the settings screen 00072 * @param lcd @details N5110 object 00073 * @param pot_read @details Potentiometer read value 00074 */ 00075 void display_settings_screen(N5110 &lcd, float pot_read); 00076 00077 /** Changes the current displayed setting part 00078 * @param pressed @details Buttom A pressed 00079 */ 00080 void change_setting(bool pressed); 00081 00082 /** Scrolls through the different settings parts 00083 * @param d_ @details Direction of joystick 00084 */ 00085 void settings_scroll(Direction d_); 00086 00087 // Accessors and mutators -------------------------------------------------- 00088 00089 /** Return the control method that set-in setting menu 00090 * @return control_method_ 00091 */ 00092 ControlsParts get_control_method(); 00093 00094 /** Return the sound method that set-in setting menu 00095 * @return sound_method_ 00096 */ 00097 SoundParts get_sound_method(); 00098 00099 /** Return the music method that set-in setting menu 00100 * @return music_method_ 00101 */ 00102 MusicParts get_music_method(); 00103 00104 /** Return the setting part that is displayed 00105 * @return get_displayed_settings_part_ 00106 */ 00107 SettingsParts get_displayed_settings_part(); 00108 00109 private: 00110 00111 // Varibles ---------------------------------------------------------------- 00112 00113 /** LCD contrast */ 00114 int lcd_contrast; 00115 00116 /** Control method of the spaceship */ 00117 ControlsParts control_method_; 00118 00119 /** Controls whether sound fx are on or not */ 00120 SoundParts sound_method_; 00121 00122 /** Controls whether music are on or not */ 00123 MusicParts music_method_; 00124 00125 /** The part of setting that is displayed */ 00126 SettingsParts displayed_settings_part_; 00127 00128 }; 00129 #endif
Generated on Fri Aug 5 2022 06:55:07 by
1.7.2