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.
Dependencies: mbed
Fork of el17ajf by
Grid/Grid.h@18:24ce897024d0, 2019-04-03 (annotated)
- Committer:
- el17ajf
- Date:
- Wed Apr 03 14:31:49 2019 +0000
- Revision:
- 18:24ce897024d0
- Parent:
- 15:afeefa3ceb61
- Child:
- 19:370d83a8dc33
Added adaptable grid sizes
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| el17ajf | 18:24ce897024d0 | 1 | #ifndef GRID_H |
| el17ajf | 18:24ce897024d0 | 2 | #define GRID_H |
| el17ajf | 18:24ce897024d0 | 3 | |
| el17ajf | 4:aa433f9865a6 | 4 | #include "Tetromino.h" |
| el17ajf | 3:a1b058ff66c2 | 5 | |
| el17ajf | 3:a1b058ff66c2 | 6 | class Grid { |
| el17ajf | 3:a1b058ff66c2 | 7 | public: |
| el17ajf | 3:a1b058ff66c2 | 8 | bool isSpaceForTetromino(Tetromino tetromino); |
| el17ajf | 3:a1b058ff66c2 | 9 | void placeTetromino(Tetromino tetromino); |
| el17ajf | 4:aa433f9865a6 | 10 | void clear(); |
| el17ajf | 4:aa433f9865a6 | 11 | void draw(); |
| el17ajf | 8:5066ce13a430 | 12 | Grid(); |
| el17ajf | 15:afeefa3ceb61 | 13 | const static int GRID_HEIGHT = 20; |
| el17ajf | 15:afeefa3ceb61 | 14 | const static int GRID_WIDTH = 10; |
| el17ajf | 7:2e37bad816cb | 15 | |
| el17ajf | 3:a1b058ff66c2 | 16 | private: |
| el17ajf | 7:2e37bad816cb | 17 | void checkForLines(); |
| el17ajf | 4:aa433f9865a6 | 18 | void moveDownIfNeeded(); |
| el17ajf | 4:aa433f9865a6 | 19 | void shiftDownFrom(int row); |
| el17ajf | 11:fba7d54fd36b | 20 | bool grid[10][20]; |
| el17ajf | 4:aa433f9865a6 | 21 | bool isSpaceForBlock(Block block); |
| el17ajf | 18:24ce897024d0 | 22 | }; |
| el17ajf | 18:24ce897024d0 | 23 | #endif |
