Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vanderlin/ofxBox2d
Openframework wrapper for box2d
https://github.com/vanderlin/ofxBox2d
Last synced: about 2 months ago
JSON representation
Openframework wrapper for box2d
- Host: GitHub
- URL: https://github.com/vanderlin/ofxBox2d
- Owner: vanderlin
- License: zlib
- Created: 2011-01-14T16:25:28.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2023-10-09T14:34:41.000Z (9 months ago)
- Last Synced: 2024-04-13T20:24:27.414Z (2 months ago)
- Language: C++
- Homepage:
- Size: 24 MB
- Stars: 322
- Watchers: 27
- Forks: 126
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: License.txt
Lists
- awesome-cpp - ofxBox2d - openFrameworks wrapper for Box2D. [BSD-like] (Physics)
- awesome-cpp - ofxBox2d - openFrameworks wrapper for Box2D. [BSD-like] (Physics)
- awesome-cpp-cn - ofxBox2d
- fucking-awesome-cpp - ofxBox2d - openFrameworks wrapper for Box2D. [BSD-like] (Physics)
- awesome-cpp - ofxBox2d - openFrameworks wrapper for Box2D. [BSD-like] (Physics)
- awesome-cpp - ofxBox2d - openFrameworks wrapper for Box2D. [BSD-like] (Physics)
- awesome-cpp - ofxBox2d - openFrameworks wrapper for Box2D. [BSD-like] (Physics)
- awesome-cpp-completed - ofxBox2d - openFrameworks wrapper for Box2D. [BSD-like] (Physics)
- awesome-cpp - ofxBox2d - openFrameworks wrapper for Box2D. [BSD-like] (Physics)
- awesome-cpp - ofxBox2d - openFrameworks wrapper for Box2D. [BSD-like] (Physics)
- awesome-cpp - ofxBox2d - openFrameworks wrapper for Box2D. [BSD-like] (Physics)
- awesome-cpp - ofxBox2d - openFrameworks wrapper for Box2D. [BSD-like] (Physics)
- awesome-cpp - ofxBox2d - openFrameworks wrapper for Box2D. [BSD-like] (Physics)
- awesome-cpp - ofxBox2d - openFrameworks wrapper for Box2D. [BSD-like] (Physics)
- awesome-cpp - ofxBox2d - openFrameworks wrapper for Box2D. [BSD-like] (Physics)
- awesome-cpp-completed - ofxBox2d - openFrameworks wrapper for Box2D. [BSD-like] (Physics)
- awesome-cpp - ofxBox2d - Box2D开源框架包装器D. [BSD-like] (物理学)
- awesome-cpp - ofxBox2d - openFrameworks wrapper for Box2D. [BSD-like] (Physics)
README
ofxBox2d
=====================================![ofxBox2d](http://farm7.staticflickr.com/6010/5964216482_a11debc021_b.jpg)
Introduction
------------
This is a simple wrapper for box2d using Openframeworks. The examples below are still in progressive, but should be stable for the most part. Please open up a issue if you have suggestions or find bugs. The wrapper is using the version Box2D v2.3Thanks,
ToddInstallation
------------First, pick the branch that matches your version of openFrameworks:
* OF [stable](https://github.com/openframeworks/openFrameworks/tree/stable) (0.9.8): use [ofxBox2d/stable](https://github.com/vanderlin/ofxBox2d/tree/stable)
* OF [master](https://github.com/openframeworks/openFrameworks) (0.10.0): use [ofxBox2d/master](https://github.com/vanderlin/ofxBox2d/)Instructions
------------
When making a vector of objects you need to be careful. You either need to make a vector of pointers of use the `shared_ptr` object.
Everytime you push into the vector `circles` the object is destroyed and the created.
This causing issues for the `b2dBody body` object owned by box2d.
***Incorrect way to store objects.***
``` c++
vector circles;
ofxBox2dCircle circle;
circles.push_back(circle);
```***Here is the how to create a vector of box2d objects.***
``` c++
// in your header files
vector > circles;// now add a circle to the vector
auto circle = std::make_shared();// to grab the pointer you use the get() function of shared_ptr (std::shared_ptr)
circle->setPhysics(3.0, 0.53, 0.1);
circle->setup(box2d.getWorld(), 100, 100, 10);
circles.push_back(circle);
```Installation
------------
Place ofxBox2d within a folder in the apps folder of the OF dir tree:
openframeworks/addons/ofxBox2dCompatibility
------------
ofxBox2d is developed against the current version of OpenFramewroks.If you are using a stable version (007, 0071, ...) of OpenFrameworks then you want to use a git tag of ofxBox2d for that version. You can select the tag in the Github "Current Branch" menu or clone and check it out using git.
For example, the following commands will clone ofxBox2d and switch to the OF 008 tagged version:
git clone git://github.com/vanderlin/ofxBox2d.git
cd ofxBox2d
git checkout 008