Initial publish
Dependencies: mbed
Fork of el17dg by
main/main.cpp
- Committer:
- Noximilien
- Date:
- 2019-03-18
- Revision:
- 14:e8de27c4d0d4
- Parent:
- 5:2b9181bc5c89
- Child:
- 17:69a85c909566
File content as of revision 14:e8de27c4d0d4:
/* ELEC2645 Embedded Systems Project School of Electronic & Electrical Engineering University of Leeds Name: Dmitrijs Griskovs Username: el17dg Student ID Number: 201160286 Date: start - 25/02/2019 */ #include "main.h" #include "game.h" #include "menu.h" N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); Gamepad gamepad; AnalogIn pot(PTB2); AnalogIn x_dir(PTB11); AnalogIn y_dir(PTB10); Menu menu; Game game; //static const unsigned int MAX_LINE_LENGTH = 14; void intro(); void pointer(int x, int y); void pointer_position(int menu_number); void ship_movement(); //char line_buffer[MAX_LINE_LENGTH]; ScreenOption current_screen = ScreenOption_Menu; void intro(); int main(){ lcd.init(); gamepad.init(); intro(); while(1){ //Waiting for the option "start game" to be selected and for the button B to be pressed lcd.clear(); if (current_screen == ScreenOption_Game) { bool gameIsPaused = game.updateAndDraw(); if (gameIsPaused) { current_screen = ScreenOption_Menu; } } else if (current_screen == ScreenOption_Menu) { bool wantsToChangeScreen = menu.updateAndDraw(); if (wantsToChangeScreen) { current_screen = menu.getCurrentScreenSelection(); } } lcd.refresh(); wait_ms(1000/fps); } } void intro(){ // This just will be an intro for the game. lcd.clear(); lcd.printString(" StarBarians",1,1); lcd.refresh(); wait(0.5); lcd.printString(" And the quest ",1,2); lcd.printString(" of the Princess Spacecate",1,3); lcd.printString(" Spacecate",1,4); lcd.refresh(); wait(0.5); }