Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
GameEngine/WinLoose/WinLoose.h@104:17040265b7b4, 2019-05-09 (annotated)
- Committer:
- AhmedPlaymaker
- Date:
- Thu May 09 14:52:19 2019 +0000
- Revision:
- 104:17040265b7b4
- Parent:
- 93:7f9c31ed5cab
Final Submission. I have read and agreed with Statement of Academic Integrity.
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 | 93:7f9c31ed5cab | 8 | /** WinLoose Class |
AhmedPlaymaker | 93:7f9c31ed5cab | 9 | @brief This class encompasses level transitions, loosing screen and level display. |
AhmedPlaymaker | 93:7f9c31ed5cab | 10 | @author Ahmed N.Adamjee |
AhmedPlaymaker | 93:7f9c31ed5cab | 11 | @date 8th May 2019 |
AhmedPlaymaker | 93:7f9c31ed5cab | 12 | */ |
AhmedPlaymaker | 44:cd10d07ea1e5 | 13 | class WinLoose |
AhmedPlaymaker | 44:cd10d07ea1e5 | 14 | { |
AhmedPlaymaker | 93:7f9c31ed5cab | 15 | public: |
AhmedPlaymaker | 93:7f9c31ed5cab | 16 | /** Constructor */ |
AhmedPlaymaker | 44:cd10d07ea1e5 | 17 | WinLoose(); |
AhmedPlaymaker | 93:7f9c31ed5cab | 18 | /** Destructor */ |
AhmedPlaymaker | 44:cd10d07ea1e5 | 19 | ~WinLoose(); |
AhmedPlaymaker | 93:7f9c31ed5cab | 20 | |
AhmedPlaymaker | 93:7f9c31ed5cab | 21 | /** |
AhmedPlaymaker | 93:7f9c31ed5cab | 22 | * @brief Gets pointers of lcd and pad from int main() to be used privately in the entire class. |
AhmedPlaymaker | 93:7f9c31ed5cab | 23 | * @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 | 93:7f9c31ed5cab | 24 | * @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 | 25 | */ |
AhmedPlaymaker | 83:329da564799a | 26 | void init(N5110 *lcd, Gamepad *pad); |
AhmedPlaymaker | 93:7f9c31ed5cab | 27 | |
AhmedPlaymaker | 93:7f9c31ed5cab | 28 | /** |
AhmedPlaymaker | 93:7f9c31ed5cab | 29 | * @brief This function prepares the game for the next level and initialises WinLoose and obtains required class addresses to use in other functions. |
AhmedPlaymaker | 93:7f9c31ed5cab | 30 | * @param level @details stores the value of the current level. |
AhmedPlaymaker | 44:cd10d07ea1e5 | 31 | */ |
AhmedPlaymaker | 83:329da564799a | 32 | int LevelComplete(int level); |
AhmedPlaymaker | 93:7f9c31ed5cab | 33 | |
AhmedPlaymaker | 93:7f9c31ed5cab | 34 | /** |
AhmedPlaymaker | 93:7f9c31ed5cab | 35 | * @brief Displays the level on screen. |
AhmedPlaymaker | 93:7f9c31ed5cab | 36 | * @param level @details stores the value of the current level. |
AhmedPlaymaker | 49:441c32f6603e | 37 | */ |
AhmedPlaymaker | 83:329da564799a | 38 | void displayLevel(int level); |
AhmedPlaymaker | 93:7f9c31ed5cab | 39 | |
AhmedPlaymaker | 93:7f9c31ed5cab | 40 | /** |
AhmedPlaymaker | 93:7f9c31ed5cab | 41 | * @brief This function displays a loosing screen on the lcd display. |
AhmedPlaymaker | 44:cd10d07ea1e5 | 42 | */ |
AhmedPlaymaker | 83:329da564799a | 43 | void GameOver(); |
AhmedPlaymaker | 44:cd10d07ea1e5 | 44 | |
AhmedPlaymaker | 93:7f9c31ed5cab | 45 | private: |
AhmedPlaymaker | 44:cd10d07ea1e5 | 46 | char bufferlevel[14]; //this helps me print the level on screen. |
AhmedPlaymaker | 93:7f9c31ed5cab | 47 | |
AhmedPlaymaker | 83:329da564799a | 48 | //Pointer to the game pad object pad. |
AhmedPlaymaker | 83:329da564799a | 49 | Gamepad *_pad; |
AhmedPlaymaker | 83:329da564799a | 50 | //Pointer to the N5110 object lcd. |
AhmedPlaymaker | 83:329da564799a | 51 | N5110 *_lcd; |
AhmedPlaymaker | 93:7f9c31ed5cab | 52 | |
AhmedPlaymaker | 93:7f9c31ed5cab | 53 | |
AhmedPlaymaker | 44:cd10d07ea1e5 | 54 | |
AhmedPlaymaker | 44:cd10d07ea1e5 | 55 | }; |
AhmedPlaymaker | 44:cd10d07ea1e5 | 56 | #endif |