Я пытался сделать хоть что-нибудь#11
Conversation
hBuzzy
left a comment
There was a problem hiding this comment.
Исправить замечания.
P.S.
Где-то я уже явно видел части кода. Внесите больше своего все же.
| #include "tetrisform.h" | ||
| #include "ui_tetrisform.h" | ||
|
|
||
| tetrisForm::tetrisForm(QWidget *parent) : |
| QApplication app(argc, argv); | ||
| TetrixWindow window; | ||
| window.show(); | ||
| QMediaPlayer *player = new QMediaPlayer; |
There was a problem hiding this comment.
В отрыве можно подумать, что это какой-то игрок, уточните, что это все же mediaPlayer
| TetrisBoard *board; | ||
| QLabel *nextPieceLabel; | ||
| QLCDNumber *scoreLcd; | ||
| QLCDNumber *levelLcd; | ||
| QLCDNumber *linesLcd; | ||
| QPushButton *startButton; | ||
| QPushButton *quitButton; | ||
| QPushButton *pauseButton; |
There was a problem hiding this comment.
У полей с модификаторами доступа private и protected добавляем постфикс "_".
QPushButton *pauseButton -> QPushButton *pauseButton_ и т.д.
| return QSize(BoardWidth * 15 + frameWidth() * 2, | ||
| BoardHeight * 15 + frameWidth() * 2); | ||
| } | ||
|
|
||
| QSize TetrixBoard::minimumSizeHint() const | ||
|
|
||
| { | ||
| return QSize(BoardWidth * 5 + frameWidth() * 2, | ||
| BoardHeight * 5 + frameWidth() * 2); | ||
| } |
There was a problem hiding this comment.
15, 5, 2 - магические числа, выделите в поля или переменные.
|
|
||
| void TetrixBoard::start() | ||
| { | ||
|
|
| #ifndef TETRIXPIECE_H | ||
| #define TETRIXPIECE_H | ||
|
|
||
| enum TetrixShape { NoShape, ZShape, SShape, LineShape, TShape, SquareShape, |
There was a problem hiding this comment.
Перечисления именуем как и константы с префиксом "k". NoShape -> kNoShape
| enum TetrixShape { NoShape, ZShape, SShape, LineShape, TShape, SquareShape, | ||
| LShape, MirroredLShape }; | ||
|
|
||
| class TetrixPiece |
There was a problem hiding this comment.
Добавление во всех классах слова Tetrix или Tetris быть не должно. Абсолютно бесполезное уточнение, если только сам класс не является тетрисом по факту или его непосредственной частью.
| TetrixShape shape() const { return pieceShape; } | ||
| int x(int index) const { return coords[index][0]; } | ||
| int y(int index) const { return coords[index][1]; } | ||
| int minX() const; | ||
| int maxX() const; | ||
| int minY() const; | ||
| int maxY() const; | ||
| TetrixPiece rotatedLeft() const; | ||
| TetrixPiece rotatedRight() const; |
There was a problem hiding this comment.
Реализация в cpp. Все методы должны именоваться или начинать именование с глаголов. Если метод что-то возвращает, обычно это глагол get.
|
|
||
|
|
| TetrixBoard *board; | ||
| QLabel *nextPieceLabel; | ||
| QLCDNumber *scoreLcd; | ||
| QLCDNumber *linesLcd; | ||
| QPushButton *startButton; | ||
| QPushButton *quitButton; |
No description provided.