Game Programming using Qt 5 Beginner's Guide - Second Edition
by Pavel Strakhov, Witold Wysota, Lorenz Haas
What just happened?
The collisions.js file contains functions used to do collision checking. The first line of the file is a .pragma library statement, noting that this document only contains functions and does not contain any mutable object. This statement marks the document as a library that can be shared between documents that import it. This aids in reduced memory consumption and improved speed, as the engine doesn't have to reparse and execute the document each time it is imported.
The functions defined in the library are really simple. The first one returns a bounding rectangle of an object based on its coordinates and the size of its children. It assumes that the top-level item is empty and contains children that represent the visual ...
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