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@11:db27d3838514, 2019-05-06 (annotated)
- Committer:
- joshdavy
- Date:
- Mon May 06 14:43:01 2019 +0000
- Revision:
- 11:db27d3838514
- Parent:
- 9:96969b1c6bde
- Child:
- 12:5549a299d41e
test
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 | 11:db27d3838514 | 4 | |
joshdavy | 6:2ca1516ec1e2 | 5 | #include "mbed.h" |
joshdavy | 6:2ca1516ec1e2 | 6 | #include "N5110.h" |
joshdavy | 6:2ca1516ec1e2 | 7 | #include "Gamepad.h" |
joshdavy | 6:2ca1516ec1e2 | 8 | #include "Bitmap.h" |
joshdavy | 11:db27d3838514 | 9 | #include "LevelDefinitions.h" |
joshdavy | 7:68e06dda79f7 | 10 | |
joshdavy | 8:21b6d4dbce44 | 11 | struct MovingBlock { |
joshdavy | 9:96969b1c6bde | 12 | int index; |
joshdavy | 9:96969b1c6bde | 13 | int distance; |
joshdavy | 9:96969b1c6bde | 14 | |
joshdavy | 9:96969b1c6bde | 15 | int initial_pos; |
joshdavy | 9:96969b1c6bde | 16 | bool extending; |
joshdavy | 9:96969b1c6bde | 17 | |
joshdavy | 9:96969b1c6bde | 18 | |
joshdavy | 8:21b6d4dbce44 | 19 | }; |
joshdavy | 8:21b6d4dbce44 | 20 | |
joshdavy | 8:21b6d4dbce44 | 21 | const int goalMap[11][6] = { |
joshdavy | 8:21b6d4dbce44 | 22 | {0,1,0,0,0,0}, |
joshdavy | 8:21b6d4dbce44 | 23 | {0,1,0,0,0,0}, |
joshdavy | 8:21b6d4dbce44 | 24 | {0,1,1,0,0,0}, |
joshdavy | 8:21b6d4dbce44 | 25 | {0,1,1,1,1,0}, |
joshdavy | 8:21b6d4dbce44 | 26 | {0,1,1,1,1,1}, |
joshdavy | 8:21b6d4dbce44 | 27 | {0,1,1,1,1,0}, |
joshdavy | 8:21b6d4dbce44 | 28 | {0,1,1,0,0,0}, |
joshdavy | 8:21b6d4dbce44 | 29 | {0,1,0,0,0,0}, |
joshdavy | 8:21b6d4dbce44 | 30 | {0,1,0,0,0,0}, |
joshdavy | 8:21b6d4dbce44 | 31 | {0,1,0,0,0,0}, |
joshdavy | 8:21b6d4dbce44 | 32 | {1,1,1,1,0,0} |
joshdavy | 8:21b6d4dbce44 | 33 | }; |
joshdavy | 8:21b6d4dbce44 | 34 | |
joshdavy | 6:2ca1516ec1e2 | 35 | /*Level Class*/ |
joshdavy | 6:2ca1516ec1e2 | 36 | |
joshdavy | 6:2ca1516ec1e2 | 37 | |
joshdavy | 6:2ca1516ec1e2 | 38 | class Level { |
joshdavy | 6:2ca1516ec1e2 | 39 | |
joshdavy | 6:2ca1516ec1e2 | 40 | public: |
joshdavy | 6:2ca1516ec1e2 | 41 | Level(); |
joshdavy | 6:2ca1516ec1e2 | 42 | ~Level(); |
joshdavy | 9:96969b1c6bde | 43 | void init(Block blocks [], |
joshdavy | 8:21b6d4dbce44 | 44 | int number_of_blocks, |
joshdavy | 11:db27d3838514 | 45 | Vector2D goal, |
joshdavy | 11:db27d3838514 | 46 | MovingBlockDefinition moving_blocks[], |
joshdavy | 11:db27d3838514 | 47 | int number_of_moving_blocks); |
joshdavy | 9:96969b1c6bde | 48 | void update_moving_blocks(); |
joshdavy | 6:2ca1516ec1e2 | 49 | void render(N5110 &lcd); |
joshdavy | 9:96969b1c6bde | 50 | void declare_moving_block(int index,bool extending,int distance); |
joshdavy | 9:96969b1c6bde | 51 | Block * get_blocks(); |
joshdavy | 9:96969b1c6bde | 52 | int get_number_of_blocks(); |
joshdavy | 9:96969b1c6bde | 53 | Vector2D get_goal(); |
joshdavy | 6:2ca1516ec1e2 | 54 | |
joshdavy | 6:2ca1516ec1e2 | 55 | |
joshdavy | 6:2ca1516ec1e2 | 56 | |
joshdavy | 6:2ca1516ec1e2 | 57 | private: |
joshdavy | 8:21b6d4dbce44 | 58 | Block _blocks [20] ; |
joshdavy | 6:2ca1516ec1e2 | 59 | int _number_of_blocks; |
joshdavy | 8:21b6d4dbce44 | 60 | int _number_of_moving_blocks; |
joshdavy | 8:21b6d4dbce44 | 61 | Vector2D _goal; |
joshdavy | 8:21b6d4dbce44 | 62 | MovingBlock _moving_blocks [10]; |
joshdavy | 6:2ca1516ec1e2 | 63 | }; |
joshdavy | 6:2ca1516ec1e2 | 64 | |
joshdavy | 6:2ca1516ec1e2 | 65 | #endif |