Pacman#3
Conversation
| void updateGame(); | ||
| void movePacman(); | ||
| void checkCollision(); | ||
| void paintEvent(QPaintEvent* event); |
There was a problem hiding this comment.
Переопределенные методы лучше убрать в protected, как минимум.
| void drawGameArea(QPainter* painter); | ||
| void updateGame(); | ||
| void movePacman(); | ||
| void checkCollision(); |
There was a problem hiding this comment.
Check - почти всегда плохо в названии. Плюс сам метод - пустой.
| void GameWindow::initializeGame() { | ||
|
|
||
| } | ||
|
|
||
| void GameWindow::drawGameArea(QPainter* painter) { | ||
|
|
||
| } | ||
|
|
||
| void GameWindow::updateGame() { | ||
| movePacman(); | ||
| checkCollision(); | ||
| update(); | ||
| } | ||
|
|
||
| void GameWindow::movePacman() { | ||
| } | ||
|
|
||
| void GameWindow::checkCollision() { | ||
|
|
||
| } |
| int WIDTH_ = 1; | ||
| int HEIGHT_ = 1; |
There was a problem hiding this comment.
Protected поля именуем так же, как и приватные.
camelCase_
WIDTH_ -> width_ и т.д.
|
|
||
| CoinDragItem::CoinDragItem(qreal x, qreal y, qreal boxSize) : | ||
| AbstractDragItem::AbstractDragItem(x, y, boxSize, DragItemFabric::getNameByType(DragItemFabric::COIN), Qt::yellow) | ||
| { |
|
|
||
| class DragItemFabric { | ||
| public: | ||
| enum DragItemType { VWALL, HWALL, COIN }; |
There was a problem hiding this comment.
Перечисления в стиле констант kConstName
| ){ | ||
| if(type == WallType::HORISONTAL){ |
| if(type == WallType::HORISONTAL){ | ||
| qreal temp = WIDTH_; | ||
| WIDTH_ = HEIGHT_; | ||
| HEIGHT_ = temp; |
There was a problem hiding this comment.
temp - не общепринятое сокращение. Напишите полностью или замените на более конкретное название, если такое возможно.
|
|
||
| class WallDragItem : public AbstractDragItem { | ||
| public: | ||
| enum WallType { VERTICAL, HORISONTAL }; |
There was a problem hiding this comment.
Перечисления в стиле констант kConstName
| const int DEMO_BOX_SIZE_ = 20; | ||
| const int AREA_BOX_COUNT_ = 30; | ||
| const int ITEMS_FIELD_BOX_HEIGHT_COUNT_ = 5; | ||
| const int PRINT_ITEM_STEP = 5; |
There was a problem hiding this comment.
Константы именуем не в стиле макросов, а в стиле kConstName, т.е. префикс k + camelCase
No description provided.