Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Committer:
AhmedPlaymaker
Date:
Mon May 06 14:28:35 2019 +0000
Revision:
83:329da564799a
Parent:
65:2872ca289b49
Child:
84:9950d561fdf8
Now, I have put gamepad and lcd objects from the main() in a pointer, so that i can declare them in init() in every class i use them in and use them as global objects for each class, without having to send their addresses to all of the functions.

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 5:e4df87957a5b 8 class Settings
AhmedPlaymaker 5:e4df87957a5b 9 {
AhmedPlaymaker 65:2872ca289b49 10 public:
AhmedPlaymaker 65:2872ca289b49 11
AhmedPlaymaker 5:e4df87957a5b 12 Settings();
AhmedPlaymaker 5:e4df87957a5b 13 ~Settings();
AhmedPlaymaker 83:329da564799a 14
AhmedPlaymaker 83:329da564799a 15 /** Initialise Settings
AhmedPlaymaker 83:329da564799a 16 *
AhmedPlaymaker 83:329da564799a 17 * This function passes the pointers to the settings class so that it can control the screen and the gamepad.
AhmedPlaymaker 83:329da564799a 18 */
AhmedPlaymaker 83:329da564799a 19 void init(N5110 *lcd, Gamepad *pad);
AhmedPlaymaker 65:2872ca289b49 20
AhmedPlaymaker 30:461231877c89 21 /** Implement Settings
AhmedPlaymaker 30:461231877c89 22 *
AhmedPlaymaker 30:461231877c89 23 * This function is used to configure settings.
AhmedPlaymaker 30:461231877c89 24 */
AhmedPlaymaker 83:329da564799a 25 float * Implement(float cs);
AhmedPlaymaker 65:2872ca289b49 26
AhmedPlaymaker 63:205f0ca48473 27 /** Info
AhmedPlaymaker 63:205f0ca48473 28 *
AhmedPlaymaker 63:205f0ca48473 29 * This function shows the info for using settings.
AhmedPlaymaker 63:205f0ca48473 30 */
AhmedPlaymaker 83:329da564799a 31 void info();
AhmedPlaymaker 65:2872ca289b49 32
AhmedPlaymaker 55:df0825049171 33 /** Call Functions
AhmedPlaymaker 55:df0825049171 34 *
AhmedPlaymaker 55:df0825049171 35 * This function calls respective settings menu as per the contol entries by the user.
AhmedPlaymaker 55:df0825049171 36 */
AhmedPlaymaker 83:329da564799a 37 void CallFunctions(int st);
AhmedPlaymaker 65:2872ca289b49 38
AhmedPlaymaker 5:e4df87957a5b 39 /** controlSensitivity
AhmedPlaymaker 5:e4df87957a5b 40 *
AhmedPlaymaker 5:e4df87957a5b 41 * This function essentialy enables the user to select the sensitivity of the game controls
AhmedPlaymaker 5:e4df87957a5b 42 */
AhmedPlaymaker 83:329da564799a 43 void controlSensitivity();
AhmedPlaymaker 65:2872ca289b49 44
AhmedPlaymaker 5:e4df87957a5b 45 /** brigntness
AhmedPlaymaker 5:e4df87957a5b 46 *
AhmedPlaymaker 5:e4df87957a5b 47 * This function allows the user to set the screen brightness.
AhmedPlaymaker 5:e4df87957a5b 48 */
AhmedPlaymaker 83:329da564799a 49 void brigntness();
AhmedPlaymaker 65:2872ca289b49 50
AhmedPlaymaker 5:e4df87957a5b 51 /** contrast
AhmedPlaymaker 5:e4df87957a5b 52 *
AhmedPlaymaker 5:e4df87957a5b 53 * This function allows the user to set the contrast of the screen.
AhmedPlaymaker 5:e4df87957a5b 54 */
AhmedPlaymaker 83:329da564799a 55 void contrast();
AhmedPlaymaker 65:2872ca289b49 56
AhmedPlaymaker 5:e4df87957a5b 57 /** volume
AhmedPlaymaker 5:e4df87957a5b 58 *
AhmedPlaymaker 5:e4df87957a5b 59 * This function allows the user to set the volume of the speaker.
AhmedPlaymaker 5:e4df87957a5b 60 */
AhmedPlaymaker 83:329da564799a 61 void volume();
AhmedPlaymaker 65:2872ca289b49 62
AhmedPlaymaker 5:e4df87957a5b 63 /** showCredits
AhmedPlaymaker 5:e4df87957a5b 64 *
AhmedPlaymaker 5:e4df87957a5b 65 * This function allows the user to hide/show credits.
AhmedPlaymaker 5:e4df87957a5b 66 */
AhmedPlaymaker 83:329da564799a 67 void showCredits();
AhmedPlaymaker 65:2872ca289b49 68
AhmedPlaymaker 65:2872ca289b49 69 private:
AhmedPlaymaker 30:461231877c89 70 float cs_sc[2]; //this array helps to return Control speeds and Show credits parameters.
AhmedPlaymaker 83:329da564799a 71
AhmedPlaymaker 83:329da564799a 72 //Pointer to the game pad object pad.
AhmedPlaymaker 83:329da564799a 73 Gamepad *_pad;
AhmedPlaymaker 83:329da564799a 74 //Pointer to the N5110 object lcd.
AhmedPlaymaker 83:329da564799a 75 N5110 *_lcd;
AhmedPlaymaker 65:2872ca289b49 76
AhmedPlaymaker 5:e4df87957a5b 77
AhmedPlaymaker 5:e4df87957a5b 78 };
AhmedPlaymaker 5:e4df87957a5b 79 #endif