- Game Programming using Qt 5 Beginner's Guide
- Pavel Strakhov Witold Wysota Lorenz Haas
- 171字
- 2021-08-27 18:31:00
Have a go hero – Extending the game
There are a lot of subtle improvements you can make in the project. For example, you can change the title of the main window (by editing its windowTitle property), add accelerators to the actions, disable the board buttons that do nothing on click, remove the status bar, or use it for displaying the game status.
As an additional exercise, you can try to modify the code we wrote in this chapter to allow playing the game on boards bigger than 3 × 3. Let the user decide the size of the board (you can modify the game options dialog for that and use QSlider and QSpinBox to allow the user to choose the size of the board), and you can then instruct TicTacToeWidget to build the board based on the size it gets. Remember to adjust the game-winning logic! If at any point you run into a dead end and do not know which classes and functions to use, consult the reference manual.