Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp
- Committer:
- shahidsajid
- Date:
- 2019-05-09
- Revision:
- 34:d9099874bbc3
- Parent:
- 33:9d34ef219fff
File content as of revision 34:d9099874bbc3:
/*
ELEC2645 Embedded Systems Project
School of Electronic & Electrical Engineering
University of Leeds
Name: Shahid Zubin Sajid
Username: el17szs   
Student ID Number: 201197609
Date: 21/03/2019
*/
/////////////// pre processor directives  /////////////////
#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"
#include "Ball.h"
#include "Bat.h"
#include "Cricket.h"
#define BALL_SIZE 2
#define BAT_HEIGHT 3
#define BAT_WIDTH 6
////////////////////Objects//////////////////////////////
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Gamepad mainpad;
Cricket cricket;
////////////////////Prototypes//////////////////////////////
void init();
void welcome();
void draw();
////////////////////Functions//////////////////////////////
int main(){
    int fps=14;
    init();
    
    //prints the first intro screen
    cricket.intro(lcd);
    //main game loop
    while(1){
        cricket.game(lcd,mainpad);
        draw();
        wait(1.0f/fps);                
    }
    
}
//intilialises the game
void init(){
    lcd.init();
    mainpad.init();
    cricket.init(BALL_SIZE,BAT_WIDTH,BAT_HEIGHT);
}
//draws all the game components
void draw(){
    lcd.clear();
    cricket.draw(lcd);
    lcd.refresh();
}