Liquidfun links
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
Building LiquidFun and Running Examples {#mainpage}
|
||||
=======================================
|
||||
|
||||
LiquidFun is an extension of [Box2D](http://box2d.org), a 2D physics engine
|
||||
for games.
|
||||
|
||||
API documentation is located in the Documentation/ folder and referenced
|
||||
by our [landing page](../../index.html).
|
||||
|
||||
If your project already uses Box2D, please see these instructions for
|
||||
[Porting from Box2D](md__porting_from_box2_d.html).
|
||||
|
||||
Instructions on how to build for:
|
||||
- [Android](md__building_android.html)
|
||||
- [iOS](md__buildingi_o_s.html)
|
||||
- [Linux](md__building_linux.html)
|
||||
- [Windows](md__building_windows.html)
|
||||
- [OS X](md__building_o_s_x.html)
|
||||
- [JavaScript version](md__building_java_script.html)
|
||||
@@ -0,0 +1,117 @@
|
||||
# Building for Android
|
||||
|
||||
### Version Requirements
|
||||
|
||||
Following are the minimum required versions for the tools and libraries you
|
||||
need for building LiquidFun for Android:
|
||||
|
||||
- Android SDK: Android 2.3.3 (API Level 10)
|
||||
- ADT: 20130917
|
||||
- NDK: android-ndk-r9
|
||||
- NDK plugn for Eclipse: bundled with ADT
|
||||
- cmake (when building from source): 2.8.12.1
|
||||
|
||||
### Before Building
|
||||
|
||||
- Install the [Android SDK].
|
||||
- Install the [Android NDK].
|
||||
|
||||
### Building
|
||||
|
||||
Each LiquidFun project for Android has an associated `AndroidManifest.xml`
|
||||
file and `jni` subdirectory. For samples, `AndroidManifest.xml` contains
|
||||
details about how to build an Android package (apk). For libraries, such as
|
||||
LiquidFun and freeglut, the `AndroidManifest.xml` file informs the `ndk-build`
|
||||
tool that the directory contains NDK makefiles under the `jni` subdirectory.
|
||||
|
||||
The following [Android NDK][] projects live in the liquidfun directory tree.
|
||||
|
||||
- `liquidfun/Box2D` - liquidfun dynamic and static libraries.
|
||||
- `liquidfun/Box2D/HelloWorld` - Non-interactive Hello World sample
|
||||
application.
|
||||
- `liquidfun/Box2D/Testbed` - Interactive Testbed sample application.
|
||||
|
||||
To build an [Android NDK][] project:
|
||||
|
||||
- Open a command line window.
|
||||
- Go to the working directory containing the project to build.
|
||||
- Execute ndk-build.
|
||||
|
||||
For example, to build the LiquidFun dynamic and static libraries:
|
||||
|
||||
cd liquidfun/Box2D
|
||||
ndk-build
|
||||
|
||||
### Executing a Sample
|
||||
|
||||
Running a sample requires the Android Development Tools ([ADT][]) plugin and
|
||||
the [NDK Eclipse plugin][].
|
||||
|
||||
#### Running an application using Eclipse:
|
||||
|
||||
- Build a project using `ndk-build` (see above).
|
||||
- Open [ADT][] Eclipse.
|
||||
- Select "File->Import..." from the menu.
|
||||
- Select "Android > Existing Android Code Into Workspace", and click "Next".
|
||||
- Click the "Browse..." button next to `Root Directory:` and select the
|
||||
project folder (e.g. `liquidfun/Box2D/Testbed`).
|
||||
- Click "Finish". Eclipse imports the project, and displays it in the
|
||||
Package Explorer pane.
|
||||
- Right-click the project, and select "Run->Run As->Android Application"
|
||||
from the menu.
|
||||
- If you do not have a physical device, you must define a virtual one.
|
||||
For details about how to define a virtual device, see [managing avds][].
|
||||
We don’t recommend a virtual device for development.
|
||||
|
||||
- If the target is a physical device, unlock the device and observe the application executing.
|
||||
|
||||
#### Build and Run from the Command Line:
|
||||
|
||||
It's also possible to use `build_apk.sh` to build, deploy, and execute an application.
|
||||
`build_apk.sh` requires the installation of the [Android NDK][] and [Android SDK][].
|
||||
On Windows the script requires that you install [Cygwin][], as it
|
||||
makes use of Bash and common UNIX utilities. In addition, `build_apk.sh`
|
||||
requires the addition of the [Android SDK][] `sdk/tools`, [Android SDK][]
|
||||
`sdk/platform-tools` and [Android NDK][] root directories to the `PATH`
|
||||
environment variable.
|
||||
|
||||
To build and run an application using `build_apk.sh`:
|
||||
|
||||
- Change into the directory containing the project to build.
|
||||
- Run build\_apk.sh.
|
||||
|
||||
For example, the following will build the Testbed application, deploy it to
|
||||
the connected device, and start it:
|
||||
|
||||
cd liquidfun/Box2D/Testbed
|
||||
../AndroidUtil/build_apk.sh
|
||||
|
||||
### Code Generation
|
||||
|
||||
By default, code is generated for devices that support the `armeabi-v7a` ABI.
|
||||
Alternatively, you can generate a fat `.apk` that includes code for all ABIs.
|
||||
To do so, override APP\_ABI on ndk-build's command line:
|
||||
|
||||
ndk-build APP_ABI=all
|
||||
|
||||
### Running Unit Tests
|
||||
|
||||
Developers modifying the LiquidFun library can verify that it is still working
|
||||
correctly by executing the provided unit tests.
|
||||
|
||||
Use the run\_tests\_android.sh script to execute unit tests:
|
||||
|
||||
./liquidfun/Box2D/Unittests/run_tests_android.sh
|
||||
|
||||
`run_tests_android.sh` uses `build_apk.sh` to build, deploy, and
|
||||
execute each unit test on the connected device.
|
||||
The "Build and Run from the Command Line" section above describes
|
||||
the setup requirements for `build_apk.sh`.
|
||||
|
||||
[Android SDK]: http://developer.android.com/sdk/index.html
|
||||
[Android NDK]: http://developer.android.com/tools/sdk/ndk/index.html
|
||||
[NDK Eclipse plugin]: http://developer.android.com/sdk/index.html
|
||||
[managing avds]: http://developer.android.com/tools/devices/managing-avds.html
|
||||
[Cygwin installation]: http://www.cygwin.com/
|
||||
[ADT]: http://developer.android.com/tools/sdk/eclipse-adt.html
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
# Building JavaScript version
|
||||
|
||||
### Background
|
||||
|
||||
LiquidFun can be translated from C++ into JavaScript by
|
||||
[Emscripten](http://github.com/kripken/emscripten/wiki).
|
||||
The entire JavaScript translation is in one file: liquidfun.js.
|
||||
|
||||
The LiquidFun source includes a pre-made version of liquidfun.js.
|
||||
You can reference that liquidfun.js to start writing LiquidFun programs
|
||||
in JavaScript right away.
|
||||
|
||||
However, if you make changes to the LiquidFun C++ code, or if you need
|
||||
to expose more of the LiquidFun API, you will need to remake liquidfun.js
|
||||
by following the steps on this page.
|
||||
|
||||
### Before Building
|
||||
|
||||
We use Emscripten on Linux, but you should be able to use the Emscripten SDK
|
||||
on Mac or Windows too, if you prefer. Note that Mac and Windows build
|
||||
environments have not been tested.
|
||||
|
||||
- Get Emscripten. See [Installing from Source](http://github.com/kripken/emscripten/wiki/Emscripten-SDK#installing-from-source).
|
||||
- You also need [Fastcomp](http://github.com/kripken/emscripten/wiki/LLVM-Backend#getting-fastcomp)
|
||||
- And [Node.js](http://nodejs.org/download/)
|
||||
- Setup Emscripten.
|
||||
- As suggested in the Emscripten docs, run "emcc -v"
|
||||
- Update your ~/.emscripten file. You'll probably want something like this:
|
||||
- LLVM_ROOT = os.path.expanduser('~/Code/emscripten-fastcomp/build/Release/bin')
|
||||
- NODE_JS = os.path.expanduser('~/Code/node-v0.10.29-linux-x64/bin/node')
|
||||
- Get the [Closure Compiler](http://developers.google.com/closure/compiler/).
|
||||
- Set environment variables. Depending on your setup, you may want to add
|
||||
some lines like this to your ~/.bashrc file.
|
||||
- export EMSCRIPTEN=~/Code/emscripten
|
||||
- export CLOSURE_JAR=~/Code/closure/compiler.jar
|
||||
|
||||
### Building
|
||||
|
||||
The following commands run Emscripten to translate C++ to lf_core.js,
|
||||
then combine lf_core.js with the bindings in jsBindings into liquidfun.js.
|
||||
|
||||
cd Box2D/lfjs
|
||||
make
|
||||
./uglify.sh
|
||||
|
||||
### Executing the Testbed
|
||||
|
||||
For an example program, try openning `Box2D/lfjs/index.html' in your browser.
|
||||
This will load a JavaScript version of the LiquidFun Testbed. It uses
|
||||
the liquidfun.js file that you built above.
|
||||
|
||||
### Debugging
|
||||
|
||||
The default output of `make` and `uglify.sh` is whitespace-optimized
|
||||
JavaScript that is difficult to debug. To create an un-optimized version
|
||||
of the testbed, please follow the steps below.
|
||||
|
||||
+ In `lfjs/Makefile` change -O2 to -O0, to disable Emscripten optimizations.
|
||||
+ In `lfjs/index.html` replace `<script src="liquidfun.js"></script>` with
|
||||
a similar line for every .js file in `lfjs/uglify.sh`. It should look
|
||||
something like,
|
||||
|
||||
<script src="lf_core.js"></script>
|
||||
<script src="jsBindings/offsets.js"></script>
|
||||
<script src="jsBindings/Common/b2Math.js"></script>
|
||||
<script src="jsBindings/Collision/b2Collision.js"></script>
|
||||
<script src="jsBindings/Collision/Shapes/b2EdgeShape.js"></script>
|
||||
<script src="jsBindings/Collision/Shapes/b2PolygonShape.js"></script>
|
||||
<script src="jsBindings/Collision/Shapes/b2Shape.js"></script>
|
||||
<script src="jsBindings/Collision/Shapes/b2ChainShape.js"></script>
|
||||
<script src="jsBindings/Collision/Shapes/b2CircleShape.js"></script>
|
||||
<script src="jsBindings/Dynamics/b2Body.js"></script>
|
||||
<script src="jsBindings/Dynamics/b2World.js"></script>
|
||||
<script src="jsBindings/Dynamics/Joints/b2WheelJoint.js"></script>
|
||||
<script src="jsBindings/Dynamics/Joints/b2WeldJoint.js"></script>
|
||||
<script src="jsBindings/Dynamics/Joints/b2GearJoint.js"></script>
|
||||
<script src="jsBindings/Dynamics/Joints/b2Joint.js"></script>
|
||||
<script src="jsBindings/Dynamics/Joints/b2FrictionJoint.js"></script>
|
||||
<script src="jsBindings/Dynamics/Joints/b2RevoluteJoint.js"></script>
|
||||
<script src="jsBindings/Dynamics/Joints/b2MotorJoint.js"></script>
|
||||
<script src="jsBindings/Dynamics/Joints/b2PulleyJoint.js"></script>
|
||||
<script src="jsBindings/Dynamics/Joints/b2DistanceJoint.js"></script>
|
||||
<script src="jsBindings/Dynamics/Joints/b2PrismaticJoint.js"></script>
|
||||
<script src="jsBindings/Dynamics/Joints/b2RopeJoint.js"></script>
|
||||
<script src="jsBindings/Dynamics/Joints/b2MouseJoint.js"></script>
|
||||
<script src="jsBindings/Dynamics/Contacts/b2Contact.js"></script>
|
||||
<script src="jsBindings/Dynamics/b2Fixture.js"></script>
|
||||
<script src="jsBindings/Dynamics/b2WorldCallbacks.js"></script>
|
||||
<script src="jsBindings/Particle/b2ParticleSystem.js"></script>
|
||||
<script src="jsBindings/Particle/b2ParticleGroup.js"></script>
|
||||
<script src="jsBindings/Particle/b2Particle.js"></script>
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
# Building for Linux
|
||||
|
||||
### Version Requirements
|
||||
|
||||
Following are the minimum required versions for the tools and libraries you
|
||||
need for building LiquidFun for Linux:
|
||||
|
||||
- OpenGL: libglapi-mesa 8.0.4 (tested with libglapi-mesa 8.0.4-0ubuntu0)
|
||||
- GLU: libglu1-mesa-dev 8.0.4 (tested with libglu1-mesa-dev 8.0.4.0ubuntu0)
|
||||
- cmake (when building from source): 2.8.12.1
|
||||
|
||||
### Before Building
|
||||
|
||||
Prior to building, install the following components using the [Linux][]
|
||||
distribution's package manager:
|
||||
- [cmake][]. You can also manually install from [cmake.org]
|
||||
(http://cmake.org).
|
||||
- OpenGL (`libglapi-mesa`).
|
||||
- GLU (`libglu1-mesa-dev`).
|
||||
|
||||
For example, on Ubuntu:
|
||||
|
||||
sudo apt-get install cmake
|
||||
sudo apt-get install libglapi-mesa
|
||||
sudo apt-get install libglu1-mesa-dev
|
||||
|
||||
The sample applications require OpenGL and GLU.
|
||||
|
||||
### Building
|
||||
|
||||
- Generate makefiles from the [cmake][] project in `liquidfun/Box2D`.
|
||||
- Execute `make` to build the library and sample applications.
|
||||
|
||||
For example:
|
||||
|
||||
cd liquidfun/Box2D
|
||||
cmake -G'Unix Makefiles'
|
||||
make
|
||||
|
||||
To perform a debug build:
|
||||
|
||||
cd liquidfun/Box2D
|
||||
cmake -G'Unix Makefiles' -DCMAKE_BUILD_TYPE=Debug
|
||||
make
|
||||
|
||||
Build targets can be configured using options exposed in
|
||||
`liquidfun/Box2D/CMakeLists.txt` by using cmake's `-D` option.
|
||||
Build configuration set using the `-D` option is sticky across subsequent
|
||||
builds.
|
||||
|
||||
For example, if a build is performed using:
|
||||
|
||||
cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
|
||||
make
|
||||
|
||||
to switch to a release build CMAKE_BUILD_TYPE must be explicitly specified:
|
||||
|
||||
cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
|
||||
make
|
||||
|
||||
### Executing a Sample
|
||||
|
||||
After building the project, you can execute the samples from the command line.
|
||||
For example:
|
||||
|
||||
./liquidfun/Box2D/Testbed/Release/Testbed
|
||||
|
||||
### Running Unit Tests
|
||||
|
||||
Developers modifying the LiquidFun library can verify that it still working
|
||||
correctly by executing the provided unit tests.
|
||||
|
||||
Use the run\_tests.sh script to execute unit tests:
|
||||
|
||||
./liquidfun/Box2D/Unittests/run_tests.sh
|
||||
|
||||
[cmake]: http://www.cmake.org
|
||||
[Linux]: http://en.wikipedia.org/wiki/Linux
|
||||
[Ubuntu]: http://www.ubuntu.com
|
||||
@@ -0,0 +1,62 @@
|
||||
# Building for OS X
|
||||
|
||||
You can use [cmake][] to generate an [Xcode][] project for LiquidFun's
|
||||
Testbed and Unittests on [OS X][].
|
||||
|
||||
Alternatively, you can download a pre-generated Xcode
|
||||
project from the [release page][]. The [Xcode][] project is free of
|
||||
host-specific dependencies.
|
||||
|
||||
### Version Requirements
|
||||
|
||||
These are the minimum required versions for building LiquidFun on OS X:
|
||||
|
||||
- OS X: Mavericks 10.9.1.
|
||||
- Xcode: 5.0.1
|
||||
- Xquartz: 2.7.5 (xorg-server 1.14.4)
|
||||
- cmake (when building from source) 2.8.12.1
|
||||
|
||||
### Before Building
|
||||
|
||||
- Install [Xquartz][] to run LiquidFun sample applications.
|
||||
The Testbed uses [freeglut][], which requires [Xquartz][].
|
||||
- Reboot your machine. Rebooting sets the `DISPLAY` environment variable for
|
||||
[Xquartz][], which enables sample applications to run correctly.
|
||||
|
||||
### Creating the Xcode project using [cmake][]
|
||||
|
||||
When working directly with the source, you can generate the [Xcode][]
|
||||
project using [cmake][]. [cmake][] version 2.8.12.1 or above is required to
|
||||
build this project on [OS X][] 10.9 (Mavericks). For example, the following
|
||||
generates the Xcode project in the liquidfun/Box2D directory.
|
||||
|
||||
cd liquidfun/Box2D
|
||||
cmake -G "Xcode"
|
||||
|
||||
### Building with [Xcode][]
|
||||
|
||||
- Double-click on `liquidfun/Box2D/Box2D.xcodeproj` to open the project in
|
||||
[Xcode][].
|
||||
- Select "Product-->Build" from the menu.
|
||||
|
||||
### Executing a Sample
|
||||
|
||||
- Select a sample `Scheme`, for example "Testbed-->My Mac 64-bit", from the
|
||||
combo box to the right of the "Run" button.
|
||||
- Click the "Run" button.
|
||||
|
||||
### Running Unit Tests
|
||||
|
||||
Developers modifying the LiquidFun library can verify that it is still working
|
||||
correctly by executing the provided unit tests.
|
||||
|
||||
Use the run\_tests.sh script to execute unit tests:
|
||||
|
||||
./liquidfun/Box2D/Unittests/run_tests.sh
|
||||
|
||||
[Xquartz]: http://xquartz.macosforge.org/
|
||||
[cmake]: http://www.cmake.org
|
||||
[Xcode]: http://developer.apple.com/xcode/
|
||||
[OS X]: http://www.apple.com/osx/
|
||||
[freeglut]: http://freeglut.sourceforge.net/
|
||||
[release page]: http://github.com/google/liquidfun/releases
|
||||
@@ -0,0 +1,64 @@
|
||||
# Building for Windows
|
||||
|
||||
You can use [cmake][] to generate a [Visual Studio][] project for
|
||||
LiquidFun's Testbed and Unittests on [Windows][].
|
||||
|
||||
Alternatively, you can download a pre-generated Visual Studio solution
|
||||
from the [release page][]. The Visual Studio solution is free of
|
||||
host-specific dependencies.
|
||||
|
||||
### Version Requirements
|
||||
|
||||
These are the minimum required versions for building LiquidFun for Windows:
|
||||
|
||||
- Windows: 7
|
||||
- Visual Studio: 2010 or 2012
|
||||
- cmake: 2.8.12.1
|
||||
|
||||
### Creating the Visual Studio solution using [cmake][]
|
||||
|
||||
When working directly with the source, use [cmake][] to generate the
|
||||
[Visual Studio][] solution and project files. For example, the following
|
||||
generates the [Visual Studio][] 2012 solution in the `liquidfun/Box2D`
|
||||
directory:
|
||||
|
||||
cd liquidfun\Box2D
|
||||
cmake -G "Visual Studio 11"
|
||||
|
||||
To generate a [Visual Studio][] 2010 solution, use this commend:
|
||||
|
||||
cd liquidfun\Box2D
|
||||
cmake -G "Visual Studio 10"
|
||||
|
||||
Running [cmake][] under [cygwin][] requires empty TMP, TEMP, tmp and temp
|
||||
variables. To generate a [Visual Studio][] solution from a [cygwin][]
|
||||
bash shell use:
|
||||
|
||||
$ cd liquidfun/Box2D
|
||||
$ ( unset {temp,tmp,TEMP,TMP} ; cmake -G "Visual Studio 11" )
|
||||
|
||||
### Building with [Visual Studio][]
|
||||
|
||||
- Double-click on `liquidfun/Box2D/Box2D.sln` to open the solution.
|
||||
- Select "Build-->Build Solution" from the menu.
|
||||
|
||||
### Executing a Sample
|
||||
|
||||
- Right-click on an example project (e.g Testbed) in the Solution Explorer
|
||||
pane, and select "Set as StartUp Project".
|
||||
- Select "Debug-->Start Debugging" from the menu.
|
||||
|
||||
### Running Unit Tests
|
||||
|
||||
Developers modifying the LiquidFun library can verify that it is still working
|
||||
correctly by executing the provided unit tests.
|
||||
|
||||
Use the run\_tests.bat batch file to execute unit tests:
|
||||
|
||||
liquidfun\Box2D\Unittests\run_tests.bat
|
||||
|
||||
[cmake]: http://www.cmake.org
|
||||
[Visual Studio]: http://www.visualstudio.com/
|
||||
[Windows]: http://windows.microsoft.com/
|
||||
[cygwin]: http://www.cygwin.com/
|
||||
[release page]: http://github.com/google/liquidfun/releases
|
||||
@@ -0,0 +1,32 @@
|
||||
# Building for iOS
|
||||
|
||||
The LiquidFun source contains [Xcode][] projects to build the Testbed
|
||||
application and EyeCandy demo. Unlike the OS X projects, the iOS Xcode
|
||||
projects are *not* generated using [cmake][]. They must be maintained
|
||||
manually.
|
||||
|
||||
### Version Requirements
|
||||
|
||||
Following are the minimum tested versions for building the tools and
|
||||
libraries you on iOS.
|
||||
|
||||
- OS X: Mavericks 10.9.3.
|
||||
- Xcode: 5.1.1
|
||||
|
||||
### Building with [Xcode][]
|
||||
|
||||
- Double-click `liquidfun/Box2D/Testbed/ios/Testbed.xcodeproj` or
|
||||
`liquidfun/Box2D/EyeCandy/ios/EyeCandy.xcodeproj` to open the project
|
||||
in [Xcode][].
|
||||
- Select "Product-->Build" from the menu.
|
||||
|
||||
### Executing a Testbed or EyeCandy
|
||||
|
||||
- Select a `Scheme`, for example "Testbed-->iPhone Retina (3.5-inch)",
|
||||
from the combo box to the right of the "Run" button.
|
||||
- Click the "Run" button.
|
||||
|
||||
|
||||
[Xcode]: http://developer.apple.com/xcode/
|
||||
[cmake]: http://www.cmake.org
|
||||
[OS X]: http://www.apple.com/osx/
|
||||
@@ -0,0 +1,40 @@
|
||||
# Porting from Box2D
|
||||
|
||||
LiquidFun extends Erin Catto's popular Box2D physics engine. If your project
|
||||
already uses Box2D, LiquidFun should be a simple drop-in replacement for you.
|
||||
|
||||
### Drop-in LiquidFun Code
|
||||
|
||||
To port from Box2D to LiquidFun, simply replace your Box2D directory with
|
||||
liquidfun/Box2D/Box2D. Your code should compile and run as it did under Box2D,
|
||||
and you will have access to LiquidFun's particle simulation API.
|
||||
|
||||
LiquidFun is based off of a specific version of Box2D. If your version of
|
||||
Box2D is different from LiquidFun's you may have to adjust your code to
|
||||
match API differences.
|
||||
|
||||
Please see the [Release Notes][] to find the version of Box2D that LiquidFun
|
||||
is based on.
|
||||
|
||||
### Specify `particleIterations`
|
||||
|
||||
LiquidFun adds a `particleIterations` parameter to b2World::Step. If you don't
|
||||
specify `particleIterations`, we calculate a default value based on the
|
||||
physical constants in your b2ParticleSystems.
|
||||
|
||||
However, the number of `particleIterations` affects performance and stability
|
||||
significantly. You should experiment with the number of iterations to find
|
||||
a suitable balance for your situation.
|
||||
|
||||
### Start using b2ParticleSystem
|
||||
|
||||
`b2ParticleSystems` are created with `b2World::CreateParticleSystem`, the
|
||||
same way `b2Bodys` are created with `b2World::CreateBody`.
|
||||
|
||||
For details, please see [Particle Module][] in the [Programmer's Guide][]
|
||||
|
||||
|
||||
[Release Notes]: ../../ReleaseNotes.html
|
||||
[Particle Module]: ../../Programmers-Guide/html/md__chapter11__particles.html
|
||||
[Programmer's Guide]: ../../Programmers-Guide/html/index.html
|
||||
|
||||
+2357
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user