1
Dependencies: mbed Gamepad N5110
main.cpp
- Committer:
- 1012754868
- Date:
- 2019-04-28
- Revision:
- 2:1234b0a1a51d
- Parent:
- 1:db2a69ca4929
- Child:
- 3:7b28047013d2
File content as of revision 2:1234b0a1a51d:
//屏幕开始有蛇的图标 //主页过了之后选择菜单菜单包含速度历史记录 //音乐 /* 做选项的步骤 把选项打印出来 移动光标 移动到某一个点击确定跳转到一个界面,点击返回返回到设置 */ #include "mbed.h" #include "N5110.h" #include "Gamepad.h" #include "Snake.h" /************************Structs************************/ struct UserInput { Direction d; }; /************************Objects************************/ N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);//set LCD pins Gamepad pad; Snake snake; Direction d; int SNAKY[15][48] = { {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,1,1,1,0,0,0,1,0,1,0,0,1,1,0,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,1,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {1,0,1,1,0,1,0,1,0,0,0,0,1,0,0,1,1,1,0,0,0,1,1,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} }; 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 pad.init(); start_game(); game_setting(); snake.init(25,25,5,3); //pc.printf("initalized"); while (_Flag) { snake.drawsnake(lcd,pad); snake.snakemov(pad); if(snake.live <= 0) { _Flag = 0; } } } } /************************Functions************************/ int game_music_2(){ pad.tone(1047.0,0.125); //gap wait(0.125); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(1175.0,0.125); //1_ wait(0.125); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(1319.0,0.25); //2_ wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(1047.0,0.125); //3_ wait(0.125); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(880.0,0.125); //1_ wait(0.125); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(880.0,0.25); //5 3/4 wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(1175.0,0.25); //3_ wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(988.0,0.25); //2 wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(784.0,0.125); //5 wait(0.125); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(659.0,0.125); //2 wait(0.125); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(659.0,0.25); //1. wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(988.0,0.25); //l6. wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(880.0,0.25); //3 3/4 wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(784.0,0.125); //1. wait(0.125); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(523.0,0.125); //l7 wait(0.125); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(523.0,0.25); //gap wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(784.0,0.25); //l7 wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(659.0,0.25); //l6 wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(0.0,0.25); //l7 wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(0.0,0.25); //1. wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(587.0,0.125); //2. wait(0.125); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(659.0,0.125); //l5 wait(0.125); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(698.0,0.25); //1 wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(0.0,0.25); //2. wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(1047.0,0.25); //3. wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(988.0,0.0833); //4 wait(0.0833); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(988.0,0.0833); //4. wait(0.0833); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(1047.0,0.0833); //3. wait(0.0833); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(784.0,0.25); //2. wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(0.0,0.25); //1. wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(698.0,0.25); //2 wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(659.0,0.1875); //gap wait(0.1875); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(698.0,0.0625); //1. wait(0.0625); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(740.0,0.25); //2. wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(0.0,0.25); //3. wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(1047.0,0.25); //1. wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(988.0,0.0833); //5 3/4 wait(0.0833); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(988.0,0.0833); //3. wait(0.0833); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(880.0,0.0833); //2 wait(0.0833); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(831.0,0.25); //5 wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(0.0,0.25); //2 wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(0.0,0.25); //1. wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(1047.0,0.125); //l6. wait(0.125); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(1175.0,0.125); //l6 wait(0.125); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(1319.0,0.25); //l7. wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(1047.0,0.125); //1. wait(0.125); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(880.0,0.125); //l5 //////////////////////////////////////////////////// wait(0.125); pad.tone(880.0,0.25); //6 wait(0.25); pad.tone(1175.0,0.25); //H2 wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(988.0,0.25); //7 wait(0.25); pad.tone(784.0,0.125); //5_ wait(0.125); pad.tone(659.0,0.125); //3_ wait(0.125); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(659.0,0.25); //3 wait(0.25); pad.tone(988.0,0.25); //7 wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(880.0,0.25); //6 wait(0.25); pad.tone(784.0,0.125); //5_ wait(0.125); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(523.0,0.125); //1_ wait(0.125); pad.tone(523.0,0.25); //1 wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(784.0,0.25); //5 wait(0.25); pad.tone(659.0,0.25); //3 wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(0.0,0.25); //gap wait(0.25); pad.tone(0.0,0.25); //gap wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(587.0,0.125); //2_ wait(0.125); pad.tone(659.0,0.125); //3_ wait(0.125); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(698.0,0.25); //4 wait(0.25); pad.tone(0.0,0.25); //gap wait(0.25); pad.tone(784.0,0.25); //5 wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(698.0,0.08333); //4_3 wait(0.08333); pad.tone(698.0,0.08333); //4_3 wait(0.08333); pad.tone(784.0,0.08333); //5_3 wait(0.08333); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(659.0,0.25); //3 wait(0.25); pad.tone(784.0,0.25); //5 wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(1046.0,0.25); //H1 wait(0.25); pad.tone(1318.0,0.25); //H3 wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(1175.0,0.1875); //H2 3/4 wait(0.1875); pad.tone(1175.0,0.125); //H2_ wait(0.125); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(1175.0,0.125); //H2_ wait(0.125); pad.tone(1046.0,0.25); //H1 wait(0.25); pad.tone(1046.0,0.125); //H1_ wait(0.125); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(1046.0,0.25); //H1 wait(0.25); pad.tone(0.0,0.25); //GAP wait(0.25); if(pad.check_event(Gamepad::A_PRESSED) == true){ return 0; } pad.tone(0.0,0.25); //GAP wait(0.25); pad.tone(0.0,0.25); //GAP wait(0.25); return 0; } void start_game(){ lcd.printString(" LI Saiwen",0,3); lcd.printString("Press twice A",0,5); lcd.refresh(); lcd.drawSprite(60,5,15,48,(int *)SNAKY); lcd.refresh(); wait(0.2); lcd.drawSprite(60,5,15,48,(int *)_SNAKY); lcd.refresh(); lcd.drawSprite(55,5,15,48,(int *)SNAKY); lcd.refresh(); wait(0.2); lcd.drawSprite(55,5,15,48,(int *)_SNAKY); lcd.refresh(); lcd.drawSprite(50,5,15,48,(int *)SNAKY); lcd.refresh(); wait(0.2); lcd.drawSprite(50,5,15,48,(int *)_SNAKY); lcd.refresh(); lcd.drawSprite(45,5,15,48,(int *)SNAKY); lcd.refresh(); wait(0.2); lcd.drawSprite(45,5,15,48,(int *)_SNAKY); lcd.refresh(); lcd.drawSprite(40,5,15,48,(int *)SNAKY); lcd.refresh(); wait(0.2); lcd.drawSprite(40,5,15,48,(int *)_SNAKY); lcd.refresh(); lcd.drawSprite(35,5,15,48,(int *)SNAKY); lcd.refresh(); wait(0.2); lcd.drawSprite(35,5,15,48,(int *)_SNAKY); lcd.refresh(); lcd.drawSprite(30,5,15,48,(int *)SNAKY); lcd.refresh(); wait(0.2); lcd.drawSprite(30,5,15,48,(int *)_SNAKY); lcd.refresh(); lcd.drawSprite(25,5,15,48,(int *)SNAKY); lcd.refresh(); wait(0.2); lcd.drawSprite(25,5,15,48,(int *)_SNAKY); lcd.drawSprite(20,5,15,48,(int *)SNAKY); lcd.refresh(); while ( pad.check_event(Gamepad::A_PRESSED) == false) { game_music_2(); pad.leds_on(); wait(0.1); pad.leds_off(); wait(0.1); } lcd.clear(); } void game_setting() { lcd.printString(" Menu",0,0); lcd.printString(" A to set",0,1); lcd.printString("set speed <",0,2); lcd.printString("history ",0,3); lcd.printString(" press start",0,5); lcd.refresh(); int q = 1; while ( pad.check_event(Gamepad::START_PRESSED) == false) { d = pad.get_direction(); if(d == N || q == 1){ lcd.clear(); lcd.printString(" Menu",0,0); lcd.printString(" A to set",0,1); lcd.printString("set speed <",0,2); lcd.printString("history ",0,3); lcd.printString(" press start",0,5); lcd.refresh(); if(pad.check_event(Gamepad::A_PRESSED) == true) { bool IsCheck = false; int c = 1; lcd.clear(); lcd.printString(" Speed set",0,0); lcd.printString(" B to set",0,1); lcd.printString(" Normal <",0,2); lcd.printString(" Difficult",0,3); lcd.printString(" Hell",0,4); lcd.printString(" Press back ",0,5); lcd.refresh(); while(IsCheck == false){ d = pad.get_direction(); if(d == N && c == 1){ lcd.clear(); lcd.printString(" Speed set",0,0); lcd.printString(" B to set",0,1); lcd.printString(" Normal <",0,2); lcd.printString(" Difficult",0,3); lcd.printString(" Hell",0,4); lcd.printString(" Press back ",0,5); c = 1; lcd.refresh(); } else if(d == S && c == 1 ){ lcd.clear(); lcd.printString(" Speed set",0,0); lcd.printString(" B to set",0,1); lcd.printString(" Normal",0,2); lcd.printString(" Difficult <",0,3); lcd.printString(" Hell",0,4); lcd.printString(" Press back ",0,5); c = 2; lcd.refresh(); } else if(d == N && c == 2){ lcd.clear(); lcd.printString(" Speed set",0,0); lcd.printString(" B to set",0,1); lcd.printString(" Normal",0,2); lcd.printString(" Difficult <",0,3); lcd.printString(" Hell",0,4); lcd.printString(" Press back ",0,5); c = 1; lcd.refresh(); } else if(d == S && c == 2){ lcd.clear(); lcd.printString(" Speed set",0,0); lcd.printString(" B to set",0,1); lcd.printString(" Normal",0,2); lcd.printString(" Difficult",0,3); lcd.printString(" Hell <",0,4); lcd.printString(" Press back ",0,5); c = 3; lcd.refresh(); } else if(d == S && c == 3){ lcd.clear(); lcd.printString(" Speed set",0,0); lcd.printString(" B to set",0,1); lcd.printString(" Normal",0,2); lcd.printString(" Difficult",0,3); lcd.printString(" Hell <",0,4); lcd.printString(" Press back ",0,5); c = 3; lcd.refresh(); } else if(d == N && c == 3){ lcd.clear(); lcd.printString(" Speed set",0,0); lcd.printString(" B to set",0,1); lcd.printString(" Normal",0,2); lcd.printString(" Difficult <",0,3); lcd.printString(" Hell",0,4); lcd.printString(" Press back ",0,5); c = 2; lcd.refresh(); } wait(0.3); if(c == 1 && pad.check_event(Gamepad::B_PRESSED) == true) { snake._speed = 0; lcd.clear(); lcd.printString(" set success!",0,2); lcd.printString(" Press Back!",0,4); lcd.refresh(); } else if(c == 2 && pad.check_event(Gamepad::B_PRESSED) == true) { snake._speed = 10; lcd.clear(); lcd.printString(" set success!",0,2); lcd.printString(" Press Back!",0,4); lcd.refresh(); } else if(c == 3 && pad.check_event(Gamepad::B_PRESSED) == true) { snake._speed = 50; lcd.clear(); lcd.printString(" set success",0,2); lcd.printString(" Press Back!",0,4); lcd.refresh(); } if(pad.check_event(Gamepad::BACK_PRESSED) == true){ IsCheck = true; } } if(pad.check_event(Gamepad::BACK_PRESSED) == true){ break; } } } if(d == S && q == 1){ lcd.clear(); lcd.printString(" Menu",0,0); lcd.printString(" A to set",0,1); lcd.printString("set speed",0,2); lcd.printString("history <",0,3); lcd.printString(" press start",0,5); lcd.refresh(); q = 2; } if(d == S && q == 2){ lcd.clear(); lcd.printString(" Menu",0,0); lcd.printString(" A to set",0,1); lcd.printString("set speed",0,2); lcd.printString("history <",0,3); lcd.printString(" press start",0,5); lcd.refresh(); q = 2; } if(d == N && q == 2) { lcd.clear(); lcd.printString(" Menu",0,0); lcd.printString(" A to set",0,1); lcd.printString("set speed <",0,2); lcd.printString("history ",0,3); lcd.printString(" press start",0,5); lcd.refresh(); q = 1; } if(q == 2 && pad.check_event(Gamepad::A_PRESSED) == true) { lcd.clear(); sprintf(_Buffer,"%2d",snake.Highest_score); lcd.printString(_Buffer,34,3); lcd.printString("Highest score",0,1); lcd.printString(" Press Back",0,5); lcd.refresh(); while(pad.check_event(Gamepad::BACK_PRESSED) == false){ } lcd.clear(); lcd.printString("MOVE joystick",0,1); lcd.refresh(); } pad.leds_on(); wait(0.1); pad.leds_off(); wait(0.1); } lcd.clear(); lcd.printString(" start!!!",0,1); lcd.printString("Enjoy yourself",0,3); lcd.refresh(); wait(2); }