All there but errors need fixing

Dependencies:   mbed

Overview:

Rookie Tetris is a jigsaw style game based on the classic Tetris.

A block will appear at the top of the screen, you must move it (your options for movement are left, right and down - you cannot move up the board). The block will stop when it if placed either on the floor of the board or on-top of another block.

Your goal is to fill a complete row of the board with the blocks; when you do so the row will delete and the pattern above it will drop down. The game is over when your pattern is tall enough to reach to the top of the board!

Controls:

Use the joystick to move your block! Your block cannot move out of the parameters of the board.

Pot 2 controls the contrast of the screen.

Committer:
el18rs
Date:
Wed Jun 03 22:27:46 2020 +0000
Revision:
26:00e1a6076038
Parent:
1:35dba0833c7d
Final Submission. I have read and agreed with Statement of Academic Integrity.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el18rs 1:35dba0833c7d 1 #ifndef BITMAP_H
el18rs 1:35dba0833c7d 2 #define BITMAP_H
el18rs 1:35dba0833c7d 3
el18rs 1:35dba0833c7d 4 #include <vector>
el18rs 1:35dba0833c7d 5
el18rs 1:35dba0833c7d 6 // Forward declarations
el18rs 1:35dba0833c7d 7 class N5110;
el18rs 1:35dba0833c7d 8
el18rs 1:35dba0833c7d 9 /**
el18rs 1:35dba0833c7d 10 * @brief A black & white bitmap that can be rendered on an N5110 screen
el18rs 1:35dba0833c7d 11 * @author Alex Valavanis <a.valavanis@leeds.ac.uk>
el18rs 1:35dba0833c7d 12 *
el18rs 1:35dba0833c7d 13 * @code
el18rs 1:35dba0833c7d 14 // First declare the pixel map data using '1' for black,
el18rs 1:35dba0833c7d 15 // or '0' for white pixels
el18rs 1:35dba0833c7d 16 static int sprite_data[] = {
el18rs 1:35dba0833c7d 17 0,0,1,0,0,
el18rs 1:35dba0833c7d 18 0,1,1,1,0,
el18rs 1:35dba0833c7d 19 0,0,1,0,0,
el18rs 1:35dba0833c7d 20 0,1,1,1,0,
el18rs 1:35dba0833c7d 21 1,1,1,1,1,
el18rs 1:35dba0833c7d 22 1,1,1,1,1,
el18rs 1:35dba0833c7d 23 1,1,0,1,1,
el18rs 1:35dba0833c7d 24 1,1,0,1,1
el18rs 1:35dba0833c7d 25 };
el18rs 1:35dba0833c7d 26
el18rs 1:35dba0833c7d 27 // Instantiate the Bitmap object using the data above
el18rs 1:35dba0833c7d 28 Bitmap sprite(sprite_data, 8, 5); // Specify rows and columns in sprite
el18rs 1:35dba0833c7d 29
el18rs 1:35dba0833c7d 30 // We can render the bitmap wherever we want on the screen
el18rs 1:35dba0833c7d 31 sprite.render(lcd, 20, 6); // x and y locations for rendering
el18rs 1:35dba0833c7d 32 sprite.render(lcd, 30, 10);
el18rs 1:35dba0833c7d 33
el18rs 1:35dba0833c7d 34 // We can also print its values to the terminal
el18rs 1:35dba0833c7d 35 sprite.print();
el18rs 1:35dba0833c7d 36 * @endcode
el18rs 1:35dba0833c7d 37 */
el18rs 1:35dba0833c7d 38 class Bitmap
el18rs 1:35dba0833c7d 39 {
el18rs 1:35dba0833c7d 40 private:
el18rs 1:35dba0833c7d 41 /**
el18rs 1:35dba0833c7d 42 * @brief The contents of the drawing, with pixels stored in row-major order
el18rs 1:35dba0833c7d 43 * @details '1' represents a black pixel; '0' represents white
el18rs 1:35dba0833c7d 44 */
el18rs 1:35dba0833c7d 45 std::vector<int> _contents;
el18rs 1:35dba0833c7d 46
el18rs 1:35dba0833c7d 47 unsigned int _height; ///< The height of the drawing in pixels
el18rs 1:35dba0833c7d 48 unsigned int _width; ///< The width of the drawing in pixels
el18rs 1:35dba0833c7d 49
el18rs 1:35dba0833c7d 50 public:
el18rs 1:35dba0833c7d 51 Bitmap(int const *contents,
el18rs 1:35dba0833c7d 52 unsigned int const height,
el18rs 1:35dba0833c7d 53 unsigned int const width);
el18rs 1:35dba0833c7d 54
el18rs 1:35dba0833c7d 55 int get_pixel(unsigned int const row,
el18rs 1:35dba0833c7d 56 unsigned int const column) const;
el18rs 1:35dba0833c7d 57
el18rs 1:35dba0833c7d 58 void print() const;
el18rs 1:35dba0833c7d 59
el18rs 1:35dba0833c7d 60 void render(N5110 &lcd,
el18rs 1:35dba0833c7d 61 unsigned int const x0,
el18rs 1:35dba0833c7d 62 unsigned int const y0) const;
el18rs 1:35dba0833c7d 63 };
el18rs 1:35dba0833c7d 64
el18rs 1:35dba0833c7d 65 #endif // BITMAP_H