ELEC2645 (2017/18) / Mbed 2 deprecated el17yw

Dependencies:   mbed

main.cpp

Committer:
RickYu
Date:
2018-04-28
Revision:
19:362ad1cd6d4a
Parent:
18:78001ecadcb2
Child:
20:a3fd428fb4f4

File content as of revision 19:362ad1cd6d4a:

#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"
#include "rect.h"
#include "boom.h"
#include "bigboom.h"
#include "money.h"
#include "engine.h"
#include "help.h"


DigitalOut gpo(D0);
DigitalOut led(LED_RED);


N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);

Gamepad pad;

engine engine;
help help;


void init();
void welcome();
void render();



int main()
{


     init();
     help.welcome(pad,lcd);
     render();

     
while(1){
    
     engine.read_input(pad);
     engine.update(pad,lcd);
     render();
     wait(0.1);
 }
     
}
    
void init()
{
    //initialise LCD and Gamepad 
    lcd.init();
    pad.init();
     
   
}
/*
void welcome() {
    
    lcd.printString("   Boom",0,0);  
    lcd.printString("   Press start",0,2);    
    lcd.printString("   help",0,4);
    //lcd.printString("  Press Start ",0,4);
    lcd.refresh();
     
    //LEDs keep flashing until start button is pressed 
    while ( pad.check_event(Gamepad::START_PRESSED) == false) {
        pad.leds_on();
        wait(0.1);
        pad.leds_off();
        wait(0.1);
    }
 }
 */
 
void render()
{
    // clear screen, re-draw and refresh
    lcd.clear();  
    engine.draw(lcd);
    lcd.refresh();
}