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.
Level/Level.h@8:21b6d4dbce44, 2019-04-19 (annotated)
- Committer:
- joshdavy
- Date:
- Fri Apr 19 17:54:09 2019 +0000
- Revision:
- 8:21b6d4dbce44
- Parent:
- 7:68e06dda79f7
- Child:
- 9:96969b1c6bde
Main menu added.;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joshdavy | 6:2ca1516ec1e2 | 1 | #ifndef LEVEL_H |
joshdavy | 6:2ca1516ec1e2 | 2 | #define LEVEL_H |
joshdavy | 6:2ca1516ec1e2 | 3 | |
joshdavy | 6:2ca1516ec1e2 | 4 | #include "mbed.h" |
joshdavy | 6:2ca1516ec1e2 | 5 | #include "N5110.h" |
joshdavy | 6:2ca1516ec1e2 | 6 | #include "Gamepad.h" |
joshdavy | 6:2ca1516ec1e2 | 7 | #include "Bitmap.h" |
joshdavy | 6:2ca1516ec1e2 | 8 | |
joshdavy | 7:68e06dda79f7 | 9 | |
joshdavy | 7:68e06dda79f7 | 10 | struct Block { |
joshdavy | 7:68e06dda79f7 | 11 | Vector2D first; |
joshdavy | 7:68e06dda79f7 | 12 | Vector2D second; |
joshdavy | 7:68e06dda79f7 | 13 | }; |
joshdavy | 7:68e06dda79f7 | 14 | |
joshdavy | 8:21b6d4dbce44 | 15 | struct MovingBlock { |
joshdavy | 8:21b6d4dbce44 | 16 | int block_index; |
joshdavy | 8:21b6d4dbce44 | 17 | int x; |
joshdavy | 8:21b6d4dbce44 | 18 | int y; |
joshdavy | 8:21b6d4dbce44 | 19 | int s; |
joshdavy | 8:21b6d4dbce44 | 20 | int f; |
joshdavy | 8:21b6d4dbce44 | 21 | int yo; |
joshdavy | 8:21b6d4dbce44 | 22 | int lol; |
joshdavy | 8:21b6d4dbce44 | 23 | }; |
joshdavy | 8:21b6d4dbce44 | 24 | |
joshdavy | 8:21b6d4dbce44 | 25 | const int goalMap[11][6] = { |
joshdavy | 8:21b6d4dbce44 | 26 | {0,1,0,0,0,0}, |
joshdavy | 8:21b6d4dbce44 | 27 | {0,1,0,0,0,0}, |
joshdavy | 8:21b6d4dbce44 | 28 | {0,1,1,0,0,0}, |
joshdavy | 8:21b6d4dbce44 | 29 | {0,1,1,1,1,0}, |
joshdavy | 8:21b6d4dbce44 | 30 | {0,1,1,1,1,1}, |
joshdavy | 8:21b6d4dbce44 | 31 | {0,1,1,1,1,0}, |
joshdavy | 8:21b6d4dbce44 | 32 | {0,1,1,0,0,0}, |
joshdavy | 8:21b6d4dbce44 | 33 | {0,1,0,0,0,0}, |
joshdavy | 8:21b6d4dbce44 | 34 | {0,1,0,0,0,0}, |
joshdavy | 8:21b6d4dbce44 | 35 | {0,1,0,0,0,0}, |
joshdavy | 8:21b6d4dbce44 | 36 | {1,1,1,1,0,0} |
joshdavy | 8:21b6d4dbce44 | 37 | }; |
joshdavy | 8:21b6d4dbce44 | 38 | |
joshdavy | 6:2ca1516ec1e2 | 39 | /*Level Class*/ |
joshdavy | 6:2ca1516ec1e2 | 40 | |
joshdavy | 6:2ca1516ec1e2 | 41 | |
joshdavy | 6:2ca1516ec1e2 | 42 | class Level { |
joshdavy | 6:2ca1516ec1e2 | 43 | |
joshdavy | 6:2ca1516ec1e2 | 44 | public: |
joshdavy | 6:2ca1516ec1e2 | 45 | Level(); |
joshdavy | 6:2ca1516ec1e2 | 46 | ~Level(); |
joshdavy | 8:21b6d4dbce44 | 47 | void init(Block blocks [],MovingBlock moving_block [], |
joshdavy | 8:21b6d4dbce44 | 48 | int number_of_blocks, |
joshdavy | 8:21b6d4dbce44 | 49 | int number_of_moving_blocks, |
joshdavy | 8:21b6d4dbce44 | 50 | Vector2D goal); |
joshdavy | 8:21b6d4dbce44 | 51 | void update(); |
joshdavy | 6:2ca1516ec1e2 | 52 | void render(N5110 &lcd); |
joshdavy | 6:2ca1516ec1e2 | 53 | |
joshdavy | 6:2ca1516ec1e2 | 54 | |
joshdavy | 6:2ca1516ec1e2 | 55 | |
joshdavy | 6:2ca1516ec1e2 | 56 | private: |
joshdavy | 8:21b6d4dbce44 | 57 | Block _blocks [20] ; |
joshdavy | 6:2ca1516ec1e2 | 58 | int _number_of_blocks; |
joshdavy | 8:21b6d4dbce44 | 59 | int _number_of_moving_blocks; |
joshdavy | 8:21b6d4dbce44 | 60 | Vector2D _goal; |
joshdavy | 8:21b6d4dbce44 | 61 | MovingBlock _moving_blocks [10]; |
joshdavy | 6:2ca1516ec1e2 | 62 | }; |
joshdavy | 6:2ca1516ec1e2 | 63 | |
joshdavy | 6:2ca1516ec1e2 | 64 | #endif |