Skip to content

Tetris vakilova#8

Open
adeluneees wants to merge 4 commits into
hBuzzy:masterfrom
adeluneees:tetris_vakilova
Open

Tetris vakilova#8
adeluneees wants to merge 4 commits into
hBuzzy:masterfrom
adeluneees:tetris_vakilova

Conversation

@adeluneees

Copy link
Copy Markdown

No description provided.

@hBuzzy hBuzzy left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Доп принята.

В основной поправить замечания + добавить Q_Property по заданию.

Comment thread mainwindow.h Outdated
#include "tetrisgrid.h"

class MainWindow : public QMainWindow
{

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не переносим скобку.

Comment thread mainwindow.h Outdated
Comment on lines +18 to +22
TetrisGrid *tetrisGrid;
QPushButton *startButton;
QPushButton *exitButton;
QPushButton *helpButton;
QLabel *scoreLabel;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сначала приватные методы, потом приватные поля

У приватных полей добавляем постфикс "_"

Comment thread mainwindow.h Outdated
QLabel *scoreLabel;
void setupGame();
int score_;
bool gameOverHandled_ = false;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Переменные типа bool должны задавать вопрос, на который мы можем строго ответить либо "Да", либо "Нет". Достигается это при помощи глаголов Is, Have, has и т.д.

Comment thread mainwindow.h
void showHelp();

public slots:
void keyPressEvent(QKeyEvent *event);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keyPressEvent - это не слот, а обычный метод, при чем protected

Comment thread mainwindow.h Outdated
Comment on lines +36 to +37


Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не больше одной пусто строки.

Comment thread tetrisgrid.cpp Outdated
for (int j = 0; j < currentShape_[i].size(); ++j) {
if (currentShape_[i][j] == 1) {
int gridRow = shapeRow_ + i;
int gridCol = shapeCol_ + j;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

То же самое про col. Без сокращений.

Comment thread tetrisgrid.h Outdated
Comment on lines +44 to +45
int m_rows_;
int m_cols_;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправьте на наш стиль, как и в остальных местах, где остались m_

Comment thread tetrisgrid.h Outdated
Comment on lines +49 to +62
QVector<QVector<int>> nextShape_;
QVector<QVector<int>> m_gridNew_;
int shapeRow_;
int shapeCol_;
int score_;
int speed_ = 500;
void drawGrid(QPainter &painter, int cellSize);
void drawShape(QPainter &painter, int cellSize);
void generateNewShape();
void checkLines();
void addCurrentShapeToGridNew();
bool isCollision();
bool locking_;
bool shapeLocked_;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не перемешивайте методы и поля. Сначала все методы, потом только все поля.

Comment thread tetrisgrid.h Outdated
Comment on lines +61 to +62
bool locking_;
bool shapeLocked_;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Опять же, у bool должен быть вопрос с помощью is, have, has.

Comment thread tetrisgrid.cpp Outdated
void TetrisGrid::checkLines() {

for (int row = m_rows_ - 1; row >= 0; --row) {
bool lineFilled = true;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Опаять же замечание про bool.

@hBuzzy hBuzzy left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Принято.

Comment thread tetrisgrid.h
Comment on lines +55 to +56
int mRows_;
int mColumns_;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Префикс m не нежен.

Comment thread tetrisgrid.h
bool isCollision();
bool locking_;
bool shapeLocked_;
QVector<QVector<int>> mGrid_;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Префикс m не нужен.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants