Game Programming using Qt 5 Beginner's Guide - Second Edition
by Pavel Strakhov, Witold Wysota, Lorenz Haas
Game loops
Most games revolve around some kind of game loop. It is usually some kind of function that is called repeatedly, and its task is to progress the game—process input events, move objects around, calculate and execute actions, check win conditions, and so on. Such an approach is very imperative and usually results in a very complex function that needs to know everything about everybody (this kind of anti-pattern is sometimes called a god object pattern). In QML (which powers the Qt Quick framework), we aim to separate responsibilities and declare well-defined behaviors for particular objects. Therefore, although it is possible to set up a timer that will periodically call a game loop function, this is not the best possible approach ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access