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 – constructing the Tower of Hanoi scene

Our next task will be to create a foundation and three rods for our puzzle. We will take advantage of QML's modular system and split our code into multiple components. First, let's leave camera and lighting settings in the main.qml and put our actual scene content to a new Scene component. In order to do that, put the text cursor onto the Entity declaration of the cube, press Alt + Enter and select Move Component into Separate File. Input Scene as the component name and confirm the operation. Qt Creator will create a new Scene.qml file and add it to the project's resources. The main.qml now contains just an instantiation of our scene component:

Entity {    //...    Scene { }}

The actual properties ...

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