Book Image

Cocos2d-x by Example: Beginner's Guide

By : Roger Engelbert
Book Image

Cocos2d-x by Example: Beginner's Guide

By: Roger Engelbert

Overview of this book

Table of Contents (19 chapters)
Cocos2d-x by Example Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – running the game in Android


Follow these steps to deploy a Box2D game to Android:

  1. Open the Android.mk file in a text editor (you'll find it in the folder proj.android/jni).

  2. Edit the lines in LOCAL_SRC_FILES to read:

    LOCAL_SRC_FILES := hellocpp/main.cpp \
                       ../../Classes/AppDelegate.cpp \
                      ../../Classes/GLES-Render.cpp \
                       ../../Classes/b2Sprite.cpp \
                       ../../Classes/Ball.cpp \
                       ../../Classes/CollisionListener.cpp \
                       ../../Classes/Cue.cpp \
                       ../../Classes/LineContainer.cpp \
                       ../../Classes/GameLayer.cpp 
  3. Open the manifest file and set the app orientation to portrait.

  4. Import the game into Eclipse and wait till all classes are compiled.

  5. Build and run your application.

What just happened?

That was it. There is no difference between building a game that uses Box2D and one that does not. The Box2D API is already included in the make file, in the...