O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – Developing the game architecture

Create a new Qt Widgets Application project. After the project infrastructure is ready, choose New File or Project from the File menu and choose to create a C++ Class. Call the new class ChessBoard and set QObject as its base class. Repeat the process to create a ChessAlgorithm class derived from QObject and another one called ChessView, but choose QWidget as the base class this time. You should end up with a file named main.cpp and four classes:

  • MainWindow will be our main window class that contains a ChessView
  • ChessView will be the widget that displays our chess board
  • ChessAlgorithm will contain the game logic
  • ChessBoard will hold the state of the chess board and provide it to ChessView ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required