Kern Fowler / Mbed 2 deprecated Donkey_Kong_Game

Dependencies:   mbed

Committer:
Kern_EL17KJTF
Date:
Thu May 09 00:47:23 2019 +0000
Revision:
29:be053907f5c7
Parent:
23:ecb74e52163d
Documentation - Instructions - Code Example Added.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kern_EL17KJTF 14:d6fbbb912425 1 #ifndef INSTRUCTIONS_H
Kern_EL17KJTF 14:d6fbbb912425 2 #define INSTRUCTIONS_H
Kern_EL17KJTF 14:d6fbbb912425 3
Kern_EL17KJTF 14:d6fbbb912425 4 #include "mbed.h"
Kern_EL17KJTF 14:d6fbbb912425 5 #include "N5110.h"
Kern_EL17KJTF 14:d6fbbb912425 6 #include "Gamepad.h"
Kern_EL17KJTF 14:d6fbbb912425 7
Kern_EL17KJTF 22:d265f506446b 8 /** Instructions Class
Kern_EL17KJTF 22:d265f506446b 9 *@brief This class is for the instructions menu screen.
Kern_EL17KJTF 22:d265f506446b 10 *@author Kern Fowler
Kern_EL17KJTF 22:d265f506446b 11 *@version 1.0
Kern_EL17KJTF 22:d265f506446b 12 *@date May 2019
Kern_EL17KJTF 22:d265f506446b 13 */
Kern_EL17KJTF 14:d6fbbb912425 14
Kern_EL17KJTF 22:d265f506446b 15 class Instructions {
Kern_EL17KJTF 14:d6fbbb912425 16
Kern_EL17KJTF 22:d265f506446b 17 public:
Kern_EL17KJTF 22:d265f506446b 18 /** Instructions Constructor
Kern_EL17KJTF 29:be053907f5c7 19 @brief Builds my default Instructions contructor.
Kern_EL17KJTF 22:d265f506446b 20 @details This does not have any setup.
Kern_EL17KJTF 22:d265f506446b 21 */
Kern_EL17KJTF 22:d265f506446b 22 Instructions();
Kern_EL17KJTF 22:d265f506446b 23 /** Instructions Destructor
Kern_EL17KJTF 22:d265f506446b 24 @brief Builds my default Instructions destructor.
Kern_EL17KJTF 22:d265f506446b 25 @details This does not have any setup.
Kern_EL17KJTF 22:d265f506446b 26 */
Kern_EL17KJTF 22:d265f506446b 27 ~Instructions();
Kern_EL17KJTF 22:d265f506446b 28 // Mutators
Kern_EL17KJTF 14:d6fbbb912425 29
Kern_EL17KJTF 22:d265f506446b 30 /**
Kern_EL17KJTF 22:d265f506446b 31 *@brief Prints the Instructions menu.
Kern_EL17KJTF 22:d265f506446b 32 *@param pad The Gamepad class is used.
Kern_EL17KJTF 22:d265f506446b 33 *@param lcd The N5110 class is used.
Kern_EL17KJTF 22:d265f506446b 34 *@details Prints various text to screen relating to how to play the game.
Kern_EL17KJTF 29:be053907f5c7 35 *@code
Kern_EL17KJTF 29:be053907f5c7 36 void Instructions::instructions_run(Gamepad &pad, N5110 &lcd) {
Kern_EL17KJTF 29:be053907f5c7 37 wait_ms(250);
Kern_EL17KJTF 29:be053907f5c7 38 while (pad.check_event(Gamepad::BACK_PRESSED) == false) { // Continues to show this screen until BACK button pressed.
Kern_EL17KJTF 29:be053907f5c7 39 //printf("Instructions State");
Kern_EL17KJTF 29:be053907f5c7 40 lcd.clear();
Kern_EL17KJTF 29:be053907f5c7 41 lcd.printString("Instructions",7,0);
Kern_EL17KJTF 29:be053907f5c7 42 lcd.printString("Move DonkeyKong",0,2);
Kern_EL17KJTF 29:be053907f5c7 43 lcd.printString("left or right",0,3);
Kern_EL17KJTF 29:be053907f5c7 44 lcd.printString("to collect ",0,4);
Kern_EL17KJTF 29:be053907f5c7 45 lcd.printString("Bananas",0,5);
Kern_EL17KJTF 29:be053907f5c7 46 lcd.refresh();
Kern_EL17KJTF 29:be053907f5c7 47 wait(4); // Changes to next screen after 4 seconds.
Kern_EL17KJTF 29:be053907f5c7 48 lcd.clear();
Kern_EL17KJTF 29:be053907f5c7 49 lcd.printString("Instructions",7,0);
Kern_EL17KJTF 29:be053907f5c7 50 lcd.printString("Avoid the ",0,2);
Kern_EL17KJTF 29:be053907f5c7 51 lcd.printString("falling ",0,3);
Kern_EL17KJTF 29:be053907f5c7 52 lcd.printString("Barrels ",0,4);
Kern_EL17KJTF 29:be053907f5c7 53 lcd.refresh();
Kern_EL17KJTF 29:be053907f5c7 54 wait(4); // Loops through both screens.
Kern_EL17KJTF 29:be053907f5c7 55 }
Kern_EL17KJTF 29:be053907f5c7 56 }
Kern_EL17KJTF 29:be053907f5c7 57 @endcode
Kern_EL17KJTF 22:d265f506446b 58 */
Kern_EL17KJTF 22:d265f506446b 59 void instructions_run(Gamepad &pad, N5110 &lcd);
Kern_EL17KJTF 14:d6fbbb912425 60 };
Kern_EL17KJTF 14:d6fbbb912425 61
Kern_EL17KJTF 22:d265f506446b 62 #endif