Adam Baker 201166301
Dependencies: mbed Gamepad N5110
main.cpp@1:a3cce487dffe, 2019-03-18 (annotated)
- Committer:
- adambakerwa
- Date:
- Mon Mar 18 11:05:51 2019 +0000
- Revision:
- 1:a3cce487dffe
- Parent:
- 0:0dcf08db8d61
- Child:
- 2:1ad390d81d81
fallJump success;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
adambakerwa | 1:a3cce487dffe | 1 | #include "mbed.h" |
adambakerwa | 1:a3cce487dffe | 2 | #include "Gamepad.h" |
adambakerwa | 1:a3cce487dffe | 3 | #include "N5110.h" |
adambakerwa | 1:a3cce487dffe | 4 | #include "Runner.h" |
adambakerwa | 1:a3cce487dffe | 5 | |
adambakerwa | 1:a3cce487dffe | 6 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); |
adambakerwa | 1:a3cce487dffe | 7 | Gamepad pad; |
adambakerwa | 1:a3cce487dffe | 8 | Runner runner; |
adambakerwa | 1:a3cce487dffe | 9 | |
adambakerwa | 1:a3cce487dffe | 10 | int main() { |
adambakerwa | 1:a3cce487dffe | 11 | |
adambakerwa | 1:a3cce487dffe | 12 | int fps = 8; |
adambakerwa | 1:a3cce487dffe | 13 | |
adambakerwa | 1:a3cce487dffe | 14 | pad.init(); |
adambakerwa | 1:a3cce487dffe | 15 | lcd.init(); |
adambakerwa | 1:a3cce487dffe | 16 | |
adambakerwa | 1:a3cce487dffe | 17 | Move move; |
adambakerwa | 1:a3cce487dffe | 18 | |
adambakerwa | 1:a3cce487dffe | 19 | move = runner.init(move); |
adambakerwa | 1:a3cce487dffe | 20 | |
adambakerwa | 1:a3cce487dffe | 21 | printf("%i %i %i %i", move.j, move.x, move.y, move.f); |
adambakerwa | 1:a3cce487dffe | 22 | |
adambakerwa | 1:a3cce487dffe | 23 | while(1) { |
adambakerwa | 1:a3cce487dffe | 24 | |
adambakerwa | 1:a3cce487dffe | 25 | lcd.clear(); |
adambakerwa | 1:a3cce487dffe | 26 | |
adambakerwa | 1:a3cce487dffe | 27 | lcd.drawLine(0,40,84,40,1); |
adambakerwa | 1:a3cce487dffe | 28 | |
adambakerwa | 1:a3cce487dffe | 29 | lcd.drawCircle(move.x,move.y,3,FILL_BLACK); |
adambakerwa | 1:a3cce487dffe | 30 | |
adambakerwa | 1:a3cce487dffe | 31 | printf("%i %i %i %i", move.j, move.x, move.y, move.f); |
adambakerwa | 1:a3cce487dffe | 32 | |
adambakerwa | 1:a3cce487dffe | 33 | move = runner.fallJump(move, lcd); |
adambakerwa | 1:a3cce487dffe | 34 | |
adambakerwa | 1:a3cce487dffe | 35 | lcd.refresh(); |
adambakerwa | 1:a3cce487dffe | 36 | |
adambakerwa | 1:a3cce487dffe | 37 | wait(1.0f/fps); |
adambakerwa | 1:a3cce487dffe | 38 | |
adambakerwa | 1:a3cce487dffe | 39 | } |
adambakerwa | 1:a3cce487dffe | 40 | } |
adambakerwa | 1:a3cce487dffe | 41 | |
adambakerwa | 1:a3cce487dffe | 42 |