Measuring time natively

Those who talk about graphics also need to talk about timing. Indeed, Android devices have different capabilities, and animations should be adapted to their speed. To help us in this task, Android gives access to time primitives, thanks to its good support of Posix APIs.

To experiment with these capabilities, we will use a timer to move asteroids onscreen according to time.

Note

The resulting project is provided with this book under the name DroidBlaster_Part4.

Get Android NDK 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.