Create the Falling Blocks application

In this tutorial, we'll explore the Falling Blocks sample application that is included with the BlackBerry Native SDK for Tablet OS. This application demonstrates how to perform common tasks such as handling events, using the accelerometer, working with application data, and rendering content on the screen. When this application starts, a single block appears on the screen and falls from the relative top of the screen to the relative bottom, depending on the orientation and pitch of the BlackBerry PlayBook tablet. A user can tap the screen and a new block will appear at that position and start falling. The blocks always fall from one side of the screen to the opposite side, even when the user changes the orientation of the tablet.

Device image showing the Falling Blocks sample app.

You will learn to

  • Create the Falling Blocks project
  • Initialize OpenGL ES and application data
  • Set up a main application loop
  • Handle accelerometer, screen, and navigator events
  • Update application data and render the scene
  • Clean up application resources properly

How to use this tutorial

This tutorial walks you through the Falling Blocks application and explains the purpose of each section of code. You don't need to type any code yourself; it's all included in the main.c file of the Falling Blocks project. You can open that file in the QNX Momentics IDE and follow along using the code samples that are provided throughout the tutorial. To see the complete code that is used in this tutorial, you can download the Falling Blocks sample from GitHub.