Tetris (7)

  1. Modify your previous TETRIS program and define a class CTetromino.
  2. A tetromino has the following data members:
    1. unsigned short type_id; // [0..6]
    2. unsigned short pos_x;
    3. unsigned short pos_y;
  3. A tetromino has the following member functions:
    1. The constructor CTetromino() will be invoked with three parameters to initialize data members type_id, pos_x, and pos_y.
      • The default values of these three parameters are all 0.
    2. Draw() - display the tetromino at position (pos_y, pos_x).
    Test your class with this main program. Save your class definition as "tetris.h". Save the main program as "tetris-7a.cpp". Compile the program with "g++ tetris-7a.cpp -lcurses". The program should produce output as follows.
    tetris-7a.png
  4. Add a member function Move(). It has a parameter to indicate the direction of movement. Test your class with this main program. The program should produce output as follows.
    tetris-7b.png