![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Early commits of my project
Dependencies: mbed Gamepad N5110
Diff: main.cpp
- Revision:
- 6:6294bf4eafc8
- Parent:
- 5:f09602591ad3
diff -r f09602591ad3 -r 6294bf4eafc8 main.cpp --- a/main.cpp Wed Mar 13 15:23:03 2019 +0000 +++ b/main.cpp Wed Mar 13 16:38:21 2019 +0000 @@ -1,23 +1,21 @@ #include "main.h" #include "N5110.h" #include "Gamepad.h" +//#include "Sprites.h" Gamepad pad; +//Sprites sprites; N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); AnalogIn pot0(PTB2); -int x = 0; -int y = 0; - - int main() { init(); + start_screen(); while (1) { contrast(); - minerbitmap(); } } @@ -41,61 +39,16 @@ } -void minerbitmap() +void start_screen() { - const int miner[13][5] = { - 0,0,0,1,1, - 0,1,1,1,1, - 0,1,0,1,0, - 0,1,1,1,1, - 0,1,1,1,0, - 0,0,1,0,0, - 1,1,1,1,1, - 1,1,1,1,1, - 1,1,1,1,1, - 0,1,1,1,0, - 0,1,0,1,0, - 0,1,1,1,1, - }; - - lcd.clear(); - - - Direction d = pad.get_direction(); - printf("Direction = %i\n",d); - - lcd.drawSprite(WIDTH/2 + x,HEIGHT/2 + y,13,5,(int *)miner); - + lcd.printString("******MANIC MILNER!******",0,1); + lcd.printString(" Press start to play! ",0,4); + lcd.refresh(); - if (d==3) { - - x = x+1; - lcd.refresh(); - wait(0.05); - - } - - if (d == 7) { - - x = x-1; - lcd.refresh(); - wait(0.05); + while ( pad.check_event(Gamepad::START_PRESSED) == false) { + pad.leds_on(); + wait(0.1); + pad.leds_off(); + wait(0.1); } - //lcd.drawSprite(WIDTH/2 + x,HEIGHT/2 + y,13,5,(int *)miner); - //lcd.refresh(); - - if(pad.check_event(Gamepad::A_PRESSED)) { - - - printf("A pressed"); - y = y - 6; - lcd.clear(); - lcd.drawSprite(WIDTH/2 + x,HEIGHT/2 + y,13,5,(int *)miner); - lcd.refresh(); - wait(0.2); - y= y + 6; - } - - - -} +} \ No newline at end of file