1
Dependencies: mbed Gamepad N5110
Diff: main.cpp
- Revision:
- 7:cafa0b96e8d3
- Parent:
- 3:7b28047013d2
--- a/main.cpp Thu May 02 08:17:22 2019 +0000 +++ b/main.cpp Sun May 05 12:10:48 2019 +0000 @@ -13,15 +13,14 @@ #include "Snake.h" -/************************Structs************************/ + struct UserInput { Direction d; }; -/************************Objects************************/ -N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);//set LCD pins +N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); Gamepad pad; Snake snake; Direction d; @@ -62,29 +61,22 @@ }; char _Buffer[200]; -/************************Prototypes************************/ + void start_game(); void game_setting(); int game_music_2(); -/************************Variables************************/ -//int heroChar[4]=(1,1,0,1); -//int bomb[4]=(0,1,0,1); -//int boulderLocation[4][8]={}// set the coordinate for boulder, if 00, boulder does not exist - -/************************Main code************************/ int main() { snake.Highest_score = 0; while(1){ int _Flag = 1; - lcd.init();//initializing display + lcd.init(); pad.init(); start_game(); game_setting(); snake.init(25,25,5,3); - //pc.printf("initalized"); while (_Flag) { snake.drawsnake(lcd,pad); snake.snakemov(pad); @@ -94,7 +86,7 @@ } } } -/************************Functions************************/ + int game_music_2(){ pad.tone(1047.0,0.125); //gap wait(0.125);