Dependencies:   mbed

On Minerva

main.cpp

Committer:
el19zf
Date:
2020-04-14
Revision:
4:b12a49f0b730
Parent:
3:b8fbaefc496c
Child:
5:6774b7272e85

File content as of revision 4:b12a49f0b730:

/* 
ELEC2645 Embedded Systems Project
School of Electronic & Electrical Engineering
University of Leeds
2019/20

Name:Zeyu Feng
Username:el19zf
Student ID Number:201377605
Date:11/3/2020
*/

// includes
#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"
#include "People.h"
#include "PeopleEngine.h"
#include "shot.h"

// objects
Gamepad pad;
N5110 lcd;
PeopleEngine engine;
shot shot;


int main()
{
    //initial
    lcd.init();
    lcd.setContrast(0.5);
    engine.init();
    pad.init();
    lcd.refresh();
    shot.gen_shot();
    
    //a infinite loop to control position of the people, update the game state
    while(1) {
        lcd.clear();
        //   people
        engine.read_input(pad);
        engine.update();
        engine.draw(lcd);
        //   shot
        //shot.gen_shot();
        shot.draw(lcd);
        shot.shot_move();
        lcd.refresh();
        printf("shot changes\n");
        wait_ms(100);//fps = 10

    }
        
}