Ikenna Adrian Ozoemena 201157039
Dependencies: mbed
main.cpp
- Committer:
- ikenna1
- Date:
- 2019-05-09
- Revision:
- 52:29772e31a620
- Parent:
- 44:a6a361bea806
- Child:
- 53:3fdc4486f672
File content as of revision 52:29772e31a620:
/* 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 */ #include "main.h" /** @file main.cpp * @brief This file is designated to start the program by calling all the necessary functions in a sequential manner. */ //_______________functions______________________________________________________ int main() { #ifdef WITH_TESTING int number_of_failures = run_all_tests(); if(number_of_failures > 0) return number_of_failures; #endif init(); printf("Init function completed...\n"); while(1) { welcome(); printf("welcome()\n"); rosen.reset(); printf("reset()\n"); //printf("ycursor = %d",rosen.get_ycursor()); if(rosen.get_ycursor() == 16) { // printf("get_ycursor() == 16()\n"); while ( pad.check_event(Gamepad::BACK_PRESSED) == false && rosen.dead() == false) { rosen.read_input(pad); rosen.update(pad); render(); wait(1.0f/fps); rosen.timer(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("menu...\n"); } } } } void init() { // need to initialise LCD and Gamepad lcd.init(); pad.init(); rosen.init(9,6,3,42,41); printf("Initializing...\n"); } void render() { // clear screen, re-draw and refresh lcd.clear(); rosen.draw(lcd, pad); rosen.get_pos(); lcd.refresh(); // printf("Rendering...\n"); } void ship_select() { lcd.clear(); rosen.ship_select(lcd); rosen.get_pos(); lcd.refresh(); printf("Ship Select...\n"); } // simple splash screen displayed on start-up void welcome() { while( pad.check_event(Gamepad::START_PRESSED) == false) { lcd.clear(); rosen.title(lcd); rosen.read_input(pad); lcd.refresh(); } printf("Welcome Function completed...\n"); }