Kern Fowler / Mbed 2 deprecated Donkey_Kong_Game

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Instructions.cpp Source File

Instructions.cpp

00001 /*
00002 ELEC2645 Project
00003 Instructions.cpp
00004 Class file for Instructions in Donkey Kong game.
00005 */
00006 
00007 #include "Instructions.h"
00008 
00009 // Constructor - Doesn't require any setup.
00010 Instructions::Instructions()
00011 {
00012 
00013 }
00014 
00015 // Deconstructor - Doesn't require any setup.
00016 Instructions::~Instructions()
00017 {
00018 
00019 }
00020 
00021 // Prints various text to screen relating to how to play the game.
00022 void Instructions::instructions_run(Gamepad &pad, N5110 &lcd) {
00023     wait_ms(250);
00024     while (pad.check_event(Gamepad::BACK_PRESSED) == false) { // Continues to show this screen until BACK button pressed.
00025         //printf("Instructions State");
00026         lcd.clear();
00027         lcd.printString("Instructions",7,0);
00028         lcd.printString("Move DonkeyKong",0,2);
00029         lcd.printString("left or right",0,3);
00030         lcd.printString("to collect ",0,4);
00031         lcd.printString("Bananas",0,5);
00032         lcd.refresh();
00033         wait(4); // Changes to next screen after 4 seconds.
00034         lcd.clear();
00035         lcd.printString("Instructions",7,0);
00036         lcd.printString("Avoid the ",0,2);
00037         lcd.printString("falling ",0,3);
00038         lcd.printString("Barrels ",0,4);
00039         lcd.refresh();
00040         wait(4); // Loops through both screens. 
00041     }
00042 }