📄 playfield.h
字号:
/* * Copyright (C) 2002 Robert Ernst <robert.ernst@linux-solutions.at> * * This file may be distributed and/or modified under the terms of the * GNU General Public License version 2 as published by the Free Software * Foundation and appearing in the file LICENSE.GPL included in the * packaging of this file. * * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * See COPYING for GPL licensing information. * */#ifndef __PLAYFIELD_HEADER__#define __PLAYFIELD_HEADER__#include <qwidget.h>#include "PlayTile.h"#include "SpriteCollection.h"#include "Engine.h"#include "Game.h"#include "Move.h"class PlayField : public QWidget{ Q_OBJECTpublic: PlayField(QWidget *parent, const char *name = 0, WFlags f = 0); ~PlayField();public: static const int rows = 8; static const int cols = 8; static const int tilesize = 30; static const int empty = 0; static const int blue = 1; static const int red = 24; enum State { PLAYER_MOVE, PLAYER_TURN, COMPUTER_MOVE, COMPUTER_TURN, HINT, };private: SpriteCollection *m_sprites; PlayTile *m_tile[rows * cols]; bool m_game_running; enum State m_state; int m_strength; bool m_animations; bool m_computerBegins; Game game; Engine engine;public slots: void start(void); void back(void); void hint(void); void tileClicked(int id); void updateStrength(int strength); void updateAnimations(int animations); void updateComputerBegins(int computerBegins);private: void computerMove(void); void drawTile(int col, int row, int state); void turnTilesRow(int row, int col, int dy, int dx); void turnTiles(Move &move); void updateBoard(void); void gameOver(void); int PlayerColor(void); int ComputerColor(void);protected: void paintEvent(QPaintEvent *event);};#endif // __PLAYFIELD_HEADER__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -