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 ...

Get Game Programming using Qt 5 Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.