![](/media/cache/profiles/LinkedIn_0NghoZJ.jpeg.50x50_q85.jpg)
Snake vs Block Game to be run upon K64F.
GameEngine/WinLoose/WinLoose.h@83:329da564799a, 2019-05-06 (annotated)
- Committer:
- AhmedPlaymaker
- Date:
- Mon May 06 14:28:35 2019 +0000
- Revision:
- 83:329da564799a
- Parent:
- 51:387249f9b333
- Child:
- 93:7f9c31ed5cab
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?
User | Revision | Line number | New contents of line |
---|---|---|---|
AhmedPlaymaker | 44:cd10d07ea1e5 | 1 | #ifndef WINLOOSE_H |
AhmedPlaymaker | 44:cd10d07ea1e5 | 2 | #define WINLOOSE_H |
AhmedPlaymaker | 44:cd10d07ea1e5 | 3 | |
AhmedPlaymaker | 44:cd10d07ea1e5 | 4 | #include "mbed.h" |
AhmedPlaymaker | 44:cd10d07ea1e5 | 5 | #include "N5110.h" |
AhmedPlaymaker | 44:cd10d07ea1e5 | 6 | #include "Gamepad.h" |
AhmedPlaymaker | 44:cd10d07ea1e5 | 7 | |
AhmedPlaymaker | 44:cd10d07ea1e5 | 8 | class WinLoose |
AhmedPlaymaker | 44:cd10d07ea1e5 | 9 | { |
AhmedPlaymaker | 44:cd10d07ea1e5 | 10 | public: |
AhmedPlaymaker | 44:cd10d07ea1e5 | 11 | |
AhmedPlaymaker | 44:cd10d07ea1e5 | 12 | WinLoose(); |
AhmedPlaymaker | 44:cd10d07ea1e5 | 13 | ~WinLoose(); |
AhmedPlaymaker | 44:cd10d07ea1e5 | 14 | |
AhmedPlaymaker | 83:329da564799a | 15 | /** Initialise WinLoose |
AhmedPlaymaker | 83:329da564799a | 16 | * |
AhmedPlaymaker | 83:329da564799a | 17 | * This function initialises the WinLoose Class. |
AhmedPlaymaker | 83:329da564799a | 18 | */ |
AhmedPlaymaker | 83:329da564799a | 19 | void init(N5110 *lcd, Gamepad *pad); |
AhmedPlaymaker | 83:329da564799a | 20 | |
AhmedPlaymaker | 44:cd10d07ea1e5 | 21 | /** Level Complete |
AhmedPlaymaker | 44:cd10d07ea1e5 | 22 | * |
AhmedPlaymaker | 44:cd10d07ea1e5 | 23 | * This function prepares the game for the next level and initialises WinLoose and obtains required class addresses to use in other functions. |
AhmedPlaymaker | 44:cd10d07ea1e5 | 24 | */ |
AhmedPlaymaker | 83:329da564799a | 25 | int LevelComplete(int level); |
AhmedPlaymaker | 44:cd10d07ea1e5 | 26 | |
AhmedPlaymaker | 49:441c32f6603e | 27 | /** Display Level |
AhmedPlaymaker | 49:441c32f6603e | 28 | * |
AhmedPlaymaker | 49:441c32f6603e | 29 | * Displays the level on screen. |
AhmedPlaymaker | 49:441c32f6603e | 30 | */ |
AhmedPlaymaker | 83:329da564799a | 31 | void displayLevel(int level); |
AhmedPlaymaker | 49:441c32f6603e | 32 | |
AhmedPlaymaker | 44:cd10d07ea1e5 | 33 | /** Game Over |
AhmedPlaymaker | 44:cd10d07ea1e5 | 34 | * |
AhmedPlaymaker | 44:cd10d07ea1e5 | 35 | * This function does the required tasks to implement a loosing screen. |
AhmedPlaymaker | 44:cd10d07ea1e5 | 36 | */ |
AhmedPlaymaker | 83:329da564799a | 37 | void GameOver(); |
AhmedPlaymaker | 44:cd10d07ea1e5 | 38 | |
AhmedPlaymaker | 44:cd10d07ea1e5 | 39 | private: |
AhmedPlaymaker | 44:cd10d07ea1e5 | 40 | char bufferlevel[14]; //this helps me print the level on screen. |
AhmedPlaymaker | 44:cd10d07ea1e5 | 41 | |
AhmedPlaymaker | 83:329da564799a | 42 | //Pointer to the game pad object pad. |
AhmedPlaymaker | 83:329da564799a | 43 | Gamepad *_pad; |
AhmedPlaymaker | 83:329da564799a | 44 | //Pointer to the N5110 object lcd. |
AhmedPlaymaker | 83:329da564799a | 45 | N5110 *_lcd; |
AhmedPlaymaker | 83:329da564799a | 46 | |
AhmedPlaymaker | 44:cd10d07ea1e5 | 47 | |
AhmedPlaymaker | 44:cd10d07ea1e5 | 48 | |
AhmedPlaymaker | 44:cd10d07ea1e5 | 49 | }; |
AhmedPlaymaker | 44:cd10d07ea1e5 | 50 | #endif |