Kern Fowler / Mbed 2 deprecated Donkey_Kong_Game

Dependencies:   mbed

Committer:
Kern_EL17KJTF
Date:
Thu May 09 00:42:18 2019 +0000
Revision:
26:fa78fa1b2a60
Parent:
23:ecb74e52163d
Documentation - Controls - Code Example Added.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kern_EL17KJTF 13:94abfe83a294 1 #ifndef CONTROLS_H
Kern_EL17KJTF 13:94abfe83a294 2 #define CONTROLS_H
Kern_EL17KJTF 13:94abfe83a294 3
Kern_EL17KJTF 13:94abfe83a294 4 #include "mbed.h"
Kern_EL17KJTF 13:94abfe83a294 5 #include "N5110.h"
Kern_EL17KJTF 13:94abfe83a294 6 #include "Gamepad.h"
Kern_EL17KJTF 13:94abfe83a294 7
Kern_EL17KJTF 19:8400ecdb69e9 8 /** Controls Class
Kern_EL17KJTF 26:fa78fa1b2a60 9 *@brief This class is for the controls menu screen
Kern_EL17KJTF 19:8400ecdb69e9 10 *@author Kern Fowler
Kern_EL17KJTF 19:8400ecdb69e9 11 *@version 1.0
Kern_EL17KJTF 19:8400ecdb69e9 12 *@date May 2019
Kern_EL17KJTF 19:8400ecdb69e9 13 */
Kern_EL17KJTF 13:94abfe83a294 14
Kern_EL17KJTF 19:8400ecdb69e9 15 class Controls {
Kern_EL17KJTF 13:94abfe83a294 16
Kern_EL17KJTF 19:8400ecdb69e9 17 public:
Kern_EL17KJTF 19:8400ecdb69e9 18 /** Controls Constructor
Kern_EL17KJTF 26:fa78fa1b2a60 19 @brief Builds my default Controls contructor.
Kern_EL17KJTF 19:8400ecdb69e9 20 @details This does not have any setup.
Kern_EL17KJTF 19:8400ecdb69e9 21 */
Kern_EL17KJTF 19:8400ecdb69e9 22 Controls();
Kern_EL17KJTF 19:8400ecdb69e9 23 /** Controls Destructor
Kern_EL17KJTF 19:8400ecdb69e9 24 @brief Builds my default Controls Destructor.
Kern_EL17KJTF 19:8400ecdb69e9 25 @details This does not have any setup.
Kern_EL17KJTF 19:8400ecdb69e9 26 */
Kern_EL17KJTF 19:8400ecdb69e9 27 ~Controls();
Kern_EL17KJTF 19:8400ecdb69e9 28 // Mutators
Kern_EL17KJTF 13:94abfe83a294 29
Kern_EL17KJTF 19:8400ecdb69e9 30 /**
Kern_EL17KJTF 19:8400ecdb69e9 31 *@brief Prints the Controls menu.
Kern_EL17KJTF 19:8400ecdb69e9 32 *@param pad The Gamepad class is used.
Kern_EL17KJTF 19:8400ecdb69e9 33 *@param lcd The N5110 class is used.
Kern_EL17KJTF 19:8400ecdb69e9 34 *@details Prints various text to screen relating to the game controls.
Kern_EL17KJTF 26:fa78fa1b2a60 35 *@code
Kern_EL17KJTF 26:fa78fa1b2a60 36 void Controls::controls_run(Gamepad &pad, N5110 &lcd) {
Kern_EL17KJTF 26:fa78fa1b2a60 37 wait_ms(250);
Kern_EL17KJTF 26:fa78fa1b2a60 38 while (pad.check_event(Gamepad::BACK_PRESSED) == false) { // Continues to show this screen until BACK button pressed.
Kern_EL17KJTF 26:fa78fa1b2a60 39 //printf("Control State");
Kern_EL17KJTF 26:fa78fa1b2a60 40 lcd.clear();
Kern_EL17KJTF 26:fa78fa1b2a60 41 lcd.printString("Controls",19,0);
Kern_EL17KJTF 26:fa78fa1b2a60 42 lcd.printString("Move Joystick ",0,2);
Kern_EL17KJTF 26:fa78fa1b2a60 43 lcd.printString("Left or Right ",0,3);
Kern_EL17KJTF 26:fa78fa1b2a60 44 lcd.printString(" to move ",0,4);
Kern_EL17KJTF 26:fa78fa1b2a60 45 lcd.printString(" Donkey Kong ",0,5);
Kern_EL17KJTF 26:fa78fa1b2a60 46 lcd.refresh();
Kern_EL17KJTF 26:fa78fa1b2a60 47 wait_ms(1.0f/24);
Kern_EL17KJTF 26:fa78fa1b2a60 48 }
Kern_EL17KJTF 26:fa78fa1b2a60 49 }
Kern_EL17KJTF 26:fa78fa1b2a60 50 @endcode
Kern_EL17KJTF 19:8400ecdb69e9 51 */
Kern_EL17KJTF 19:8400ecdb69e9 52 void controls_run(Gamepad &pad, N5110 &lcd);
Kern_EL17KJTF 13:94abfe83a294 53 };
Kern_EL17KJTF 13:94abfe83a294 54
Kern_EL17KJTF 19:8400ecdb69e9 55 #endif