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:
- lewisgw
- Date:
- 2019-03-23
- Revision:
- 8:5327418f823a
- Parent:
- 7:bbc2b75c1418
- Child:
- 9:fff2009f826e
File content as of revision 8:5327418f823a:
/* ELEC2645 Embedded Systems Project School of Electronic & Electrical Engineering University of Leeds Name: Lewis Wooltorton Username: el17lw Student ID Number: 201122085 Date: March 2019 */ #include "N5110.h" #include "Gamepad.h" #include "Skateboarder.h" #include "Engine.h" #include "Map.h" #include <cstdlib> #include <ctime> #include <cmath> N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); Gamepad gamepad; Engine game_engine; //Map map; void init_game(); void run_game(int t); /* Line line_1; Line line_2; Line line_3; int length_1; int length_2; int length_3; */ int t = 0; int main(){ init_game(); /* map.init(); srand(time(NULL)); */ while(1){ lcd.clear(); /* run_game(); length_1 = (rand() %20)+10; length_2 = (rand() %20)+10; length_3 = (rand() %20)+10; map.generate_line_1(length_1); line_1 = map.get_line_1(); map.generate_line_2(length_2); line_2 = map.get_line_2(); map.generate_line_3(length_3); line_3 = map.get_line_3(); lcd.drawLine(line_2.x_start,line_2.y,line_2.x_end,line_2.y,FILL_BLACK); lcd.drawLine(line_1.x_start,line_1.y,line_1.x_end,line_1.y,FILL_BLACK); lcd.drawLine(line_3.x_start,line_3.y,line_3.x_end,line_3.y,FILL_BLACK); wait(0.1); */ run_game(t); //wait(0.1); lcd.refresh(); wait(0.01); t++; if(t == 100) { t = 0; } } } void init_game() { gamepad.init(); game_engine.init(); lcd.init(); lcd.setContrast(0.5); lcd.normalMode(); lcd.setBrightness(0.5); } void run_game(int t) { game_engine.check_reset(); game_engine.read_input(gamepad); if( t % 10 == 0 ){ game_engine.generate_map(); } game_engine.find_level(); game_engine.process_y(); game_engine.process_x(t); game_engine.process_sprite(); game_engine.update_lcd(lcd); }