Accessing window surface natively

Application events are essential to understand, but not very exciting. An interesting feature of the Android NDK is the ability to access the display window natively. With this privileged access, applications can draw any graphics they want onscreen.

We will now exploit this feature to get a graphic feedback in our application: a red square on screen. This square is going to represent the spaceship the user will control during the game.

Note

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

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.