chipmunk 6.1.3.1 → 6.1.3.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ea271adeb0a82c85bff2b1ae8c852d32f60b9b0
4
- data.tar.gz: a84571ad9ddfb386841bedd5e8a681411bdbcb94
3
+ metadata.gz: 658762c6d80f2f00d85ed92489095c61d7469f38
4
+ data.tar.gz: 55c31bae86661838c54086cae9ca0b047a236ce4
5
5
  SHA512:
6
- metadata.gz: 5db240fec94b54de919fe37953a6704863fe7e36dc2b1b1ea4117586c03def3d0c359a2cd7054b3743dd1cf419951b4d597dd09acb6de99166308c826b1ebe88
7
- data.tar.gz: 2031e2684ed15bb857c7d7d6b8cbc433e6baec12e1defb9ba7b09538a1ca097111aa0e30e994eeb93435f4f4427be232dedaf661f34723c7a5a0529190730391
6
+ metadata.gz: 4050138a179b988a9ccc60cf7bf3e6fbb5e5463431787ad2389b444d75c62c82531a29930f7165484c9d53acc23e7b1d754a7f854bffbe2a4a9c01db6a17c189
7
+ data.tar.gz: e895b9101339d74273247efa709bb77e3af8a8db7ba979be71c6c0c72d7760925fd3270ec0d1ef367f83f066c399b930572cad6f9d830d2b3a55f0d2f036f47a
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ /* Copyright (c) 2007 Scott Lembcke
2
+ * Copyright (c) 2010-2011 John Mair
3
+ * Copyright (c) 2010-2011 Beoran (beoran@rubyforge.org)
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in
13
+ * all copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ */
data/README ADDED
@@ -0,0 +1,113 @@
1
+ Ruby Bindings to Chipmunk Physics Version 6.1.3
2
+
3
+ (C) Scott Lembcke, Beoran, John Mair (banisterfiend) and Shawn Anderson (shawn42)
4
+
5
+ IMPORTANT NOTICE:
6
+ This is version 6.1.3.3 of the bindings for MRI Ruby 1.9.x to
7
+ Chipmunk version 6.1.3.
8
+
9
+ (1) 1/10/09 Cross-Platform Gem built by John Mair (banisterfiend)
10
+ * Just go: gem install chipmunk
11
+
12
+ FORUM:
13
+ http://www.slembcke.net/forums
14
+
15
+ CONTACT:
16
+ slembcke@gmail.com (also on Google Talk) for Chipmunk.
17
+ beoran@rubyforge.org for these bindings to Ruby.
18
+
19
+ ABOUT CHIPMUNK:
20
+ Chipmunk is a simple, lightweight and fast 2D rigid body physics library
21
+ written in C by Slembcke. It's licensed under the unrestrictive, OSI approved
22
+ MIT license.
23
+
24
+ ABOUT THESE RUBY BINDINGS:
25
+ Although chipmunk comes with ruby bindings, they are not always up to date
26
+ with regards to the functionality of the C library, and historically, they
27
+ have been incompatible with recent versions of Ruby.
28
+
29
+ Therefore, these bindings are intended to as an enhanced version with more
30
+ features and better compatibility with recent versions of Ruby. They are also
31
+ intended to be an alternative to the chipmunk-ffi bindings when performance
32
+ is of the utmost importance, as it may be for games.
33
+
34
+ The intent is for these bindings to be mostly source code compatible with the
35
+ FFI bindings. Main exceptions are when it did not support the functionality I
36
+ added yet. All this is documented by specs and by the html documentation.
37
+
38
+ If you have any problems with these bindings, please contact the maintainer at
39
+ beoran@rubyforge.org, or report the issue on the issue tracker:
40
+ https://github.com/beoran/chipmunk/issues
41
+
42
+ REQUIREMENTS
43
+ * 1.9.x.
44
+ * rspec for running the specs.
45
+ * rake and rake-compiler for compiling the extension.
46
+
47
+
48
+ INSTALLATION
49
+ Clone this repository and do:
50
+
51
+ rake clean compile
52
+
53
+ There is also a gem available for Linux and OS/X, and a binary gem for Windows,
54
+ which you can try to install with:
55
+
56
+ gem install chipmunk
57
+
58
+ However, due to incompatilties in the latest versions of
59
+ Rake, Rake-Compiler and rubygems, the gem method of installation may fail for
60
+ you. This will be solved when these incompatibilities are solved by these
61
+ upstream tools.
62
+
63
+ These bindings vendor Chipmunk 6.1.3 with a few extra patches, so you don't
64
+ need to have it installed.
65
+
66
+ DOCUMENTATION:
67
+ Full handcrafted documentation based on the C documentation is available at:
68
+ http://beoran.github.com/chipmunk/
69
+
70
+ CHANGES:
71
+ * Bumped to Chipmunk version 6.1.3; dropped 1.8 support
72
+ * Since 5.3.4.4: Vendored chipmunk again, uncleanly. should compile well now.
73
+ * Version 5.3.4.2 and 5.3.4.3 are broken, don't use them.
74
+ * Since 5.3.4.1: Vendored chipmunk again, cleanly. Several bugfixes.
75
+ * Since 5.1.0 : Much more of Chipmunk's functionality is wrapped. Unvendored
76
+ chipmunk. More specs and documentation.
77
+
78
+ VERSIONING POLICY:
79
+ Since 6.1.3.0 these bindings follow the version of chipmunk, followed by an
80
+ extra number for the version of the bindings. All major releases will be
81
+ backwards compatible in their API. The API may be enhanced in minor releases.
82
+
83
+ KNOWN BUGS:
84
+ * There are no bindings to SpaceHash since I think they are not so useful
85
+ anymore since Chipmunk supports BB queries.
86
+ * Some methods may crash with a segentation violation in case they are not
87
+ used correctly, according to the underlying requirements of the C library.
88
+
89
+ CONTRACTING:
90
+ Howling Moon Software (Slembke's company) is available for contracting if you
91
+ want to make the physics in your game really stand out. Feel free to contact
92
+ them through their webpage: http://howlingmoonsoftware.com/contracting.php
93
+
94
+ TODO:
95
+ * Allow several constructors to be more flexible and take nil as a default
96
+ argument.
97
+ * Try to prevent segfauts on incorrect use of certain methods, if possible.
98
+ * Some more specs.
99
+ * Fix the gem when the upstream tools get fixed.
100
+
101
+ INFO FOR MAINTAINERS:
102
+
103
+ (1) 1/10/09 Cross-Platform Gem built by John Mair (banisterfiend)
104
+ * Just go: gem install chipmunk
105
+
106
+ (2) Patched for 1.9.1 by Beoran (beoran@rubyforge.org)
107
+
108
+ (3) How to build the gems? (maintainers only)
109
+ * Install rake-compiler (http://github.com/luislavena/rake-compiler)
110
+ * Install 1.9.1 mingw ruby versions (instructions above)
111
+ * Type: rake cross native gem RUBY_CC_VERSION=1.9.1
112
+ * Upload new gems to rubygems
113
+
@@ -0,0 +1,11 @@
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rubygems'
4
+ require 'rubygems/package_task'
5
+
6
+ CHIPMUNK_VERSION = "6.1.3.3"
7
+ dlext = RbConfig::CONFIG['DLEXT']
8
+
9
+ CLEAN.include("ext/**/*.#{dlext}", "ext/**/.log", "ext/**/.o", "ext/**/*~", "ext/**/*#*", "ext/**/.obj", "ext/**/.def", "ext/**/.pdb")
10
+ CLOBBER.include("**/*.#{dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o", "doc/**")
11
+
@@ -1,30 +1,4 @@
1
1
  require 'mkmf'
2
-
3
- RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
4
-
5
- if ARGV.member?('--help') || ARGV.member?('-?')
6
- puts "ruby extconf.rb:"
7
- puts "Options for the Ruby bindings to Chipmunk: "
8
- puts "--enable-macosx Enables compiling for OS-X."
9
- puts "--enable-64 Enables compiling to 64 bits targets."
10
- puts
11
- exit
12
- end
13
-
14
- dir_config('chipmunk')
15
- have_header('chipmunk.h')
16
-
17
- if enable_config("macosx", false)
18
- # $CFLAGS += ' -arch ppc -arch i386 -arch x86_64'
19
- # $LDFLAGS += ' -arch x86_64 -arch i386 -arch ppc'
20
- # $CFLAGS += ' -arch x86_64 -arch i386'
21
- # $LDFLAGS += ' -arch x86_64 -arch i386'
22
- end
23
-
24
- if enable_config("64", false)
25
- $CFLAGS += ' -m64'
26
- end
27
-
28
- $CFLAGS += ' -std=gnu99 -ffast-math -DNDEBUG '
29
- create_makefile('chipmunk')
2
+ $CFLAGS += ' -std=c99 -ffast-math -DNDEBUG '
3
+ create_makefile('chipmunk/chipmunk')
30
4
 
@@ -412,6 +412,11 @@ rb_cpSegmentShapeSetRadius(VALUE self, VALUE radius) {
412
412
  return self;
413
413
  }
414
414
 
415
+ static VALUE
416
+ rb_cpSegmentShapeSetNeighbors(VALUE self, VALUE prev, VALUE next) {
417
+ cpSegmentShapeSetNeighbors(SHAPE(self), *VGET(prev), *VGET(next));
418
+ return self;
419
+ }
415
420
 
416
421
  static VALUE
417
422
  rb_cpPolyShapeSetVerts(VALUE self, VALUE arr, VALUE offset) {
@@ -530,6 +535,7 @@ Init_cpShape(void) {
530
535
  rb_define_method(c_cpCircleShape, "set_offset!", rb_cpCircleShapeSetOffset, 1);
531
536
  rb_define_method(c_cpSegmentShape, "set_endpoints!", rb_cpSegmentShapeSetEndpoints, 2);
532
537
  rb_define_method(c_cpSegmentShape, "set_radius!", rb_cpSegmentShapeSetRadius, 1);
538
+ rb_define_method(c_cpSegmentShape, "set_neighbors!", rb_cpSegmentShapeSetNeighbors, 2);
533
539
 
534
540
  rb_define_method(c_cpPolyShape, "set_verts!", rb_cpPolyShapeSetVerts, 2);
535
541
 
@@ -0,0 +1,175 @@
1
+ require 'chipmunk/chipmunk'
2
+
3
+ module CP
4
+ VERSION = '6.1.3.3'
5
+ ZERO_VEC_2 = Vec2.new(0,0).freeze
6
+ ALL_ONES = Vec2.new(1,1).freeze
7
+ end
8
+
9
+ # Extra functionality added by Slembkce and Beoran.
10
+
11
+ module CP
12
+ # Chipmunk Object
13
+ # Makes it easier to manage complex objects that reference many primitive
14
+ # Chipmunk objects such as bodies shapes and constraints.
15
+ # New composite objects simply need to include CP::Object and call
16
+ # init_chipmunk_object(*objects) with the composite and primitive Chipmunk
17
+ # objects that make up itself.
18
+ module Object
19
+ # Returns the list of primitive Chipmunk objects (bodies, shapes and
20
+ # constraints that this composite object references directly and indirectly.
21
+ def chipmunk_objects
22
+ if @chipmunk_objects
23
+ return @chipmunk_objects
24
+ else
25
+ raise "This CP::Object (#{self.class}) did not call #init_chipmunk_object."
26
+ end
27
+ end
28
+
29
+ private
30
+ # Should be called during initialization of a CP::Object to set what primitive
31
+ # and composite Chipmunk objects this object references.
32
+ def init_chipmunk_object(*objs)
33
+ bad_objs = objs.reject{|obj| obj.is_a?(CP::Object)}
34
+ unless bad_objs.empty?
35
+ raise(ArgumentError, "The following objects: #{bad_objs.inspect} are not CP::Objects")
36
+ end
37
+ @chipmunk_objects = objs.inject([]){|sum, obj| sum + obj.chipmunk_objects}.uniq
38
+ end
39
+ end
40
+
41
+ class Body
42
+ include CP::Object
43
+
44
+ def chipmunk_objects
45
+ [self]
46
+ end
47
+
48
+ def add_to_space(space)
49
+ space.add_body(self)
50
+ end
51
+
52
+ def remove_from_space(space)
53
+ space.remove_body(self)
54
+ end
55
+
56
+ end
57
+
58
+ module Shape
59
+ include CP::Object
60
+
61
+ def chipmunk_objects
62
+ [self]
63
+ end
64
+
65
+ def add_to_space(space)
66
+ space.add_shape(self)
67
+ end
68
+
69
+ def remove_from_space(space)
70
+ space.remove_shape(self)
71
+ end
72
+ end
73
+
74
+ module Constraint
75
+ include CP::Object
76
+
77
+ def chipmunk_objects
78
+ [self]
79
+ end
80
+
81
+ def add_to_space(space)
82
+ space.add_constraint(self)
83
+ end
84
+
85
+ def remove_from_space(space)
86
+ space.remove_constraint(self)
87
+ end
88
+ end
89
+
90
+ class Space
91
+ def add_object(obj)
92
+ obj.chipmunk_objects.each{|elt| elt.add_to_space(self)}
93
+ end
94
+
95
+ def add_objects(*objs)
96
+ objs.each{|obj| add_object(obj)}
97
+ end
98
+
99
+ def remove_object(obj)
100
+ obj.chipmunk_objects.each{|elt| elt.remove_from_space(self)}
101
+ end
102
+
103
+ def remove_objects(*objs)
104
+ objs.each{|obj| remove_object(obj)}
105
+ end
106
+
107
+ end
108
+
109
+ class Vec2
110
+ ZERO = Vec2.new(0,0).freeze
111
+ end
112
+
113
+ # define the helpers here( easier than in the extension.
114
+ class SegmentQueryInfo
115
+ def hit_point(start, stop)
116
+ return start.lerp(stop, self.t)
117
+ end
118
+
119
+ def hit_dist(start, stop)
120
+ return start.dist(stop) * self.t
121
+ end
122
+ end
123
+
124
+
125
+ end
126
+
127
+
128
+ # Create derived static objects that know to add themselves as static.
129
+ module CP
130
+ class BodyStatic < Body
131
+ def initialize
132
+ super(Float::INFINITY, Float::INFINITY)
133
+ end
134
+
135
+ def chipmunk_objects
136
+ # return [] instead of [self] so the static body will not be added.
137
+ []
138
+ end
139
+ end
140
+
141
+ class StaticBody
142
+ def chipmunk_objects
143
+ # return [] instead of [self] so the static body will not be added.
144
+ []
145
+ end
146
+ end
147
+
148
+ module StaticShape
149
+ include Shape
150
+
151
+ class Circle < Shape::Circle
152
+ include StaticShape
153
+ end
154
+
155
+ class Segment < Shape::Segment
156
+ include StaticShape
157
+ end
158
+
159
+ class Poly < Shape::Poly
160
+ include StaticShape
161
+ end
162
+
163
+ def add_to_space(space)
164
+ space.add_static_shape(self)
165
+ end
166
+
167
+ def remove_from_space(space)
168
+ space.remove_static_shape(self)
169
+ end
170
+ end
171
+ end
172
+
173
+
174
+
175
+
metadata CHANGED
@@ -1,22 +1,25 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chipmunk
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.3.1
4
+ version: 6.1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Lembcke, Beoran, John Mair (banisterfiend), Shawn Anderson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-18 00:00:00.000000000 Z
11
+ date: 2015-01-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: 'Enhanced ruby bindings for the chipmunk 5.3.4 game physics engine. '
13
+ description: 'Enhanced ruby bindings for the chipmunk game physics engine. '
14
14
  email: beoran@rubyforge.org
15
15
  executables: []
16
16
  extensions:
17
17
  - ext/chipmunk/extconf.rb
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - LICENSE
21
+ - README
22
+ - Rakefile
20
23
  - ext/chipmunk/chipmunk.c
21
24
  - ext/chipmunk/chipmunk.h
22
25
  - ext/chipmunk/chipmunk_ffi.h
@@ -82,6 +85,7 @@ files:
82
85
  - ext/chipmunk/rb_cpShape.c
83
86
  - ext/chipmunk/rb_cpSpace.c
84
87
  - ext/chipmunk/rb_cpVect.c
88
+ - lib/chipmunk.rb
85
89
  homepage: https://github.com/beoran/chipmunk
86
90
  licenses:
87
91
  - MIT
@@ -92,12 +96,12 @@ require_paths:
92
96
  - lib
93
97
  required_ruby_version: !ruby/object:Gem::Requirement
94
98
  requirements:
95
- - - '>='
99
+ - - ">="
96
100
  - !ruby/object:Gem::Version
97
101
  version: '0'
98
102
  required_rubygems_version: !ruby/object:Gem::Requirement
99
103
  requirements:
100
- - - '>='
104
+ - - ">="
101
105
  - !ruby/object:Gem::Version
102
106
  version: '0'
103
107
  requirements: []
@@ -105,5 +109,6 @@ rubyforge_project:
105
109
  rubygems_version: 2.2.2
106
110
  signing_key:
107
111
  specification_version: 4
108
- summary: Enhanced ruby bindings for the chipmunk 5.3.4 game physics engine.
112
+ summary: Enhanced ruby bindings for the chipmunk game physics engine.
109
113
  test_files: []
114
+ has_rdoc: