Ikenna Adrian Ozoemena 201157039
Dependencies: mbed
main.cpp
- Committer:
- ikenna1
- Date:
- 2019-04-18
- Revision:
- 27:f99249e727fd
- Parent:
- 21:628fb703188f
- Child:
- 30:711d722f3cef
File content as of revision 27:f99249e727fd:
/* ELEC2645 Embedded Systems Project School of Electronic & Electrical Engineering University of Leeds Name: Ikenna Adrian Ozoemena Username: el17aio Student ID Number: 201157039 Date: 20/02/2019 */ //______________pre-processor directives________________________________________ #include "mbed.h" #include "N5110.h" #include "RosenEngine.h" #include "Menu.h" //_______________objects________________________________________________________ N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); Gamepad pad; RosenEngine rosen; Menu menu; //_______________prototypes_____________________________________________________ void init(); void welcome(); void render(); void ship_select(); //_______________functions______________________________________________________ int main() { int fps = 12; init(); printf("Init function completed...\n"); while(1) { welcome(); rosen.reset(); //printf("ycursor = %d",rosen.get_ycursor()); // make it so it works with get_cursor = 16; if(rosen.get_ycursor() == 16) { while ( pad.check_event(Gamepad::BACK_PRESSED) == false) { // printf("play...\n"); rosen.read_input(pad); rosen.update(pad); render(); wait(1.0f/fps); } } if(rosen.get_ycursor() == 24) { while ( pad.check_event(Gamepad::BACK_PRESSED) == false) { rosen.read_input(pad); rosen.update(pad); ship_select(); wait(1.0f/fps); printf("ship = %d\n",rosen.get_shipno()); // printf("menu...\n"); } } } } void init() { // need to initialise LCD and Gamepad lcd.init(); pad.init(); rosen.init(9,6,3,42,41); } void render() { // clear screen, re-draw and refresh lcd.clear(); rosen.draw(lcd, pad); rosen.get_pos(); lcd.refresh(); } void ship_select() { lcd.clear(); rosen.ship_select(lcd); rosen.get_pos(); lcd.refresh(); } // simple splash screen displayed on start-up void welcome() { while( pad.check_event(Gamepad::START_PRESSED) == false) { rosen.title(lcd); rosen.read_input(pad); rosen.update(pad); lcd.refresh(); } printf("Welcome Function completed...\n"); }