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?

We added two kinds of properties to the element. By introducing lineWidth, we can manipulate the width of the line that visualizes the heartbeat. The points variable stores an array of already calculated function values. We initialize it to an empty array. The arg variable stores the function argument that was last evaluated. The argument of the function should be in the range from −π to +π; thus, we initialize arg to -Math.PI. Then, we add a timer that ticks in regular intervals, incrementing arg by 1° until it reaches +π, in which case it is reset to the initial value.

Changes to arg are intercepted in the handler we implement next. In there, we push a new item to the array of points. The value is calculated by the ...

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