📄 board.h
字号:
////////////////////////////////////////////////////////////////////////////////// File : Board.h// Class : Board// Description : This class handels everything with board. drawing, event,// Player move, computer move// Author : Juergen P. Messerer, juergen.messerer@freesurf.ch// Project : Fl-Reversi// Release Date : 12th March 2003// Revised on :// License : Gnu Public License (GPL)//// Copyright(c) Juergen P. Messerer 2003./////////////////////////////////////////////////////////////////////////////////#ifndef _BOARD_H#define _BOARD_H#include <FL/Fl.H>#include <FL/Fl_Widget.H>#include <FL/fl_draw.H>#include <FL/Fl_Pixmap.H>#include <iostream.h>#include "Engine.h"#include "Game.h"#include "Move.h"#include "BoardElement.h"class Board {public: Board(int x, int y, int w, int h ); enum State { PLAYER_MOVE, PLAYER_TURN, COMPUTER_MOVE, COMPUTER_TURN, HINT, END }; static const int rows = 8; static const int cols = 8; static const int empty = 0; static const int blue = 1; static const int red = 24; private: BoardElement *m_field[rows*cols]; bool m_game_running; enum State m_state; int m_strength; bool m_animations; bool m_computerBegins; Game game; Engine engine; Fl_Box *p_leftBox; Fl_Box *p_rightBox; Fl_Box *p_turnBox;private: void computerMove(void); void drawField(int col, int row, int state); void turnFieldsRow(int row, int col, int dy, int dx); void turnFields(Move &move); void updateBoard(void); void gameOver(void); int PlayerColor(void); int ComputerColor(void); public: void newGame(void); void undoMove(void); void getHint(void); void fieldClicked(int id); void updateStrength(int strength); void updateAnimations(int animations); void updateComputerBegins(int computerBegins); void updateTurnLabel(int state); void updateScoreLabel(); int getState(){return m_state;}};#endif //_BOARD_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -