-
Notifications
You must be signed in to change notification settings - Fork 0
How to Use
Rado1 edited this page Mar 14, 2015
·
1 revision
- Create ZGE project or use existing one.
- Include ZExternalLibrary component for ZgeBox2D library to the OnLoaded section of ZApplication.
- Initialize the simulation world with
zb2InitWorld()
. This call is usually placed to the OnLoaded section of ZApplication or OnStart section of AppState component. - Regularly step the simulation with
zb2Step()
function. To achieve real-time simulation, the first parameter is usually set toApp.DeltaTime
. This is usually placed to OnUpdate section of ZApplication or AppState components. - Create 2D bodies, change their properties or request their simulation properties (position, rotation, contact points) in your code as needed. Usually, a body is represented by a model instance. In this case, creation of body is done in the OnSpawn section, updating position, rotation and querying in the OnUpdate section, and destroying 2D body in the OnRemove section of the Model or ModelState.
- On application exit, sestroy the simulation world with
zb2DestroyWorld()
function. This call is usually placed to OnClose section of ZApplication component or OnLeave section of AppState.
For examples of usage, see the ZgeBox2D Testbed application at the download page.
- Compile your Android application, e.g., use Project / Android: Build APK (debug) menu item.
- Place
libZGEBox2D.so
file to thelibs/armeabi
folder. - Compile the APK again as in step 1.
- Deploy the APK file to your Android device and install it in standard way.
Note 1: The 1st and 2nd steps are required only when the application is built the first time. After that, a single compilation produces correct APK.
Note 2: Use the step 2 also in the case when updating to a newer version of the ZgeBox2D library.