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 ...

Get Game Programming using Qt 5 Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.