Meteor defense project

Dependencies:   N5110 mbed

main.cpp

Committer:
jasper0712
Date:
2017-04-10
Revision:
17:53aedd20155a
Parent:
14:064b8d7f348d
Child:
28:450ab72fabdc

File content as of revision 17:53aedd20155a:

#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "GameEngine.h"

#define PI 3.14159265
//Y rows and X columns
#define Rows 48
#define Cols 84

N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Gamepad pad;
GameEngine game;



int gamefps = 15;
void init();
void render();

int main()
{

    init();
    while (true) {
        game.update(pad, lcd);
        render();
    }
}

void init()
{
    // need to initialise LCD and Gamepad 
    lcd.init();
    pad.init();
    game.init();
    // initialise the game
}

void render()
{
    // clear screen, re-draw and refresh
    lcd.refresh();
    wait(1.0/gamefps);
    lcd.clear(); 
}