Su 200943147

Dependencies:   Gamepad N5110 mbed

main.cpp

Committer:
GS00
Date:
2017-04-29
Revision:
4:1faa216ac5cd
Parent:
3:9dd35424cdfe

File content as of revision 4:1faa216ac5cd:

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

struct UserInput {
    Direction d;
};

//N5110 lcd(p7,p8,p9,p10,p11,p13,p21);
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Gamepad pad;
Engine Engine;
void Init();

int main()
{
    Init();
    // game loop - read input, update the game state and render the display
    while (1) {
        Engine.ReadInput(pad);
        Engine.Update(pad);
        Engine.Pixel(lcd);
        lcd.refresh();
        wait(0.1);
    }
}

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

    // initialise the game
    Engine.Init(lcd);
    lcd.normalMode();      // normal colour mode
    lcd.setBrightness(0.5); // put LED backlight on 50%

    ShapeArray[x+n][y]=0;
    ShapeArray[x+1+n][y]=0;
    ShapeArray[x+2+n][y]=0;
    ShapeArray[x+3+n][y]=0;
    ShapeArray[x+4+n][y]=0;
    ShapeArray[x+5+n][y]=0;

    ShapeArray[x+n][y+1]=0;
    ShapeArray[x+5+n][y+1]=0;

    ShapeArray[x+n][y+2]=0;
    ShapeArray[x+5+n][y+2]=0;

    ShapeArray[x+n][y+3]=0;
    ShapeArray[x+5+n][y+3]=0;

    ShapeArray[x+n][y+4]=0;
    ShapeArray[x+5+n][y+4]=0;

}