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
TetrisGame/TetrisGame.h@9:58103274b2ab, 2020-06-01 (annotated)
- Committer:
- el18rs
- Date:
- Mon Jun 01 17:33:16 2020 +0000
- Revision:
- 9:58103274b2ab
- Parent:
- 8:cebb2aca8e19
- Child:
- 10:7310c9440547
el18rs 201259470;
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 | class TetrisGame |
el18rs | 3:522c6f850e91 | 10 | { |
el18rs | 3:522c6f850e91 | 11 | |
el18rs | 3:522c6f850e91 | 12 | public: |
el18rs | 3:522c6f850e91 | 13 | TetrisGame(); |
el18rs | 3:522c6f850e91 | 14 | ~TetrisGame(); |
el18rs | 3:522c6f850e91 | 15 | |
el18rs | 9:58103274b2ab | 16 | void init(int tetromino_height, int tetromino_width, int speed); |
el18rs | 3:522c6f850e91 | 17 | void read_input(Gamepad &pad); |
el18rs | 6:39cbec524483 | 18 | void update(Gamepad &pad, N5110 &lcd); |
el18rs | 3:522c6f850e91 | 19 | void draw(N5110 &lcd); |
el18rs | 4:7ddd287a5d28 | 20 | //void play_game(); |
el18rs | 3:522c6f850e91 | 21 | |
el18rs | 3:522c6f850e91 | 22 | private: |
el18rs | 3:522c6f850e91 | 23 | |
el18rs | 6:39cbec524483 | 24 | void check_wall_collision(Gamepad &pad, N5110 &lcd); |
el18rs | 6:39cbec524483 | 25 | void check_tetromino_collisions(Gamepad &pad, N5110 &lcd); |
el18rs | 4:7ddd287a5d28 | 26 | // void check_score(Gamepad &pad); |
el18rs | 4:7ddd287a5d28 | 27 | |
el18rs | 6:39cbec524483 | 28 | void cancel_line(N5110 &lcd); |
el18rs | 6:39cbec524483 | 29 | void exit_game(N5110 &lcd); |
el18rs | 3:522c6f850e91 | 30 | |
el18rs | 6:39cbec524483 | 31 | // Tetromino _p1; |
el18rs | 3:522c6f850e91 | 32 | |
el18rs | 6:39cbec524483 | 33 | |
el18rs | 9:58103274b2ab | 34 | int _px; |
el18rs | 9:58103274b2ab | 35 | int _py; |
el18rs | 9:58103274b2ab | 36 | int _tetromino_height; |
el18rs | 9:58103274b2ab | 37 | int _tetromino_width; |
el18rs | 3:522c6f850e91 | 38 | int _speed; |
el18rs | 3:522c6f850e91 | 39 | |
el18rs | 3:522c6f850e91 | 40 | Tetromino _tetromino; |
el18rs | 3:522c6f850e91 | 41 | |
el18rs | 3:522c6f850e91 | 42 | Direction _d; |
el18rs | 3:522c6f850e91 | 43 | float _mag; |
el18rs | 3:522c6f850e91 | 44 | }; |
el18rs | 3:522c6f850e91 | 45 | |
el18rs | 3:522c6f850e91 | 46 | #endif |