Before I found in the old computer before the university when the tetris, with QT to write, put it out to try to compile and run it recorded as a memorial. First of all, the whole game was written in c++, which was relatively simple. At that time, the idea was to make it first and have a look at it. Therefore, many parts were not perfect, so I could only look at them. Qt 5.0 +

The interface is a little simple, but basically playable.Github.com/absolve/tet…Now I will mainly introduce the basic content. Tetris is basically a way to control 7 kinds of squares and eliminate scores when a full line is filled. Then I used coordinates to record different squares at that time in the design, and each square was recorded according to the origin of coordinates and length 1

It is possible to draw squares of any length from each coordinate, and the rotation of the squares is changing the coordinates

Void paintEvent(QPaintEvent *); void paintEvent(QPaintEvent *); Void keyPressEvent(QKeyEvent *); To retrieve the keyboard keys, the entire interface is drawn in the QWidget, just turn on a timer to drop blocks. The game requires an array to store all the blocks in the game to determine whether the game is over or eliminated.

This array can then be used to save information for the entire game. The rest of the game can be seen in the code, and the game itself is relatively simple.