
Ellis Blackford Stroud 201155309
Dependencies: mbed FATFileSystem
main.cpp
- Committer:
- ellisbhastroud
- Date:
- 2019-04-17
- Revision:
- 5:0b31909caf7f
- Parent:
- 4:035448357749
- Child:
- 8:d410856c6d04
File content as of revision 5:0b31909caf7f:
/* ELEC2645 Embedded Systems Project School of Electronic & Electrical Engineering University of Leeds Name: Ellis Blackford Stroud Username: el17ebs Student ID Number: 201155309 Date: 09/05/19 */ #include "mbed.h" #include "Gamepad.h" #include "N5110.h" #include "Menu.h" #include "GolfEngine.h" // objects N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); Gamepad pad; Menu menu; GolfEngine golf; void init(); int frame_rate = 40; int main() { init(); lcd.clear(); menu.print_welcome(lcd); lcd.clear(); bool start_game = false; while(start_game == false) { //menu loop navigates menu until game started menu.menu_screen(pad, lcd); start_game = menu.menu_change(lcd, pad); //changes menu screen to selected screen the returns true when start game } frame_rate = menu.get_frame_rate(); //can be changed in the settings screen //game loop to run game while(1){ lcd.clear(); golf.update_ball(pad, frame_rate); golf.drawGame(lcd); lcd.refresh(); wait(1.0f/frame_rate); //time between loops/frames } } void init() { lcd.init(); pad.init(); menu.init(); golf.init(); lcd.setContrast(0.5f); }