pbox2d 0.6.0-java → 0.8.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.mvn/extensions.xml +8 -0
- data/.mvn/wrapper/maven-wrapper.properties +1 -0
- data/.travis.yml +23 -0
- data/CHANGELOG.md +8 -0
- data/README.md +7 -7
- data/Rakefile +1 -2
- data/lib/box2d.jar +0 -0
- data/lib/pbox2d/version.rb +1 -1
- data/lib/pbox2d.rb +1 -0
- data/pbox2d.gemspec +6 -11
- data/pom.rb +59 -0
- data/pom.xml +82 -73
- data/src/org/jbox2d/JBox2D.gwt.xml +12 -0
- data/src/org/jbox2d/callbacks/ContactAdaptor.java +27 -0
- data/src/org/jbox2d/callbacks/ContactFilter.java +59 -0
- data/src/org/jbox2d/callbacks/ContactImpulse.java +42 -0
- data/src/org/jbox2d/callbacks/ContactListener.java +87 -0
- data/src/org/jbox2d/callbacks/DebugDraw.java +297 -0
- data/src/org/jbox2d/callbacks/DestructionListener.java +53 -0
- data/src/org/jbox2d/callbacks/PairCallback.java +29 -0
- data/src/org/jbox2d/callbacks/ParticleDestructionListener.java +20 -0
- data/src/org/jbox2d/callbacks/ParticleQueryCallback.java +19 -0
- data/src/org/jbox2d/callbacks/ParticleRaycastCallback.java +19 -0
- data/src/org/jbox2d/callbacks/QueryCallback.java +45 -0
- data/src/org/jbox2d/callbacks/RayCastCallback.java +55 -0
- data/src/org/jbox2d/callbacks/TreeCallback.java +42 -0
- data/src/org/jbox2d/callbacks/TreeRayCastCallback.java +44 -0
- data/src/org/jbox2d/collision/AABB.java +338 -0
- data/src/org/jbox2d/collision/Collision.java +1444 -0
- data/src/org/jbox2d/collision/ContactID.java +106 -0
- data/src/org/jbox2d/collision/Distance.java +773 -0
- data/src/org/jbox2d/collision/DistanceInput.java +41 -0
- data/src/org/jbox2d/collision/DistanceOutput.java +43 -0
- data/src/org/jbox2d/collision/Manifold.java +116 -0
- data/src/org/jbox2d/collision/ManifoldPoint.java +104 -0
- data/src/org/jbox2d/collision/RayCastInput.java +47 -0
- data/src/org/jbox2d/collision/RayCastOutput.java +46 -0
- data/src/org/jbox2d/collision/TimeOfImpact.java +526 -0
- data/src/org/jbox2d/collision/WorldManifold.java +200 -0
- data/src/org/jbox2d/collision/broadphase/BroadPhase.java +92 -0
- data/src/org/jbox2d/collision/broadphase/BroadPhaseStrategy.java +88 -0
- data/src/org/jbox2d/collision/broadphase/DefaultBroadPhaseBuffer.java +268 -0
- data/src/org/jbox2d/collision/broadphase/DynamicTree.java +883 -0
- data/src/org/jbox2d/collision/broadphase/DynamicTreeFlatNodes.java +873 -0
- data/src/org/jbox2d/collision/broadphase/DynamicTreeNode.java +54 -0
- data/src/org/jbox2d/collision/broadphase/Pair.java +46 -0
- data/src/org/jbox2d/collision/shapes/ChainShape.java +264 -0
- data/src/org/jbox2d/collision/shapes/CircleShape.java +207 -0
- data/src/org/jbox2d/collision/shapes/EdgeShape.java +254 -0
- data/src/org/jbox2d/collision/shapes/MassData.java +105 -0
- data/src/org/jbox2d/collision/shapes/PolygonShape.java +718 -0
- data/src/org/jbox2d/collision/shapes/Shape.java +136 -0
- data/src/org/jbox2d/collision/shapes/ShapeType.java +32 -0
- data/src/org/jbox2d/common/BufferUtils.java +209 -0
- data/src/org/jbox2d/common/Color3f.java +88 -0
- data/src/org/jbox2d/common/IViewportTransform.java +133 -0
- data/src/org/jbox2d/common/Mat22.java +609 -0
- data/src/org/jbox2d/common/Mat33.java +290 -0
- data/src/org/jbox2d/common/MathUtils.java +335 -0
- data/src/org/jbox2d/common/OBBViewportTransform.java +174 -0
- data/src/org/jbox2d/common/PlatformMathUtils.java +46 -0
- data/src/org/jbox2d/common/RaycastResult.java +37 -0
- data/src/org/jbox2d/common/Rot.java +150 -0
- data/src/org/jbox2d/common/Settings.java +246 -0
- data/src/org/jbox2d/common/Sweep.java +116 -0
- data/src/org/jbox2d/common/Timer.java +46 -0
- data/src/org/jbox2d/common/Transform.java +203 -0
- data/src/org/jbox2d/common/Vec2.java +388 -0
- data/src/org/jbox2d/common/Vec3.java +170 -0
- data/src/org/jbox2d/dynamics/Body.java +1246 -0
- data/src/org/jbox2d/dynamics/BodyDef.java +382 -0
- data/src/org/jbox2d/dynamics/BodyType.java +41 -0
- data/src/org/jbox2d/dynamics/ContactManager.java +293 -0
- data/src/org/jbox2d/dynamics/Filter.java +62 -0
- data/src/org/jbox2d/dynamics/Fixture.java +454 -0
- data/src/org/jbox2d/dynamics/FixtureDef.java +214 -0
- data/src/org/jbox2d/dynamics/FixtureProxy.java +38 -0
- data/src/org/jbox2d/dynamics/Island.java +602 -0
- data/src/org/jbox2d/dynamics/Profile.java +97 -0
- data/src/org/jbox2d/dynamics/SolverData.java +33 -0
- data/src/org/jbox2d/dynamics/TimeStep.java +46 -0
- data/src/org/jbox2d/dynamics/World.java +2075 -0
- data/src/org/jbox2d/dynamics/contacts/ChainAndCircleContact.java +57 -0
- data/src/org/jbox2d/dynamics/contacts/ChainAndPolygonContact.java +57 -0
- data/src/org/jbox2d/dynamics/contacts/CircleContact.java +50 -0
- data/src/org/jbox2d/dynamics/contacts/Contact.java +365 -0
- data/src/org/jbox2d/dynamics/contacts/ContactCreator.java +35 -0
- data/src/org/jbox2d/dynamics/contacts/ContactEdge.java +56 -0
- data/src/org/jbox2d/dynamics/contacts/ContactPositionConstraint.java +49 -0
- data/src/org/jbox2d/dynamics/contacts/ContactRegister.java +31 -0
- data/src/org/jbox2d/dynamics/contacts/ContactSolver.java +1104 -0
- data/src/org/jbox2d/dynamics/contacts/ContactVelocityConstraint.java +60 -0
- data/src/org/jbox2d/dynamics/contacts/EdgeAndCircleContact.java +52 -0
- data/src/org/jbox2d/dynamics/contacts/EdgeAndPolygonContact.java +52 -0
- data/src/org/jbox2d/dynamics/contacts/PolygonAndCircleContact.java +51 -0
- data/src/org/jbox2d/dynamics/contacts/PolygonContact.java +50 -0
- data/src/org/jbox2d/dynamics/contacts/Position.java +31 -0
- data/src/org/jbox2d/dynamics/contacts/Velocity.java +31 -0
- data/src/org/jbox2d/dynamics/joints/ConstantVolumeJoint.java +258 -0
- data/src/org/jbox2d/dynamics/joints/ConstantVolumeJointDef.java +75 -0
- data/src/org/jbox2d/dynamics/joints/DistanceJoint.java +356 -0
- data/src/org/jbox2d/dynamics/joints/DistanceJointDef.java +106 -0
- data/src/org/jbox2d/dynamics/joints/FrictionJoint.java +294 -0
- data/src/org/jbox2d/dynamics/joints/FrictionJointDef.java +78 -0
- data/src/org/jbox2d/dynamics/joints/GearJoint.java +520 -0
- data/src/org/jbox2d/dynamics/joints/GearJointDef.java +58 -0
- data/src/org/jbox2d/dynamics/joints/Jacobian.java +32 -0
- data/src/org/jbox2d/dynamics/joints/Joint.java +235 -0
- data/src/org/jbox2d/dynamics/joints/JointDef.java +65 -0
- data/src/org/jbox2d/dynamics/joints/JointEdge.java +57 -0
- data/src/org/jbox2d/dynamics/joints/JointType.java +28 -0
- data/src/org/jbox2d/dynamics/joints/LimitState.java +28 -0
- data/src/org/jbox2d/dynamics/joints/MotorJoint.java +339 -0
- data/src/org/jbox2d/dynamics/joints/MotorJointDef.java +55 -0
- data/src/org/jbox2d/dynamics/joints/MouseJoint.java +262 -0
- data/src/org/jbox2d/dynamics/joints/MouseJointDef.java +62 -0
- data/src/org/jbox2d/dynamics/joints/PrismaticJoint.java +808 -0
- data/src/org/jbox2d/dynamics/joints/PrismaticJointDef.java +120 -0
- data/src/org/jbox2d/dynamics/joints/PulleyJoint.java +393 -0
- data/src/org/jbox2d/dynamics/joints/PulleyJointDef.java +105 -0
- data/src/org/jbox2d/dynamics/joints/RevoluteJoint.java +554 -0
- data/src/org/jbox2d/dynamics/joints/RevoluteJointDef.java +137 -0
- data/src/org/jbox2d/dynamics/joints/RopeJoint.java +276 -0
- data/src/org/jbox2d/dynamics/joints/RopeJointDef.java +34 -0
- data/src/org/jbox2d/dynamics/joints/WeldJoint.java +424 -0
- data/src/org/jbox2d/dynamics/joints/WeldJointDef.java +85 -0
- data/src/org/jbox2d/dynamics/joints/WheelJoint.java +498 -0
- data/src/org/jbox2d/dynamics/joints/WheelJointDef.java +98 -0
- data/src/org/jbox2d/particle/ParticleBodyContact.java +17 -0
- data/src/org/jbox2d/particle/ParticleColor.java +52 -0
- data/src/org/jbox2d/particle/ParticleContact.java +14 -0
- data/src/org/jbox2d/particle/ParticleDef.java +24 -0
- data/src/org/jbox2d/particle/ParticleGroup.java +154 -0
- data/src/org/jbox2d/particle/ParticleGroupDef.java +62 -0
- data/src/org/jbox2d/particle/ParticleGroupType.java +8 -0
- data/src/org/jbox2d/particle/ParticleSystem.java +2172 -0
- data/src/org/jbox2d/particle/ParticleType.java +28 -0
- data/src/org/jbox2d/particle/StackQueue.java +44 -0
- data/src/org/jbox2d/particle/VoronoiDiagram.java +209 -0
- data/src/org/jbox2d/pooling/IDynamicStack.java +47 -0
- data/src/org/jbox2d/pooling/IOrderedStack.java +57 -0
- data/src/org/jbox2d/pooling/IWorldPool.java +101 -0
- data/src/org/jbox2d/pooling/arrays/FloatArray.java +50 -0
- data/src/org/jbox2d/pooling/arrays/GeneratorArray.java +33 -0
- data/src/org/jbox2d/pooling/arrays/IntArray.java +53 -0
- data/src/org/jbox2d/pooling/arrays/Vec2Array.java +57 -0
- data/src/org/jbox2d/pooling/normal/CircleStack.java +77 -0
- data/src/org/jbox2d/pooling/normal/DefaultWorldPool.java +331 -0
- data/src/org/jbox2d/pooling/normal/MutableStack.java +72 -0
- data/src/org/jbox2d/pooling/normal/OrderedStack.java +73 -0
- data/src/org/jbox2d/pooling/stacks/DynamicIntStack.java +60 -0
- metadata +161 -14
- data/lib/jbox2d-library-2.3.1-SNAPSHOT.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e69111dc2c65e4a119363da0d977e4f741cbdfad
|
4
|
+
data.tar.gz: 11341dad291d2c0626f79e89fcb810e4a2dbf800
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 621cf6a8ccb688ce6a591504bf4522753d89e882c4563da3cf68ac6c872f1a017c05d1d29e8e1d9702fcdd2e5217d4ec5babcddfa6b2f8024885dc4e53a2c9b7
|
7
|
+
data.tar.gz: fce9e4cf698ceec4544ab2793b1f092f0390665fd5edc9f03edb73e66396edc43b6c5e3d2b769e1fa38c6b5dd495e3a53f6b90c532ed0be943248bb66025bfe2
|
data/.mvn/extensions.xml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.3/apache-maven-3.3.3-bin.zip
|
data/.travis.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
sudo: false
|
2
|
+
|
3
|
+
language: ruby
|
4
|
+
|
5
|
+
bundler_args: --without production
|
6
|
+
|
7
|
+
addons:
|
8
|
+
apt:
|
9
|
+
packages:
|
10
|
+
- oracle-java8-installer
|
11
|
+
|
12
|
+
rvm:
|
13
|
+
- jruby-head
|
14
|
+
|
15
|
+
jdk:
|
16
|
+
- oraclejdk8
|
17
|
+
|
18
|
+
env:
|
19
|
+
- JRUBY_OPTS="$JRUBY_OPTS" JAVA_OPTS="-Djruby.version=$JRUBY_VERSION"
|
20
|
+
|
21
|
+
before_script:
|
22
|
+
- export JRUBY_OPTS="-Xcext.enabled=false -Xcompile.invokedynamic=false"
|
23
|
+
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
### v0.8.0
|
2
|
+
|
3
|
+
Update for JRubyArt-1.1+ and processing-3.1+
|
4
|
+
|
5
|
+
### v0.7.0
|
6
|
+
|
7
|
+
A strike for independence, now building from source using polyglot maven
|
8
|
+
|
1
9
|
### v0.6.0
|
2
10
|
|
3
11
|
Added import for jbox2d Particle, ParticleGroup etc (see PB module). Introduced WorldBuilder module to get rid of boilerplate code for the user. Reworked examples to use a common Boundary class.
|
data/README.md
CHANGED
@@ -30,7 +30,7 @@ Copyright (c) 2014 Daniel Shiffman
|
|
30
30
|
|
31
31
|
This gem was created by Martin Prout
|
32
32
|
|
33
|
-
Copyright (c) 2015 Martin Prout
|
33
|
+
Copyright (c) 2015/16 Martin Prout
|
34
34
|
|
35
35
|
### To compile
|
36
36
|
|
@@ -44,11 +44,11 @@ Like really easy, but if you have to use rvm or rbenv you will also know what to
|
|
44
44
|
|
45
45
|
You need to `require 'pbox2d'` in the the usual way (to require a gem). Now you should create a new instance of Box2D. However as in this included [example][] you may also need to `include ContactListener` interface (by [jruby magic][], including the interface as a module implements the java interface) if you wish to create your own jbox2d listener.
|
46
46
|
```ruby
|
47
|
-
|
48
|
-
|
49
|
-
box2d.
|
47
|
+
# Since version 0.6.0, use the WorldBuilder factory module (avoids boiler-plate code)
|
48
|
+
# Only app is required there, default gravity is [0, -10], defaults to warm start
|
49
|
+
@box2d = WorldBuilder.build(app: self, gravity: [0, -20])
|
50
50
|
```
|
51
|
-
That's about all you need to know, to use the box2d instance to access the jbox2d physics world. Since version 0.
|
51
|
+
That's about all you need to know, to use the box2d instance to access the jbox2d physics world. Since version 0.6.0 runtime options `scale`, `gravity`, `warm_start`, and `continous_physics` options can be set using the keyword args see above (if unset sensible defaults are used). The `step_options` are set in the same way, but default options are often suitable. NB: You do not need to call `box2d.step` in the draw loop, to update the physics world, because we do that for you under the hood (using java reflection arghhh.....).
|
52
52
|
The other thing you should know is there is a mismatch between the physics world and the sketch world (processing got it wrong to my view, down is up), further the scaling is different. This is why you need to keep translating from one worlds (coordinates system) to the others coordinates (system), Dan Shiffman explains it in his [Nature of Code book][], Chapter 5 physics libraries, not that I've read it, I prefer to read code or [Sandi Metz][]. The really brave or adventurous should probably get [this book].
|
53
53
|
|
54
54
|
[JBox2D Home]:http://www.jbox2d.org/
|
@@ -60,6 +60,6 @@ The other thing you should know is there is a mismatch between the physics world
|
|
60
60
|
[Nature of Code book]:http://natureofcode.com/
|
61
61
|
[Sandi Metz]:http://www.poodr.com/
|
62
62
|
[this book]:http://www.crcpress.com/product/isbn/9781466565760
|
63
|
-
[zip]:https://github.com/ruby-processing/jbox2d/archive/0.
|
64
|
-
[tar]:https://github.com/ruby-processing/jbox2d/archive/0.
|
63
|
+
[zip]:https://github.com/ruby-processing/jbox2d/archive/0.6.0.zip
|
64
|
+
[tar]:https://github.com/ruby-processing/jbox2d/archive/0.6.0.tar.gz
|
65
65
|
[Wiki]:https://github.com/ruby-processing/jbox2d/wiki
|
data/Rakefile
CHANGED
@@ -25,13 +25,12 @@ end
|
|
25
25
|
desc 'Compile'
|
26
26
|
task :compile do
|
27
27
|
sh "mvn package"
|
28
|
-
sh "cp ${HOME}/jbox2d/jbox2d-library/target/jbox2d-library-2.3.1-SNAPSHOT.jar lib"
|
29
28
|
sh "mv target/box2d.jar lib"
|
30
29
|
end
|
31
30
|
|
32
31
|
desc 'Build Gem'
|
33
32
|
task :gem do
|
34
|
-
|
33
|
+
sh "gem build pbox2d.gemspec"
|
35
34
|
end
|
36
35
|
|
37
36
|
Rake::TestTask.new do |t|
|
data/lib/box2d.jar
CHANGED
Binary file
|
data/lib/pbox2d/version.rb
CHANGED
data/lib/pbox2d.rb
CHANGED
@@ -5,6 +5,7 @@ Dir[File.join(working_directory, '*.jar')].each do |jar|
|
|
5
5
|
end
|
6
6
|
|
7
7
|
ContactListener = Java::OrgJbox2dCallbacks::ContactListener
|
8
|
+
ContactAdaptor = Java::OrgJbox2dCallbacks::ContactAdaptor
|
8
9
|
|
9
10
|
def import_class_list(list, string)
|
10
11
|
list.each { |d| java_import format(string, d) }
|
data/pbox2d.gemspec
CHANGED
@@ -10,24 +10,19 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.has_rdoc = true
|
11
11
|
spec.extra_rdoc_files = ['README.md', 'LICENSE.md']
|
12
12
|
spec.authors = ['Martin Prout']
|
13
|
-
spec.email = ['
|
13
|
+
spec.email = ['mamba2928@yahoo.co.uk']
|
14
14
|
spec.summary = %q{jbox2d wrapped in a gem for JRubyArt}
|
15
15
|
spec.description = <<-EOF
|
16
|
-
"An exemplar for
|
17
|
-
in JRubyArt.
|
18
|
-
|
16
|
+
"An exemplar for making processing/java libraries available as a gem, for use
|
17
|
+
in JRubyArt. Features a polyglot maven build, and also demonstrates how creating
|
18
|
+
an interface can avoid the need for explicit calls to java reflection."
|
19
19
|
EOF
|
20
20
|
spec.homepage = 'https://github.com/ruby-processing/jbox2d'
|
21
21
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
22
|
spec.files << 'lib/box2d.jar'
|
23
|
-
spec.files << 'lib/jbox2d-library-2.3.1-SNAPSHOT.jar'
|
24
23
|
spec.require_paths = ['lib']
|
25
|
-
spec.add_dependency 'jruby_art', '~> 1.
|
26
|
-
spec.add_development_dependency "rake", "~>
|
24
|
+
spec.add_dependency 'jruby_art', '~> 1.1', '>= 1.1.1'
|
25
|
+
spec.add_development_dependency "rake", "~> 11.1"
|
27
26
|
spec.add_development_dependency "minitest", "~> 5.8"
|
28
27
|
spec.platform='java'
|
29
|
-
# spec.requirements << 'A decent graphics card'
|
30
|
-
# spec.requirements << 'java runtime >= 1.8+'
|
31
|
-
# spec.requirements << 'processing = 3.0.1+'
|
32
|
-
spec.requirements << 'maven = 3.3.3'
|
33
28
|
end
|
data/pom.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
project 'pbox2d', 'https://github.com/ruby-processing/jbox2d' do
|
3
|
+
|
4
|
+
model_version '4.0.0'
|
5
|
+
id 'ruby-processing:pbox2d', '0.8'
|
6
|
+
packaging 'jar'
|
7
|
+
|
8
|
+
description 'jbox2d for JRubyArt'
|
9
|
+
|
10
|
+
organization 'ruby-processing', 'https://ruby-processing.github.io'
|
11
|
+
|
12
|
+
developer 'monkstone' do
|
13
|
+
name 'Martin Prout'
|
14
|
+
email 'martin_p@lineone.net'
|
15
|
+
roles 'developer'
|
16
|
+
end
|
17
|
+
|
18
|
+
license 'BSD-2-clause', 'http://www.opensource.org/licenses/bsd-license.php'
|
19
|
+
|
20
|
+
issue_management 'https://github.com/ruby-processing/jbox2d/issues', 'Github'
|
21
|
+
|
22
|
+
source_control(
|
23
|
+
:url => 'https://github.com/ruby-processing/jbox2d',
|
24
|
+
:connection => 'scm:git:git://github.com/ruby-processing/jbox2d.git',
|
25
|
+
:developer_connection => 'scm:git:git@github.com/ruby-processing/jbox2dt.git'
|
26
|
+
)
|
27
|
+
|
28
|
+
properties( 'maven.compiler.source' => '1.8',
|
29
|
+
'project.build.sourceEncoding' => 'UTF-8',
|
30
|
+
'maven.compiler.target' => '1.8',
|
31
|
+
'polyglot.dump.pom' => 'pom.xml',
|
32
|
+
'processing.api' => "http://processing.github.io/processing-javadocs/core/",
|
33
|
+
'jruby.api' => "http://jruby.org/apidocs/"
|
34
|
+
)
|
35
|
+
|
36
|
+
pom 'org.jruby:jruby:9.1.2.0'
|
37
|
+
jar 'org.processing:core:3.1'
|
38
|
+
plugin_management do
|
39
|
+
plugin :resources, '2.6'
|
40
|
+
plugin :dependency, '2.8'
|
41
|
+
plugin( :compiler, '3.3',
|
42
|
+
'source' => '1.8',
|
43
|
+
'target' => '1.8' )
|
44
|
+
plugin( :javadoc, '2.10.3',
|
45
|
+
'detectOfflineLinks' => 'false',
|
46
|
+
'links' => ['${processing.api}', '${jruby.api}']
|
47
|
+
)
|
48
|
+
plugin( :jar, '2.6',
|
49
|
+
'archive' => {
|
50
|
+
'manifestFile' => 'MANIFEST.MF'
|
51
|
+
}
|
52
|
+
)
|
53
|
+
end
|
54
|
+
build do
|
55
|
+
default_goal 'package'
|
56
|
+
source_directory 'src'
|
57
|
+
final_name 'box2d'
|
58
|
+
end
|
59
|
+
end
|
data/pom.xml
CHANGED
@@ -1,104 +1,113 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
|
3
|
-
<modelVersion>4.0.0</modelVersion>
|
4
|
-
<groupId>org.ruby-processing</groupId>
|
5
|
-
<artifactId>box2d</artifactId>
|
6
|
-
<version>0.6.0</version>
|
7
|
-
<packaging>jar</packaging>
|
8
|
-
<description>
|
9
|
-
jbox2d-library for JRubyArt
|
10
|
-
</description>
|
2
|
+
<!--
|
11
3
|
|
12
|
-
<parent>
|
13
|
-
<groupId>org.sonatype.oss</groupId>
|
14
|
-
<artifactId>oss-parent</artifactId>
|
15
|
-
<version>7</version>
|
16
|
-
</parent>
|
17
4
|
|
18
|
-
|
19
|
-
<system>Github</system>
|
20
|
-
<url>https://github.com/ruby-processing/jbox2d/issues</url>
|
21
|
-
</issueManagement>
|
5
|
+
DO NOT MODIFIY - GENERATED CODE
|
22
6
|
|
23
|
-
<scm>
|
24
|
-
<connection>scm:git:git://github.com/ruby-processing/jbox2d.git</connection>
|
25
|
-
<developerConnection>scm:git:git@github.com:ruby-processing/jbox2d.git</developerConnection>
|
26
|
-
<url>https://github.com/ruby-processing/jbox2d</url>
|
27
|
-
</scm>
|
28
7
|
|
8
|
+
-->
|
9
|
+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
10
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
11
|
+
<modelVersion>4.0.0</modelVersion>
|
12
|
+
<groupId>ruby-processing</groupId>
|
13
|
+
<artifactId>pbox2d</artifactId>
|
14
|
+
<version>0.8</version>
|
15
|
+
<name>pbox2d</name>
|
16
|
+
<description>jbox2d for JRubyArt</description>
|
17
|
+
<url>https://github.com/ruby-processing/jbox2d</url>
|
18
|
+
<organization>
|
19
|
+
<name>ruby-processing</name>
|
20
|
+
<url>https://ruby-processing.github.io</url>
|
21
|
+
</organization>
|
29
22
|
<licenses>
|
30
23
|
<license>
|
31
24
|
<name>BSD-2-clause</name>
|
32
25
|
<url>http://www.opensource.org/licenses/bsd-license.php</url>
|
33
26
|
</license>
|
34
27
|
</licenses>
|
35
|
-
|
36
28
|
<developers>
|
37
29
|
<developer>
|
38
30
|
<id>monkstone</id>
|
39
31
|
<name>Martin Prout</name>
|
40
32
|
<email>martin_p@lineone.net</email>
|
33
|
+
<roles>
|
34
|
+
<role>developer</role>
|
35
|
+
</roles>
|
41
36
|
</developer>
|
42
37
|
</developers>
|
43
|
-
|
38
|
+
<scm>
|
39
|
+
<connection>scm:git:git://github.com/ruby-processing/jbox2d.git</connection>
|
40
|
+
<developerConnection>scm:git:git@github.com/ruby-processing/jbox2dt.git</developerConnection>
|
41
|
+
<url>https://github.com/ruby-processing/jbox2d</url>
|
42
|
+
</scm>
|
43
|
+
<issueManagement>
|
44
|
+
<system>Github</system>
|
45
|
+
<url>https://github.com/ruby-processing/jbox2d/issues</url>
|
46
|
+
</issueManagement>
|
47
|
+
<properties>
|
48
|
+
<processing.api>http://processing.github.io/processing-javadocs/core/</processing.api>
|
49
|
+
<polyglot.dump.pom>pom.xml</polyglot.dump.pom>
|
50
|
+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
51
|
+
<maven.compiler.source>1.8</maven.compiler.source>
|
52
|
+
<jruby.api>http://jruby.org/apidocs/</jruby.api>
|
53
|
+
<maven.compiler.target>1.8</maven.compiler.target>
|
54
|
+
</properties>
|
44
55
|
<dependencies>
|
45
56
|
<dependency>
|
46
|
-
<groupId>org.
|
47
|
-
<artifactId>
|
48
|
-
<version>2.
|
49
|
-
<
|
50
|
-
<systemPath>${jbox2d.home}/jbox2d-library-2.3.1-SNAPSHOT.jar</systemPath>
|
57
|
+
<groupId>org.jruby</groupId>
|
58
|
+
<artifactId>jruby</artifactId>
|
59
|
+
<version>9.1.2.0</version>
|
60
|
+
<type>pom</type>
|
51
61
|
</dependency>
|
52
62
|
<dependency>
|
53
63
|
<groupId>org.processing</groupId>
|
54
64
|
<artifactId>core</artifactId>
|
55
|
-
<
|
56
|
-
<version>3.0.1</version>
|
57
|
-
<systemPath>${processing.home}/core/library/core.jar</systemPath>
|
65
|
+
<version>3.1</version>
|
58
66
|
</dependency>
|
59
67
|
</dependencies>
|
60
|
-
<properties>
|
61
|
-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
62
|
-
<maven.compiler.source>1.8</maven.compiler.source>
|
63
|
-
<maven.compiler.target>1.8</maven.compiler.target>
|
64
|
-
<!-- for Mac developers, non Archlinux and Windows can probably figure it out
|
65
|
-
<processing.home>/Applications/Processing.app/Contents/Java</processing.home>
|
66
|
-
-->
|
67
|
-
<processing.home>/usr/share/processing</processing.home>
|
68
|
-
<jbox2d.home>${user.home}/jbox2d/jbox2d-library/target</jbox2d.home>
|
69
|
-
</properties>
|
70
68
|
<build>
|
71
69
|
<sourceDirectory>src</sourceDirectory>
|
70
|
+
<defaultGoal>package</defaultGoal>
|
72
71
|
<finalName>box2d</finalName>
|
73
|
-
<
|
74
|
-
<
|
75
|
-
<
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
<
|
84
|
-
|
85
|
-
<
|
86
|
-
<
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
<
|
92
|
-
|
93
|
-
<
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
72
|
+
<pluginManagement>
|
73
|
+
<plugins>
|
74
|
+
<plugin>
|
75
|
+
<artifactId>maven-resources-plugin</artifactId>
|
76
|
+
<version>2.6</version>
|
77
|
+
</plugin>
|
78
|
+
<plugin>
|
79
|
+
<artifactId>maven-dependency-plugin</artifactId>
|
80
|
+
<version>2.8</version>
|
81
|
+
</plugin>
|
82
|
+
<plugin>
|
83
|
+
<artifactId>maven-compiler-plugin</artifactId>
|
84
|
+
<version>3.3</version>
|
85
|
+
<configuration>
|
86
|
+
<source>1.8</source>
|
87
|
+
<target>1.8</target>
|
88
|
+
</configuration>
|
89
|
+
</plugin>
|
90
|
+
<plugin>
|
91
|
+
<artifactId>maven-javadoc-plugin</artifactId>
|
92
|
+
<version>2.10.3</version>
|
93
|
+
<configuration>
|
94
|
+
<detectOfflineLinks>false</detectOfflineLinks>
|
95
|
+
<links>
|
96
|
+
<link>${processing.api}</link>
|
97
|
+
<link>${jruby.api}</link>
|
98
|
+
</links>
|
99
|
+
</configuration>
|
100
|
+
</plugin>
|
101
|
+
<plugin>
|
102
|
+
<artifactId>maven-jar-plugin</artifactId>
|
103
|
+
<version>2.6</version>
|
104
|
+
<configuration>
|
105
|
+
<archive>
|
106
|
+
<manifestFile>MANIFEST.MF</manifestFile>
|
107
|
+
</archive>
|
108
|
+
</configuration>
|
109
|
+
</plugin>
|
110
|
+
</plugins>
|
111
|
+
</pluginManagement>
|
103
112
|
</build>
|
104
113
|
</project>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.2.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.2.0/distro-source/core/src/gwt-module.dtd">
|
3
|
+
<module>
|
4
|
+
<inherits name="com.google.gwt.user.User" />
|
5
|
+
<source path="callbacks"/>
|
6
|
+
<source path="collision"/>
|
7
|
+
<source path="common"/>
|
8
|
+
<source path="dynamics"/>
|
9
|
+
<source path="pooling"/>
|
10
|
+
|
11
|
+
<super-source path="gwtemul" />
|
12
|
+
</module>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/**
|
2
|
+
* Reduce typing by using ContactAdaptor rather than ContactListener
|
3
|
+
* @author Martin Prout
|
4
|
+
*/
|
5
|
+
package org.jbox2d.callbacks;
|
6
|
+
|
7
|
+
import org.jbox2d.collision.Manifold;
|
8
|
+
import org.jbox2d.dynamics.contacts.Contact;
|
9
|
+
|
10
|
+
public abstract class ContactAdaptor implements ContactListener {
|
11
|
+
|
12
|
+
@Override
|
13
|
+
public void beginContact(Contact cntct) {
|
14
|
+
}
|
15
|
+
|
16
|
+
@Override
|
17
|
+
public void endContact(Contact cntct) {
|
18
|
+
}
|
19
|
+
|
20
|
+
@Override
|
21
|
+
public void preSolve(Contact cntct, Manifold mnfld) {
|
22
|
+
}
|
23
|
+
|
24
|
+
@Override
|
25
|
+
public void postSolve(Contact cntct, ContactImpulse ci) {
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
/*******************************************************************************
|
2
|
+
* Copyright (c) 2013, Daniel Murphy
|
3
|
+
* All rights reserved.
|
4
|
+
*
|
5
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
6
|
+
* are permitted provided that the following conditions are met:
|
7
|
+
* * Redistributions of source code must retain the above copyright notice,
|
8
|
+
* this list of conditions and the following disclaimer.
|
9
|
+
* * Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
* this list of conditions and the following disclaimer in the documentation
|
11
|
+
* and/or other materials provided with the distribution.
|
12
|
+
*
|
13
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
14
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
15
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
16
|
+
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
17
|
+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
18
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
19
|
+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
20
|
+
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
21
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22
|
+
* POSSIBILITY OF SUCH DAMAGE.
|
23
|
+
******************************************************************************/
|
24
|
+
/**
|
25
|
+
* Created at 4:25:42 AM Jul 15, 2010
|
26
|
+
*/
|
27
|
+
package org.jbox2d.callbacks;
|
28
|
+
|
29
|
+
import org.jbox2d.dynamics.Filter;
|
30
|
+
import org.jbox2d.dynamics.Fixture;
|
31
|
+
|
32
|
+
// updated to rev 100
|
33
|
+
/**
|
34
|
+
* Implement this class to provide collision filtering. In other words, you can implement
|
35
|
+
* this class if you want finer control over contact creation.
|
36
|
+
* @author Daniel Murphy
|
37
|
+
*/
|
38
|
+
public class ContactFilter {
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Return true if contact calculations should be performed between these two shapes.
|
42
|
+
* @warning for performance reasons this is only called when the AABBs begin to overlap.
|
43
|
+
* @param fixtureA
|
44
|
+
* @param fixtureB
|
45
|
+
* @return
|
46
|
+
*/
|
47
|
+
public boolean shouldCollide(Fixture fixtureA, Fixture fixtureB){
|
48
|
+
Filter filterA = fixtureA.getFilterData();
|
49
|
+
Filter filterB = fixtureB.getFilterData();
|
50
|
+
|
51
|
+
if (filterA.groupIndex == filterB.groupIndex && filterA.groupIndex != 0){
|
52
|
+
return filterA.groupIndex > 0;
|
53
|
+
}
|
54
|
+
|
55
|
+
boolean collide = (filterA.maskBits & filterB.categoryBits) != 0 &&
|
56
|
+
(filterA.categoryBits & filterB.maskBits) != 0;
|
57
|
+
return collide;
|
58
|
+
}
|
59
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/*******************************************************************************
|
2
|
+
* Copyright (c) 2013, Daniel Murphy
|
3
|
+
* All rights reserved.
|
4
|
+
*
|
5
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
6
|
+
* are permitted provided that the following conditions are met:
|
7
|
+
* * Redistributions of source code must retain the above copyright notice,
|
8
|
+
* this list of conditions and the following disclaimer.
|
9
|
+
* * Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
* this list of conditions and the following disclaimer in the documentation
|
11
|
+
* and/or other materials provided with the distribution.
|
12
|
+
*
|
13
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
14
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
15
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
16
|
+
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
17
|
+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
18
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
19
|
+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
20
|
+
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
21
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22
|
+
* POSSIBILITY OF SUCH DAMAGE.
|
23
|
+
******************************************************************************/
|
24
|
+
/**
|
25
|
+
* Created at 3:43:53 AM Jul 7, 2010
|
26
|
+
*/
|
27
|
+
package org.jbox2d.callbacks;
|
28
|
+
|
29
|
+
import org.jbox2d.common.Settings;
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Contact impulses for reporting. Impulses are used instead of forces because sub-step forces may
|
33
|
+
* approach infinity for rigid body collisions. These match up one-to-one with the contact points in
|
34
|
+
* b2Manifold.
|
35
|
+
*
|
36
|
+
* @author Daniel Murphy
|
37
|
+
*/
|
38
|
+
public class ContactImpulse {
|
39
|
+
public float[] normalImpulses = new float[Settings.maxManifoldPoints];
|
40
|
+
public float[] tangentImpulses = new float[Settings.maxManifoldPoints];
|
41
|
+
public int count;
|
42
|
+
}
|
@@ -0,0 +1,87 @@
|
|
1
|
+
/*******************************************************************************
|
2
|
+
* Copyright (c) 2013, Daniel Murphy
|
3
|
+
* All rights reserved.
|
4
|
+
*
|
5
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
6
|
+
* are permitted provided that the following conditions are met:
|
7
|
+
* * Redistributions of source code must retain the above copyright notice,
|
8
|
+
* this list of conditions and the following disclaimer.
|
9
|
+
* * Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
* this list of conditions and the following disclaimer in the documentation
|
11
|
+
* and/or other materials provided with the distribution.
|
12
|
+
*
|
13
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
14
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
15
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
16
|
+
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
17
|
+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
18
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
19
|
+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
20
|
+
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
21
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
22
|
+
* POSSIBILITY OF SUCH DAMAGE.
|
23
|
+
******************************************************************************/
|
24
|
+
package org.jbox2d.callbacks;
|
25
|
+
|
26
|
+
import org.jbox2d.collision.Manifold;
|
27
|
+
import org.jbox2d.dynamics.contacts.Contact;
|
28
|
+
|
29
|
+
// updated to rev 100
|
30
|
+
/**
|
31
|
+
* Implement this class to get contact information. You can use these results for
|
32
|
+
* things like sounds and game logic. You can also get contact results by
|
33
|
+
* traversing the contact lists after the time step. However, you might miss
|
34
|
+
* some contacts because continuous physics leads to sub-stepping.
|
35
|
+
* Additionally you may receive multiple callbacks for the same contact in a
|
36
|
+
* single time step.
|
37
|
+
* You should strive to make your callbacks efficient because there may be
|
38
|
+
* many callbacks per time step.
|
39
|
+
* @warning You cannot create/destroy Box2D entities inside these callbacks.
|
40
|
+
* @author Daniel Murphy
|
41
|
+
*
|
42
|
+
*/
|
43
|
+
public interface ContactListener {
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Called when two fixtures begin to touch.
|
47
|
+
* @param contact
|
48
|
+
*/
|
49
|
+
public void beginContact(Contact contact);
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Called when two fixtures cease to touch.
|
53
|
+
* @param contact
|
54
|
+
*/
|
55
|
+
public void endContact(Contact contact);
|
56
|
+
|
57
|
+
/**
|
58
|
+
* This is called after a contact is updated. This allows you to inspect a
|
59
|
+
* contact before it goes to the solver. If you are careful, you can modify the
|
60
|
+
* contact manifold (e.g. disable contact).
|
61
|
+
* A copy of the old manifold is provided so that you can detect changes.
|
62
|
+
* Note: this is called only for awake bodies.
|
63
|
+
* Note: this is called even when the number of contact points is zero.
|
64
|
+
* Note: this is not called for sensors.
|
65
|
+
* Note: if you set the number of contact points to zero, you will not
|
66
|
+
* get an EndContact callback. However, you may get a BeginContact callback
|
67
|
+
* the next step.
|
68
|
+
* Note: the oldManifold parameter is pooled, so it will be the same object for every callback
|
69
|
+
* for each thread.
|
70
|
+
* @param contact
|
71
|
+
* @param oldManifold
|
72
|
+
*/
|
73
|
+
public void preSolve(Contact contact, Manifold oldManifold);
|
74
|
+
|
75
|
+
/**
|
76
|
+
* This lets you inspect a contact after the solver is finished. This is useful
|
77
|
+
* for inspecting impulses.
|
78
|
+
* Note: the contact manifold does not include time of impact impulses, which can be
|
79
|
+
* arbitrarily large if the sub-step is small. Hence the impulse is provided explicitly
|
80
|
+
* in a separate data structure.
|
81
|
+
* Note: this is only called for contacts that are touching, solid, and awake.
|
82
|
+
* @param contact
|
83
|
+
* @param impulse this is usually a pooled variable, so it will be modified after
|
84
|
+
* this call
|
85
|
+
*/
|
86
|
+
public void postSolve(Contact contact, ContactImpulse impulse);
|
87
|
+
}
|