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:
49:441c32f6603e
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 33:249cf423fb18 1 #ifndef Stats_H
AhmedPlaymaker 33:249cf423fb18 2 #define Stats_H
AhmedPlaymaker 33:249cf423fb18 3
AhmedPlaymaker 33:249cf423fb18 4 #include "mbed.h"
AhmedPlaymaker 33:249cf423fb18 5 #include "N5110.h"
AhmedPlaymaker 33:249cf423fb18 6 #include "Gamepad.h"
AhmedPlaymaker 33:249cf423fb18 7 #include "SDFileSystem.h"
AhmedPlaymaker 33:249cf423fb18 8
AhmedPlaymaker 33:249cf423fb18 9 class Stats
AhmedPlaymaker 33:249cf423fb18 10 {
AhmedPlaymaker 33:249cf423fb18 11 public:
AhmedPlaymaker 33:249cf423fb18 12
AhmedPlaymaker 33:249cf423fb18 13 Stats();
AhmedPlaymaker 33:249cf423fb18 14 ~Stats();
AhmedPlaymaker 33:249cf423fb18 15
AhmedPlaymaker 83:329da564799a 16 /** Initialise Stats
AhmedPlaymaker 83:329da564799a 17 *
AhmedPlaymaker 83:329da564799a 18 * This function passes the pointers to the stats class so that it can control the screen and the gamepad.
AhmedPlaymaker 83:329da564799a 19 */
AhmedPlaymaker 83:329da564799a 20 void init(N5110 *lcd, Gamepad *pad);
AhmedPlaymaker 83:329da564799a 21
AhmedPlaymaker 33:249cf423fb18 22 /** Stats Display
AhmedPlaymaker 33:249cf423fb18 23 *
AhmedPlaymaker 33:249cf423fb18 24 * This function is used to configure stats.
AhmedPlaymaker 33:249cf423fb18 25 */
AhmedPlaymaker 83:329da564799a 26 void StatsDisplay();
AhmedPlaymaker 33:249cf423fb18 27
AhmedPlaymaker 33:249cf423fb18 28 /** write
AhmedPlaymaker 33:249cf423fb18 29 *
AhmedPlaymaker 33:249cf423fb18 30 * This function is used to write to the file
AhmedPlaymaker 33:249cf423fb18 31 */
AhmedPlaymaker 33:249cf423fb18 32 void write(int level, SDFileSystem &sd);
AhmedPlaymaker 33:249cf423fb18 33
AhmedPlaymaker 33:249cf423fb18 34 /** Read
AhmedPlaymaker 33:249cf423fb18 35 *
AhmedPlaymaker 33:249cf423fb18 36 * This function is used to read from the file
AhmedPlaymaker 33:249cf423fb18 37 */
AhmedPlaymaker 33:249cf423fb18 38 void read(SDFileSystem &sd);
AhmedPlaymaker 33:249cf423fb18 39
AhmedPlaymaker 33:249cf423fb18 40 /** delete file
AhmedPlaymaker 33:249cf423fb18 41 *
AhmedPlaymaker 33:249cf423fb18 42 * This function allows us to delete the file
AhmedPlaymaker 33:249cf423fb18 43 */
AhmedPlaymaker 33:249cf423fb18 44 void delete_file(char filename[]);
AhmedPlaymaker 33:249cf423fb18 45
AhmedPlaymaker 33:249cf423fb18 46
AhmedPlaymaker 33:249cf423fb18 47 char bufferlevel[14]; //this helps me print the highest level on screen.
AhmedPlaymaker 33:249cf423fb18 48
AhmedPlaymaker 33:249cf423fb18 49 private:
AhmedPlaymaker 33:249cf423fb18 50 int _stored_top_level;
AhmedPlaymaker 33:249cf423fb18 51 int _current_level;
AhmedPlaymaker 33:249cf423fb18 52 int _top_level;
AhmedPlaymaker 33:249cf423fb18 53
AhmedPlaymaker 83:329da564799a 54 //Pointer to the game pad object pad.
AhmedPlaymaker 83:329da564799a 55 Gamepad *_pad;
AhmedPlaymaker 83:329da564799a 56 //Pointer to the N5110 object lcd.
AhmedPlaymaker 83:329da564799a 57 N5110 *_lcd;
AhmedPlaymaker 83:329da564799a 58
AhmedPlaymaker 33:249cf423fb18 59
AhmedPlaymaker 33:249cf423fb18 60 };
AhmedPlaymaker 33:249cf423fb18 61 #endif