Book Image

Android NDK: Beginner's Guide

By : Sylvain Ratabouil
Book Image

Android NDK: Beginner's Guide

By: Sylvain Ratabouil

Overview of this book

Table of Contents (18 chapters)
Android NDK Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Porting Box2D to Android


With the STL in our basket, we are ready to port almost any library to Android. Actually, many third-party libraries are already ported and many more are coming. However, when nothing is available, you have to rely on our own skills.

To see how to handle this situation, we are now going to port Box2D with the NDK. Box2D is a highly popular physics simulation engine initiated by Erin Catto in 2006. Many 2D games, either amateur or professional like Angry Birds, embed this powerful open source library. It is available in several languages, including Java, though its primary language is C++.

Box2D is an answer to the complex subject, that is, physics simulation. Maths, numerical integration, software optimization, and so on are some of the multiple techniques applied to simulate rigid body movements and collisions in a 2D environment. Bodies are the essential element of Box2D and are characterized by the following:

  • A geometrical shape (polygons, circles, and so on)

  • Physics...