![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
All there but errors need fixing
TetrisGame/TetrisGame.h@3:522c6f850e91, 2020-05-24 (annotated)
- Committer:
- el18rs
- Date:
- Sun May 24 11:18:33 2020 +0000
- Revision:
- 3:522c6f850e91
- Child:
- 4:7ddd287a5d28
Game engine added
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el18rs | 3:522c6f850e91 | 1 | #ifndef TETRISGAME_H |
el18rs | 3:522c6f850e91 | 2 | #define TETRISGAME_H |
el18rs | 3:522c6f850e91 | 3 | |
el18rs | 3:522c6f850e91 | 4 | #include "mbed.h" |
el18rs | 3:522c6f850e91 | 5 | #include "N5110.h" |
el18rs | 3:522c6f850e91 | 6 | #include "Gamepad.h" |
el18rs | 3:522c6f850e91 | 7 | #include "Tetromino.h" |
el18rs | 3:522c6f850e91 | 8 | |
el18rs | 3:522c6f850e91 | 9 | #define GAP 0 |
el18rs | 3:522c6f850e91 | 10 | |
el18rs | 3:522c6f850e91 | 11 | class TetrisGame |
el18rs | 3:522c6f850e91 | 12 | { |
el18rs | 3:522c6f850e91 | 13 | |
el18rs | 3:522c6f850e91 | 14 | public: |
el18rs | 3:522c6f850e91 | 15 | TetrisGame(); |
el18rs | 3:522c6f850e91 | 16 | ~TetrisGame(); |
el18rs | 3:522c6f850e91 | 17 | |
el18rs | 3:522c6f850e91 | 18 | void init(int tetromino_width, int tetromino_height, int tetromino_size, int speed); |
el18rs | 3:522c6f850e91 | 19 | void read_input(Gamepad &pad); |
el18rs | 3:522c6f850e91 | 20 | void update(Gamepad &pad); |
el18rs | 3:522c6f850e91 | 21 | void draw(N5110 &lcd); |
el18rs | 3:522c6f850e91 | 22 | |
el18rs | 3:522c6f850e91 | 23 | private: |
el18rs | 3:522c6f850e91 | 24 | |
el18rs | 3:522c6f850e91 | 25 | void check_wall_collision(Gamepad &pad); |
el18rs | 3:522c6f850e91 | 26 | void check_tetromino_collision(Gamepad &pad); |
el18rs | 3:522c6f850e91 | 27 | void check_goal(Gamepad &pad); |
el18rs | 3:522c6f850e91 | 28 | |
el18rs | 3:522c6f850e91 | 29 | Tetromino _p1; |
el18rs | 3:522c6f850e91 | 30 | |
el18rs | 3:522c6f850e91 | 31 | int _tetromino_width; |
el18rs | 3:522c6f850e91 | 32 | int _tetromino_height; |
el18rs | 3:522c6f850e91 | 33 | int _tetromino_size; |
el18rs | 3:522c6f850e91 | 34 | int _speed; |
el18rs | 3:522c6f850e91 | 35 | |
el18rs | 3:522c6f850e91 | 36 | int _p1x; |
el18rs | 3:522c6f850e91 | 37 | |
el18rs | 3:522c6f850e91 | 38 | Tetromino _tetromino; |
el18rs | 3:522c6f850e91 | 39 | |
el18rs | 3:522c6f850e91 | 40 | Direction _d; |
el18rs | 3:522c6f850e91 | 41 | float _mag; |
el18rs | 3:522c6f850e91 | 42 | |
el18rs | 3:522c6f850e91 | 43 | }; |
el18rs | 3:522c6f850e91 | 44 | |
el18rs | 3:522c6f850e91 | 45 | #endif |