pbox2d 1.0.1-java → 1.0.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/_methods/init_options.md +2 -0
- data/docs/_methods/processing_to_world.md +2 -0
- data/docs/_methods/scale_to_processing.md +2 -0
- data/docs/_methods/world_to_processing.md +2 -0
- data/docs/_posts/2016-10-14-welcome.md +5 -1
- data/lib/pbox2d.rb +9 -7
- data/lib/pbox2d/box2d.rb +3 -2
- data/lib/pbox2d/version.rb +3 -1
- data/pom.rb +5 -5
- data/pom.xml +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f0fe7549b5a2632e7242a0d5af21af60cbce45a
|
4
|
+
data.tar.gz: 4f51e778bcd50952b828507cca39049bfbc0c8ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a238b680e9d89bc0d2d6fd90b566bdda28b2f7683a7d4bbaed0229a5ee9d5a41c1a804a5438acad797f4cfa8a4a5538c2ed93b232e7131feab70c34d5d12052a
|
7
|
+
data.tar.gz: b3c20d0b7582ef055000c833c6cc889dfd3a0be1f4968fe71a1745bb0a0d38efb866c413101f5d16acecb81a0c8a9632ef149fa0a8e33bcd48ab3dd5fa2d4d72
|
@@ -6,6 +6,7 @@ permalink: /methods/init_options/
|
|
6
6
|
|
7
7
|
### init_options method ###
|
8
8
|
Need not called directly if using [WorldBuilder][world_builder]
|
9
|
+
|
9
10
|
```ruby
|
10
11
|
def init_options(args = {})
|
11
12
|
args = defaults.merge(args)
|
@@ -19,6 +20,7 @@ end
|
|
19
20
|
|
20
21
|
### related default options ###
|
21
22
|
Provides defaults for init_options
|
23
|
+
|
22
24
|
```ruby
|
23
25
|
def defaults
|
24
26
|
{ scale: 10.0, gravity: [0, -10], warm: true, continuous: true }
|
@@ -10,6 +10,7 @@ Because of the peculiar choice by the processing guys down is up (dimensions in
|
|
10
10
|
|
11
11
|
The java code ([PBox2D][pbox2d] inherits this from [Box2DProcessing][pbox2d])
|
12
12
|
### public Vec2 processingToWorld(float worldX, float worldY) ###
|
13
|
+
|
13
14
|
```java
|
14
15
|
public Vec2 processingToWorld(float pixelX, float pixelY) {
|
15
16
|
float worldX = map(pixelX, parent.width / 2, parent.width / 2 + scaleFactor, 0f, 1f);
|
@@ -20,6 +21,7 @@ public Vec2 processingToWorld(float pixelX, float pixelY) {
|
|
20
21
|
|
21
22
|
### Ruby usage ###
|
22
23
|
Use camel case
|
24
|
+
|
23
25
|
```ruby
|
24
26
|
processing_to_world(x, y) # returns new Vec2 instance (in the PBox2D world)
|
25
27
|
```
|
@@ -7,6 +7,7 @@ From sketch to physics world and vice versa
|
|
7
7
|
|
8
8
|
The java code ([PBox2D][pbox2d] inherits this from [Box2DProcessing][pbox2d])
|
9
9
|
### public float scaleToProcessing(float val) ###
|
10
|
+
|
10
11
|
```java
|
11
12
|
public float scaleToProcessing(float val) {
|
12
13
|
return val * scaleFactor;
|
@@ -15,6 +16,7 @@ public float scaleToProcessing(float val) {
|
|
15
16
|
|
16
17
|
### Ruby usage ###
|
17
18
|
Use camel case
|
19
|
+
|
18
20
|
```ruby
|
19
21
|
scale_to_processing(val)
|
20
22
|
```
|
@@ -11,6 +11,7 @@ Because of the peculiar choice by the processing guys down is up (dimensions in
|
|
11
11
|
|
12
12
|
The java code ([PBox2D][pbox2d] inherits this from [Box2DProcessing][pbox2d])
|
13
13
|
### public Vec2 worldToProcessing(float worldX, float worldY) ###
|
14
|
+
|
14
15
|
```java
|
15
16
|
public Vec2 worldToProcessing(float worldX, float worldY) {
|
16
17
|
float pixelX = map(worldX, 0f, 1f, parent.width / 2, parent.width / 2 + scaleFactor);
|
@@ -21,6 +22,7 @@ public Vec2 worldToProcessing(float worldX, float worldY) {
|
|
21
22
|
|
22
23
|
### Ruby usage ###
|
23
24
|
Use camel case
|
25
|
+
|
24
26
|
```ruby
|
25
27
|
world_to_processing(x, y) # returns new Vec2 instance (in processing world)
|
26
28
|
```
|
@@ -14,8 +14,12 @@ attr_reader :box2d, :boundaries, :boxes
|
|
14
14
|
```
|
15
15
|
You then need to create an instance of `Box2D` in the setup
|
16
16
|
```ruby
|
17
|
-
def
|
17
|
+
def settings
|
18
18
|
size(400,300)
|
19
|
+
end
|
20
|
+
|
21
|
+
def setup
|
22
|
+
sketch_title 'pbox2d sketch'
|
19
23
|
@box2d = WorldBuilder.build(app: self, gravity: [0, -20])
|
20
24
|
```
|
21
25
|
|
data/lib/pbox2d.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
working_directory = File.join(File.dirname(__FILE__))
|
2
4
|
$LOAD_PATH << working_directory unless $LOAD_PATH.include?(working_directory)
|
3
5
|
Dir[File.join(working_directory, '*.jar')].each do |jar|
|
@@ -11,16 +13,16 @@ def import_class_list(list, string)
|
|
11
13
|
list.each { |d| java_import format(string, d) }
|
12
14
|
end
|
13
15
|
|
14
|
-
common = %w
|
16
|
+
common = %w[Vec2 Transform]
|
15
17
|
common_format = 'org.jbox2d.common.%s'
|
16
18
|
import_class_list(common, common_format)
|
17
|
-
shape = %w
|
19
|
+
shape = %w[PolygonShape CircleShape ChainShape Shape]
|
18
20
|
shape_format = 'org.jbox2d.collision.shapes.%s'
|
19
21
|
import_class_list(shape, shape_format)
|
20
|
-
world = %w
|
22
|
+
world = %w[Body BodyDef BodyType World FixtureDef]
|
21
23
|
world_format = 'org.jbox2d.dynamics.%s'
|
22
24
|
import_class_list(world, world_format)
|
23
|
-
joint = %w
|
25
|
+
joint = %w[
|
24
26
|
Joint
|
25
27
|
JointDef
|
26
28
|
DistanceJointDef
|
@@ -28,13 +30,13 @@ joint = %w(
|
|
28
30
|
RevoluteJointDef
|
29
31
|
MouseJointDef
|
30
32
|
ConstantVolumeJointDef
|
31
|
-
|
33
|
+
]
|
32
34
|
joint_format = 'org.jbox2d.dynamics.joints.%s'
|
33
35
|
import_class_list(joint, joint_format)
|
34
36
|
|
35
37
|
# Import into module namespace to avoid likely clashes
|
36
38
|
module PB
|
37
|
-
particle = %w
|
39
|
+
particle = %w[
|
38
40
|
ParticleColor
|
39
41
|
ParticleContact
|
40
42
|
ParticleGroupDef
|
@@ -46,7 +48,7 @@ module PB
|
|
46
48
|
ParticleSystem
|
47
49
|
StackQueue
|
48
50
|
VoronoiDiagram
|
49
|
-
|
51
|
+
]
|
50
52
|
particle_format = 'org.jbox2d.particle.%s'
|
51
53
|
import_class_list(particle, particle_format)
|
52
54
|
end
|
data/lib/pbox2d/box2d.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'version'
|
2
4
|
# Ruby version of java wrapper allows us to have more
|
3
5
|
# rubified interface, also needed for add_listener
|
@@ -9,8 +11,7 @@ class Box2D < Java::ProcessingBox2d::Box2DProcessing
|
|
9
11
|
set_options(args[:scale],
|
10
12
|
args[:gravity].to_java(Java::float),
|
11
13
|
args[:warm],
|
12
|
-
args[:continuous]
|
13
|
-
)
|
14
|
+
args[:continuous])
|
14
15
|
end
|
15
16
|
|
16
17
|
def step_options(args = {})
|
data/lib/pbox2d/version.rb
CHANGED
data/pom.rb
CHANGED
@@ -2,10 +2,10 @@ require 'fileutils'
|
|
2
2
|
project 'pbox2d', 'https://github.com/ruby-processing/jbox2d' do
|
3
3
|
|
4
4
|
model_version '4.0.0'
|
5
|
-
id 'ruby-processing:pbox2d', '1.0.
|
5
|
+
id 'ruby-processing:pbox2d', '1.0.2'
|
6
6
|
packaging 'jar'
|
7
7
|
|
8
|
-
description 'jbox2d for JRubyArt'
|
8
|
+
description 'jbox2d for JRubyArt and propane'
|
9
9
|
|
10
10
|
organization 'ruby-processing', 'https://ruby-processing.github.io'
|
11
11
|
|
@@ -22,7 +22,7 @@ project 'pbox2d', 'https://github.com/ruby-processing/jbox2d' do
|
|
22
22
|
source_control(
|
23
23
|
:url => 'https://github.com/ruby-processing/jbox2d',
|
24
24
|
:connection => 'scm:git:git://github.com/ruby-processing/jbox2d.git',
|
25
|
-
:developer_connection => 'scm:git:git@github.com/ruby-processing/
|
25
|
+
:developer_connection => 'scm:git:git@github.com/ruby-processing/jbox2d.git'
|
26
26
|
)
|
27
27
|
|
28
28
|
properties( 'maven.compiler.source' => '1.8',
|
@@ -34,8 +34,8 @@ project 'pbox2d', 'https://github.com/ruby-processing/jbox2d' do
|
|
34
34
|
)
|
35
35
|
|
36
36
|
|
37
|
-
pom 'org.jruby:jruby:9.1.
|
38
|
-
jar 'org.processing:core:3.3.
|
37
|
+
pom 'org.jruby:jruby:9.1.12.0'
|
38
|
+
jar 'org.processing:core:3.3.4'
|
39
39
|
|
40
40
|
plugin_management do
|
41
41
|
plugin :resources, '2.6'
|
data/pom.xml
CHANGED
@@ -11,9 +11,9 @@ DO NOT MODIFIY - GENERATED CODE
|
|
11
11
|
<modelVersion>4.0.0</modelVersion>
|
12
12
|
<groupId>ruby-processing</groupId>
|
13
13
|
<artifactId>pbox2d</artifactId>
|
14
|
-
<version>1.0.
|
14
|
+
<version>1.0.2</version>
|
15
15
|
<name>pbox2d</name>
|
16
|
-
<description>jbox2d for JRubyArt</description>
|
16
|
+
<description>jbox2d for JRubyArt and propane</description>
|
17
17
|
<url>https://github.com/ruby-processing/jbox2d</url>
|
18
18
|
<organization>
|
19
19
|
<name>ruby-processing</name>
|
@@ -37,7 +37,7 @@ DO NOT MODIFIY - GENERATED CODE
|
|
37
37
|
</developers>
|
38
38
|
<scm>
|
39
39
|
<connection>scm:git:git://github.com/ruby-processing/jbox2d.git</connection>
|
40
|
-
<developerConnection>scm:git:git@github.com/ruby-processing/
|
40
|
+
<developerConnection>scm:git:git@github.com/ruby-processing/jbox2d.git</developerConnection>
|
41
41
|
<url>https://github.com/ruby-processing/jbox2d</url>
|
42
42
|
</scm>
|
43
43
|
<issueManagement>
|
@@ -56,13 +56,13 @@ DO NOT MODIFIY - GENERATED CODE
|
|
56
56
|
<dependency>
|
57
57
|
<groupId>org.jruby</groupId>
|
58
58
|
<artifactId>jruby</artifactId>
|
59
|
-
<version>9.1.
|
59
|
+
<version>9.1.12.0</version>
|
60
60
|
<type>pom</type>
|
61
61
|
</dependency>
|
62
62
|
<dependency>
|
63
63
|
<groupId>org.processing</groupId>
|
64
64
|
<artifactId>core</artifactId>
|
65
|
-
<version>3.3.
|
65
|
+
<version>3.3.4</version>
|
66
66
|
</dependency>
|
67
67
|
</dependencies>
|
68
68
|
<build>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pbox2d
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Martin Prout
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|