// L-Shaped Tetris piece #ifndef LSHAPE_H #define LSHAPE_H #include "piece.h" #include "grid.h" /************* a L-shaped Tetris piece *************** * * *** * * * * Initializes a piece in an L-shape. * */ class LShape : public Piece { public: // constructor LShape(GP142Display *display, Grid *grid); // rotate piece clockwise quarter turn virtual void Rotate(); }; // constructor LShape::LShape(GP142Display *display, Grid *grid) { this->display = display; this->grid = grid; currentPosition = FULL; // initial orientation int x = GRID_WIDTH/2-1; // start in middle of grid int y = GRID_HEIGHT - 2; // start at top // L-shape squares[0].squareInit(display, grid, x-1,y-1); squares[1].squareInit(display, grid, x-1, y); squares[2].squareInit(display, grid, x, y); squares[3].squareInit(display, grid, x+1, y); color = Magenta; } // rotate the piece a quarter turn clockwise from its // current position. A piece should rotate only if // the squares it would move into are empty and it wouldn't // move outside the boundaries of the grid void LShape::Rotate() { // implementation needed } #endif