Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Committer:
AhmedPlaymaker
Date:
Wed May 08 19:05:30 2019 +0000
Revision:
89:8fbb0405a916
Parent:
84:9950d561fdf8
Child:
91:ca8cff78f2fe
Added documentation for settings.

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 89:8fbb0405a916 22 /** Gets pointers of lcd and pad from int main() and initialises variables used in the class.
AhmedPlaymaker 89:8fbb0405a916 23 * @param 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 89:8fbb0405a916 24 * @param 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 25 */
AhmedPlaymaker 83:329da564799a 26 void init(N5110 *lcd, Gamepad *pad);
AhmedPlaymaker 65:2872ca289b49 27
AhmedPlaymaker 89:8fbb0405a916 28 /**
AhmedPlaymaker 89:8fbb0405a916 29 * @brief Used to select between various settings functions using user input.
AhmedPlaymaker 89:8fbb0405a916 30 * @param controlSensitivity is the value that determines the wait time between performing menu tasks.
AhmedPlaymaker 89:8fbb0405a916 31 * @return 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 32 */
AhmedPlaymaker 89:8fbb0405a916 33 float * Implement(float controlSensitivity);
AhmedPlaymaker 65:2872ca289b49 34
AhmedPlaymaker 89:8fbb0405a916 35 /** Shows the information for using settings.*/
AhmedPlaymaker 83:329da564799a 36 void info();
AhmedPlaymaker 65:2872ca289b49 37
AhmedPlaymaker 89:8fbb0405a916 38 /** Calls the respective settings menu as per the joystick entry by the user.
AhmedPlaymaker 89:8fbb0405a916 39 * @param settingsIndex is the value that is used to select the relevant settings page.
AhmedPlaymaker 55:df0825049171 40 */
AhmedPlaymaker 89:8fbb0405a916 41 void CallFunctions(int settingsIndex);
AhmedPlaymaker 65:2872ca289b49 42
AhmedPlaymaker 89:8fbb0405a916 43 /** Enables the user to select the sensitivity of the game controls and saves it in cs_sc[0]*/
AhmedPlaymaker 83:329da564799a 44 void controlSensitivity();
AhmedPlaymaker 65:2872ca289b49 45
AhmedPlaymaker 89:8fbb0405a916 46 /** Allows the user to set the screen brightness.*/
AhmedPlaymaker 83:329da564799a 47 void brigntness();
AhmedPlaymaker 65:2872ca289b49 48
AhmedPlaymaker 89:8fbb0405a916 49 /** Allows the user to set the contrast of the screen.*/
AhmedPlaymaker 83:329da564799a 50 void contrast();
AhmedPlaymaker 65:2872ca289b49 51
AhmedPlaymaker 89:8fbb0405a916 52 /** Allows the user to set the volume of the speaker.*/
AhmedPlaymaker 83:329da564799a 53 void volume();
AhmedPlaymaker 65:2872ca289b49 54
AhmedPlaymaker 89:8fbb0405a916 55 /** Allows the user to hide/show credits.*/
AhmedPlaymaker 83:329da564799a 56 void showCredits();
AhmedPlaymaker 65:2872ca289b49 57
AhmedPlaymaker 65:2872ca289b49 58 private:
AhmedPlaymaker 30:461231877c89 59 float cs_sc[2]; //this array helps to return Control speeds and Show credits parameters.
AhmedPlaymaker 89:8fbb0405a916 60 int settingsIndex; //an index for selecting from settings functions.
AhmedPlaymaker 83:329da564799a 61 //Pointer to the game pad object pad.
AhmedPlaymaker 83:329da564799a 62 Gamepad *_pad;
AhmedPlaymaker 83:329da564799a 63 //Pointer to the N5110 object lcd.
AhmedPlaymaker 83:329da564799a 64 N5110 *_lcd;
AhmedPlaymaker 65:2872ca289b49 65
AhmedPlaymaker 5:e4df87957a5b 66
AhmedPlaymaker 5:e4df87957a5b 67 };
AhmedPlaymaker 5:e4df87957a5b 68 #endif