Map
Map.h@0:1d3957b7699a, 2017-04-25 (annotated)
- Committer:
- JackCripps
- Date:
- Tue Apr 25 12:22:48 2017 +0000
- Revision:
- 0:1d3957b7699a
- Child:
- 1:afa730298a2b
Initial commit, sorted rendering tile map to screen
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JackCripps | 0:1d3957b7699a | 1 | #ifndef MAP_H |
JackCripps | 0:1d3957b7699a | 2 | #define MAP_H |
JackCripps | 0:1d3957b7699a | 3 | |
JackCripps | 0:1d3957b7699a | 4 | #include "Bitmap.h" |
JackCripps | 0:1d3957b7699a | 5 | #include "N5110.h" |
JackCripps | 0:1d3957b7699a | 6 | |
JackCripps | 0:1d3957b7699a | 7 | static const int tileSize = 4; |
JackCripps | 0:1d3957b7699a | 8 | |
JackCripps | 0:1d3957b7699a | 9 | static const int tileImage[] = { |
JackCripps | 0:1d3957b7699a | 10 | 1,1,1,1, |
JackCripps | 0:1d3957b7699a | 11 | 1,0,0,1, |
JackCripps | 0:1d3957b7699a | 12 | 1,0,0,1, |
JackCripps | 0:1d3957b7699a | 13 | 1,1,1,1 |
JackCripps | 0:1d3957b7699a | 14 | }; |
JackCripps | 0:1d3957b7699a | 15 | |
JackCripps | 0:1d3957b7699a | 16 | static const int tileMap[] = { |
JackCripps | 0:1d3957b7699a | 17 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
JackCripps | 0:1d3957b7699a | 18 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
JackCripps | 0:1d3957b7699a | 19 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
JackCripps | 0:1d3957b7699a | 20 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
JackCripps | 0:1d3957b7699a | 21 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
JackCripps | 0:1d3957b7699a | 22 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
JackCripps | 0:1d3957b7699a | 23 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
JackCripps | 0:1d3957b7699a | 24 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1, |
JackCripps | 0:1d3957b7699a | 25 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
JackCripps | 0:1d3957b7699a | 26 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
JackCripps | 0:1d3957b7699a | 27 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
JackCripps | 0:1d3957b7699a | 28 | 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
JackCripps | 0:1d3957b7699a | 29 | }; |
JackCripps | 0:1d3957b7699a | 30 | |
JackCripps | 0:1d3957b7699a | 31 | |
JackCripps | 0:1d3957b7699a | 32 | // https://developer.mozilla.org/en-US/docs/Games/Techniques/Tilemaps/Square_tilemaps_implementation%3A_Static_maps |
JackCripps | 0:1d3957b7699a | 33 | class Map |
JackCripps | 0:1d3957b7699a | 34 | { |
JackCripps | 0:1d3957b7699a | 35 | public: |
JackCripps | 0:1d3957b7699a | 36 | Map(); |
JackCripps | 0:1d3957b7699a | 37 | ~Map(); |
JackCripps | 0:1d3957b7699a | 38 | void draw(N5110& lcd); |
JackCripps | 0:1d3957b7699a | 39 | int getTile(int col, int row); |
JackCripps | 0:1d3957b7699a | 40 | |
JackCripps | 0:1d3957b7699a | 41 | protected: |
JackCripps | 0:1d3957b7699a | 42 | |
JackCripps | 0:1d3957b7699a | 43 | |
JackCripps | 0:1d3957b7699a | 44 | private: |
JackCripps | 0:1d3957b7699a | 45 | Bitmap _tileImageBitmap; |
JackCripps | 0:1d3957b7699a | 46 | int _cols; |
JackCripps | 0:1d3957b7699a | 47 | int _rows; |
JackCripps | 0:1d3957b7699a | 48 | |
JackCripps | 0:1d3957b7699a | 49 | }; |
JackCripps | 0:1d3957b7699a | 50 | |
JackCripps | 0:1d3957b7699a | 51 | #endif |