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

What just happened?

A number of images were prepared following a common naming pattern containing a number. All the images have the same size. This allows us to replace one image with another just by changing the value of the source property to point to a different image. To make it easier, we introduced a property called the currentFrame element that contains the index of the image to be displayed. We used the currentFrame element in a string, forming an expression bound to the source element of the image. To make substituting frames easy, a NumberAnimation element was declared to modify the values of the currentFrame element in a loop from 1 to the number of animation frames available (represented by the frameCount property) so that each ...

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