ELEC2645 (2018/19) / Mbed 2 deprecated EL17MCD

Dependencies:   mbed

main.cpp

Committer:
el17mcd
Date:
2019-04-13
Revision:
11:4e2eb64031a0
Parent:
10:d4fb12e9e7cd
Child:
12:9e6d5d0a0c82

File content as of revision 11:4e2eb64031a0:

/*
ELEC2645 Embedded Systems Project
School of Electronic & Electrical Engineering
University of Leeds
Name: Maxim C. Delacoe
Username: EL 17 MCD
Student ID Number: 2011 58344
Date: 19/03/2019
*/
///////// pre-processor directives ////////
#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"
#include "Bitmap.h"
#include "TankL.h"
#include "TanksEngine.h"
#include "Projectile.h"
#define PI 3.14159265
#define DEG2PI 0.0174532925 

#include <cmath>

#ifdef WITH_TESTING

#endif

/////////////// objects ///////////////
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
TanksEngine engine;
Gamepad pad;

void welcome()
{
    lcd.clear();
    lcd.printString("  ELEC 2645",0,0);
    lcd.printString("  Game  ",0,1);
    lcd.printString("   Project",0,2);
    lcd.printString("Max C. Delacoe",0,4);
    lcd.printString(" 2011 58344",0,5);
    lcd.refresh();
    wait(0.2);
}

int main()
{
    lcd.init();
    pad.init();
    engine.initgame();
    int fps = 60;
    float frame_period_ms = 1000/fps;
    
   // welcome();  // display welcome message 

    while(1) {  // infinite loop
    
        lcd.clear();          
        if (engine.get_turn() == 1) {
            engine.left_tank_turn(pad, lcd);
        } else if (engine.get_turn() == 2) {
            engine.projectile_phase(lcd);
        } else { int turn = 3; }// means nothing
        lcd.refresh();
        wait_ms(16.666);

        
    }
    /*
lcd.clear();
lcd.printString("DONE",0,1);
lcd.refresh();
wait(10);*/
}