Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Committer:
AhmedPlaymaker
Date:
Thu May 09 14:52:19 2019 +0000
Revision:
104:17040265b7b4
Parent:
91:ca8cff78f2fe
Final Submission. I have read and agreed with Statement of Academic Integrity.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AhmedPlaymaker 60:d3a9e0e4a0de 1 #ifndef SETTINGS_H
AhmedPlaymaker 60:d3a9e0e4a0de 2 #define SETTINGS_H
AhmedPlaymaker 5:e4df87957a5b 3
AhmedPlaymaker 5:e4df87957a5b 4 #include "mbed.h"
AhmedPlaymaker 5:e4df87957a5b 5 #include "N5110.h"
AhmedPlaymaker 5:e4df87957a5b 6 #include "Gamepad.h"
AhmedPlaymaker 5:e4df87957a5b 7
AhmedPlaymaker 89:8fbb0405a916 8 /** Settings Class
AhmedPlaymaker 89:8fbb0405a916 9 @brief Class for selecting "Game comfort parameters" like brightness, contrast, control speeds and also features an hide option for credits.
AhmedPlaymaker 89:8fbb0405a916 10 @author Ahmed N.Adamjee
AhmedPlaymaker 89:8fbb0405a916 11 @date 8th May 2019
AhmedPlaymaker 89:8fbb0405a916 12 */
AhmedPlaymaker 5:e4df87957a5b 13 class Settings
AhmedPlaymaker 5:e4df87957a5b 14 {
AhmedPlaymaker 65:2872ca289b49 15 public:
AhmedPlaymaker 65:2872ca289b49 16
AhmedPlaymaker 89:8fbb0405a916 17 /** Constructor */
AhmedPlaymaker 5:e4df87957a5b 18 Settings();
AhmedPlaymaker 89:8fbb0405a916 19 /** Destructor */
AhmedPlaymaker 5:e4df87957a5b 20 ~Settings();
AhmedPlaymaker 84:9950d561fdf8 21
AhmedPlaymaker 91:ca8cff78f2fe 22 /**
AhmedPlaymaker 91:ca8cff78f2fe 23 * @brief Gets pointers of lcd and pad from int main() and initialises variables used in the class.
AhmedPlaymaker 91:ca8cff78f2fe 24 * @param N5110 *lcd @details pointer to the N5110 object in main, address of this pointer is saved to make availability to the entire class, without passing address to each function.
AhmedPlaymaker 91:ca8cff78f2fe 25 * @param Gamepad *pad @details pointer to the gamepad object in main, address of this pointer is saved to make availability to the entire class, without passing address to each function.
AhmedPlaymaker 83:329da564799a 26 */
AhmedPlaymaker 83:329da564799a 27 void init(N5110 *lcd, Gamepad *pad);
AhmedPlaymaker 65:2872ca289b49 28
AhmedPlaymaker 89:8fbb0405a916 29 /**
AhmedPlaymaker 89:8fbb0405a916 30 * @brief Used to select between various settings functions using user input.
AhmedPlaymaker 91:ca8cff78f2fe 31 * @param controlSensitivity @details is the value that determines the wait time between performing menu tasks.
AhmedPlaymaker 91:ca8cff78f2fe 32 * @returns cs_sc @details values of controlSensitivity and showCredits are saved in an array called cs_sc which is returned to the StartScreen class as a pointer.
AhmedPlaymaker 89:8fbb0405a916 33 */
AhmedPlaymaker 89:8fbb0405a916 34 float * Implement(float controlSensitivity);
AhmedPlaymaker 65:2872ca289b49 35
AhmedPlaymaker 91:ca8cff78f2fe 36 /**
AhmedPlaymaker 91:ca8cff78f2fe 37 * @brief Shows the information for using settings.
AhmedPlaymaker 91:ca8cff78f2fe 38 */
AhmedPlaymaker 83:329da564799a 39 void info();
AhmedPlaymaker 65:2872ca289b49 40
AhmedPlaymaker 91:ca8cff78f2fe 41 /**
AhmedPlaymaker 91:ca8cff78f2fe 42 * @brief Calls the respective settings menu as per the joystick entry by the user.
AhmedPlaymaker 91:ca8cff78f2fe 43 * @param settingsIndex @details is the value that is used to select the relevant settings page.
AhmedPlaymaker 55:df0825049171 44 */
AhmedPlaymaker 89:8fbb0405a916 45 void CallFunctions(int settingsIndex);
AhmedPlaymaker 65:2872ca289b49 46
AhmedPlaymaker 91:ca8cff78f2fe 47 /**
AhmedPlaymaker 91:ca8cff78f2fe 48 * @brief Enables the user to select the sensitivity of the game controls and saves it in cs_sc[0]
AhmedPlaymaker 91:ca8cff78f2fe 49 */
AhmedPlaymaker 83:329da564799a 50 void controlSensitivity();
AhmedPlaymaker 65:2872ca289b49 51
AhmedPlaymaker 91:ca8cff78f2fe 52 /**
AhmedPlaymaker 91:ca8cff78f2fe 53 * @brief Allows the user to set the screen brightness.
AhmedPlaymaker 91:ca8cff78f2fe 54 */
AhmedPlaymaker 83:329da564799a 55 void brigntness();
AhmedPlaymaker 65:2872ca289b49 56
AhmedPlaymaker 91:ca8cff78f2fe 57 /**
AhmedPlaymaker 91:ca8cff78f2fe 58 * @brief Allows the user to set the contrast of the screen.
AhmedPlaymaker 91:ca8cff78f2fe 59 */
AhmedPlaymaker 83:329da564799a 60 void contrast();
AhmedPlaymaker 65:2872ca289b49 61
AhmedPlaymaker 91:ca8cff78f2fe 62 /**
AhmedPlaymaker 91:ca8cff78f2fe 63 * @brief Allows the user to set the volume of the speaker.
AhmedPlaymaker 91:ca8cff78f2fe 64 */
AhmedPlaymaker 83:329da564799a 65 void volume();
AhmedPlaymaker 65:2872ca289b49 66
AhmedPlaymaker 91:ca8cff78f2fe 67 /**
AhmedPlaymaker 91:ca8cff78f2fe 68 * @brief Allows the user to hide/show credits.
AhmedPlaymaker 91:ca8cff78f2fe 69 */
AhmedPlaymaker 83:329da564799a 70 void showCredits();
AhmedPlaymaker 65:2872ca289b49 71
AhmedPlaymaker 65:2872ca289b49 72 private:
AhmedPlaymaker 30:461231877c89 73 float cs_sc[2]; //this array helps to return Control speeds and Show credits parameters.
AhmedPlaymaker 89:8fbb0405a916 74 int settingsIndex; //an index for selecting from settings functions.
AhmedPlaymaker 83:329da564799a 75 //Pointer to the game pad object pad.
AhmedPlaymaker 83:329da564799a 76 Gamepad *_pad;
AhmedPlaymaker 83:329da564799a 77 //Pointer to the N5110 object lcd.
AhmedPlaymaker 83:329da564799a 78 N5110 *_lcd;
AhmedPlaymaker 65:2872ca289b49 79
AhmedPlaymaker 5:e4df87957a5b 80
AhmedPlaymaker 5:e4df87957a5b 81 };
AhmedPlaymaker 5:e4df87957a5b 82 #endif