chipmunk_android 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +19 -0
- data/README.md +40 -0
- data/Rakefile +26 -0
- data/lib/chipmunk.java.jar +0 -0
- data/lib/chipmunk.rb +12 -0
- data/lib/chipmunk_android/description.rb +5 -0
- data/lib/chipmunk_android/version.rb +3 -0
- metadata +74 -0
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2012 Garoe Dorta
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
Chipmunk_Android
|
2
|
+
================
|
3
|
+
A [Chipmunk](https://chipmunk-physics.net/) implementation for ruby in Adroid devices.
|
4
|
+
|
5
|
+
Installation
|
6
|
+
-----------
|
7
|
+
|
8
|
+
Install [ruboto](https://github.com/ruboto/ruboto/) and create a project.
|
9
|
+
|
10
|
+
With this installation method you will have a clean enviroment (bundler) to make your gosu games.
|
11
|
+
|
12
|
+
* Create a file named `Gemfile.apk` in your ruboto project and add the lines:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
source "http://rubygems.org"
|
16
|
+
gem 'chipmunk_android'
|
17
|
+
```
|
18
|
+
|
19
|
+
Check gosu_android [examples](https://github.com/neochuky/gosu-android/tree/master/examples) to see how it works.
|
20
|
+
|
21
|
+
Implemented code
|
22
|
+
-------------------
|
23
|
+
* Shapes:
|
24
|
+
* Segment
|
25
|
+
* Only constructor, no collision methods.
|
26
|
+
* Circle
|
27
|
+
* Only constructor, no collision methods.
|
28
|
+
* Poly
|
29
|
+
* Constructor, only for squares.
|
30
|
+
* Collision method with segments.
|
31
|
+
* Body
|
32
|
+
* Constructor
|
33
|
+
* Position changes if velocity is set.
|
34
|
+
* Space
|
35
|
+
* Add/remove bodies/shapes.
|
36
|
+
* add_collision_func with/without arguments.
|
37
|
+
* step method.
|
38
|
+
* Vec2
|
39
|
+
* Constructor
|
40
|
+
* Access methods, since it is in hava use v.set(i) instead of v[i] for array access.
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
CLASSES_DIR = 'pkg/classes'
|
2
|
+
JAVA_SOURCES = 'java/*'
|
3
|
+
|
4
|
+
unless ENV['ANDROID_HOME']
|
5
|
+
begin
|
6
|
+
adb_path = `which adb`
|
7
|
+
ENV['ANDROID_HOME'] = File.dirname(File.dirname(adb_path)) if $? == 0
|
8
|
+
rescue Errno::ENOENT
|
9
|
+
puts "Unable to detect adb location: #$!"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
(puts 'You need to set the ANDROID_HOME environment variable.'; exit 1) unless ENV['ANDROID_HOME']
|
13
|
+
|
14
|
+
directory CLASSES_DIR
|
15
|
+
|
16
|
+
desc 'Generate the chipmunk.java.jar'
|
17
|
+
task :jar => [CLASSES_DIR] + FileList[JAVA_SOURCES] do
|
18
|
+
sh "javac -source 1.6 -target 1.6 -bootclasspath #{ENV['ANDROID_HOME']}/platforms/android-10/android.jar -d #{CLASSES_DIR} #{JAVA_SOURCES}"
|
19
|
+
sh "jar cf lib/chipmunk.java.jar -C #{CLASSES_DIR} chipmunk"
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'Build the gem'
|
23
|
+
task :gem => :jar do
|
24
|
+
sh 'gem build chipmunk_android.gemspec'
|
25
|
+
sh 'mv chipmunk_android-*.gem pkg/'
|
26
|
+
end
|
Binary file
|
data/lib/chipmunk.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
module CP
|
2
|
+
java_import 'chipmunk.java.Shape'
|
3
|
+
java_import 'chipmunk.java.Space'
|
4
|
+
java_import 'chipmunk.java.Vec2'
|
5
|
+
java_import 'chipmunk.java.Body'
|
6
|
+
|
7
|
+
class Shape
|
8
|
+
java_import 'chipmunk.java.Segment'
|
9
|
+
java_import 'chipmunk.java.Poly'
|
10
|
+
java_import 'chipmunk.java.Circle'
|
11
|
+
end
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chipmunk_android
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Garoe Dorta
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2013-04-21 00:00:00 Z
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: |
|
22
|
+
Chipmunk_Android is an implementation for Android devices of the multiplatform Chipmunk library.
|
23
|
+
|
24
|
+
email: neochuki@gmail.com
|
25
|
+
executables: []
|
26
|
+
|
27
|
+
extensions: []
|
28
|
+
|
29
|
+
extra_rdoc_files: []
|
30
|
+
|
31
|
+
files:
|
32
|
+
- LICENSE
|
33
|
+
- README.md
|
34
|
+
- Rakefile
|
35
|
+
- lib/chipmunk.java.jar
|
36
|
+
- lib/chipmunk.rb
|
37
|
+
- lib/chipmunk_android/description.rb
|
38
|
+
- lib/chipmunk_android/version.rb
|
39
|
+
homepage: https://github.com/neochuky/chipmunk_android/
|
40
|
+
licenses:
|
41
|
+
- MIT
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options: []
|
44
|
+
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
none: false
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
hash: 3
|
53
|
+
segments:
|
54
|
+
- 0
|
55
|
+
version: "0"
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 3
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
version: "0"
|
65
|
+
requirements: []
|
66
|
+
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 1.8.15
|
69
|
+
signing_key:
|
70
|
+
specification_version: 3
|
71
|
+
summary: A chipmunk implementation for Android.
|
72
|
+
test_files: []
|
73
|
+
|
74
|
+
has_rdoc:
|