chipmunk 4.1.0-x86-mswin32 → 5.3.4.0-x86-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/{ext/chipmunk/cpCollision.h → LICENSE} +4 -5
  2. data/README +67 -0
  3. data/Rakefile +76 -29
  4. data/ext/chipmunk/extconf.rb +38 -0
  5. data/ext/chipmunk/rb_chipmunk.c +162 -21
  6. data/ext/chipmunk/rb_chipmunk.h +39 -11
  7. data/ext/chipmunk/rb_cpArbiter.c +253 -0
  8. data/ext/chipmunk/rb_cpBB.c +60 -4
  9. data/ext/chipmunk/rb_cpBody.c +282 -17
  10. data/ext/chipmunk/rb_cpConstraint.c +336 -0
  11. data/ext/chipmunk/rb_cpShape.c +145 -4
  12. data/ext/chipmunk/rb_cpSpace.c +438 -57
  13. data/ext/chipmunk/rb_cpVect.c +98 -2
  14. data/lib/1.8/chipmunk.so +0 -0
  15. data/lib/1.9/chipmunk.so +0 -0
  16. data/lib/chipmunk.rb +168 -0
  17. metadata +29 -41
  18. data/ext/chipmunk/chipmunk.c +0 -69
  19. data/ext/chipmunk/chipmunk.h +0 -91
  20. data/ext/chipmunk/cpArbiter.c +0 -263
  21. data/ext/chipmunk/cpArbiter.h +0 -85
  22. data/ext/chipmunk/cpArray.c +0 -114
  23. data/ext/chipmunk/cpArray.h +0 -45
  24. data/ext/chipmunk/cpBB.c +0 -46
  25. data/ext/chipmunk/cpBB.h +0 -53
  26. data/ext/chipmunk/cpBody.c +0 -180
  27. data/ext/chipmunk/cpBody.h +0 -132
  28. data/ext/chipmunk/cpCollision.c +0 -390
  29. data/ext/chipmunk/cpHashSet.c +0 -219
  30. data/ext/chipmunk/cpHashSet.h +0 -79
  31. data/ext/chipmunk/cpJoint.c +0 -553
  32. data/ext/chipmunk/cpJoint.h +0 -122
  33. data/ext/chipmunk/cpPolyShape.c +0 -139
  34. data/ext/chipmunk/cpPolyShape.h +0 -92
  35. data/ext/chipmunk/cpShape.c +0 -244
  36. data/ext/chipmunk/cpShape.h +0 -141
  37. data/ext/chipmunk/cpSpace.c +0 -530
  38. data/ext/chipmunk/cpSpace.h +0 -120
  39. data/ext/chipmunk/cpSpaceHash.c +0 -455
  40. data/ext/chipmunk/cpSpaceHash.h +0 -100
  41. data/ext/chipmunk/cpVect.c +0 -63
  42. data/ext/chipmunk/cpVect.h +0 -106
  43. data/ext/chipmunk/prime.h +0 -68
  44. data/ext/chipmunk/rb_cpJoint.c +0 -136
@@ -1,4 +1,6 @@
1
- /* Copyright (c) 2007 Scott Lembcke
1
+ /* Copyright (c) 2007 Scott Lembcke
2
+ * Copyright (c) 2010-2011 John Mair
3
+ * Copyright (c) 2010-2011 Beoran (beoran@rubyforge.org)
2
4
  *
3
5
  * Permission is hereby granted, free of charge, to any person obtaining a copy
4
6
  * of this software and associated documentation files (the "Software"), to deal
@@ -17,7 +19,4 @@
17
19
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
20
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
21
  * SOFTWARE.
20
- */
21
-
22
- // Collides two cpShape structures. (this function is lonely :( )
23
- int cpCollideShapes(cpShape *a, cpShape *b, cpContact **arr);
22
+ */
data/README ADDED
@@ -0,0 +1,67 @@
1
+ Ruby Bindings to Chipmunk Physics Version 5.3.4
2
+
3
+ (C) Scott Lembcke, Beoran and John Mair (banisterfiend)
4
+
5
+ IMPORTANT NOTICE:
6
+ These are bindings for MRI Ruby 1.8.x and 1.9.x to Chipmunk version 5.3.4
7
+
8
+ (1) 1/10/09 Cross-Platform Gem built by John Mair (banisterfiend)
9
+ * Just go: gem install chipmunk
10
+
11
+ FORUM:
12
+ http://www.slembcke.net/forums
13
+
14
+ CONTACT:
15
+ slembcke@gmail.com (also on Google Talk) for Chipmunk.
16
+ beoran@rubyforge.org for these bindings to Ruby.
17
+
18
+ ABOUT CHIPMUNK:
19
+ Chipmunk is a simple, lightweight and fast 2D rigid body physics library
20
+ written in C by Slembcke. It's licensed under the unrestrictive, OSI approved
21
+ MIT license.
22
+
23
+ ABOUT THESE RUBY BINDINGS:
24
+ Although chipmunk comes with ruby bindings, they are not always up to date
25
+ with regards to the functionality of the C library, and historically, they
26
+ have been incompatible with recent versions of Ruby.
27
+
28
+ Therefore, these bindings are intended to as an enhanced version with more
29
+ features and better compatibility with recent versions of Ruby. They are also
30
+ intended to be an alternative to the chipmunk-ffi bindings when performance
31
+ is of the utmost importance, as it may be for games.
32
+
33
+ The intent is for these bindings to be mostly source code compatible with both
34
+ Slembcke's and ffi's bindings. Main exceptions are where I dislike either API.
35
+ In that case, I made an API that is pleasing to myself, and similar in naming
36
+ to the C API adjusted to ruby conventions. If you have any problems with these bindings, please contact the maintainer at beoran@rubyforge.org.
37
+
38
+ INCOMPATIBILITIES:
39
+ There are no bindings to SpaceHash since I fail to see the use of it, but
40
+ if someone is using them, I'll probably implement them.
41
+
42
+ CONTRACTING:
43
+ Howling Moon Software (Slembke's company) is available for contracting if you
44
+ want to make the physics in your game really stand out. Feel free to contact
45
+ them through their webpage: http://howlingmoonsoftware.com/contracting.php
46
+
47
+ TODO:
48
+ * More functionality.
49
+ * Specs for the new functionality I've wrapped and will wrap.
50
+ * Better documentation, perhaps based on C API documentation.
51
+
52
+
53
+ INFO FOR MAINTAINERS:
54
+
55
+ (1) 1/10/09 Cross-Platform Gem built by John Mair (banisterfiend)
56
+ * Just go: gem install chipmunk
57
+
58
+ (2) Patched for 1.9.1 by Beoran (beoran@rubyforge.org)
59
+
60
+ (3) How to build the gems? (maintainers only)
61
+ * Install rake-compiler (http://github.com/luislavena/rake-compiler)
62
+ * Install 1.9.1 and 1.8.6 mingw ruby versions (instructions above)
63
+ * Type: rake cross native gem RUBY_CC_VERSION=1.8.6:1.9.1
64
+ * Upload new gems to rubyforge and gemcutter.
65
+
66
+
67
+
data/Rakefile CHANGED
@@ -1,38 +1,85 @@
1
1
  # Rakefile added by John Mair (banisterfiend)
2
-
3
- require 'rake/clean'
4
- require 'rake/extensiontask'
2
+
5
3
  require 'rake/gempackagetask'
4
+ require 'rake/clean'
5
+
6
+ begin
7
+ require 'rake/extensiontask'
8
+ rescue LoadError
9
+ puts "rake-compiler not found! Please install the rake-compiler gem!"
10
+ # `/bin/bash -l -c "gem1.9 install rake-compiler"`
11
+ # require 'rake/extensiontask'
12
+ # puts "...done!"
13
+ end
14
+
15
+ CHIPMUNK_VERSION = "5.3.4.0"
16
+
17
+ dlext = Config::CONFIG['DLEXT']
18
+
19
+ CLEAN.include("ext/**/*.#{dlext}", "ext/**/.log", "ext/**/.o", "ext/**/*~", "ext/**/*#*", "ext/**/.obj", "ext/**/.def", "ext/**/.pdb")
20
+ CLOBBER.include("**/*.#{dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o", "doc/**")
6
21
 
7
- CHIPMUNK_VERSION = "4.1.0"
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
-
12
- Rake::ExtensionTask.new('chipmunk')
13
-
14
- spec = Gem::Specification.new do |s|
22
+
23
+ def apply_spec_defaults(s)
15
24
  s.name = "chipmunk"
16
- s.summary = "ruby bindings for the chipmunk physics engine"
17
- s.description = s.summary
25
+ s.summary = "Enhanced ruby bindings for the chipmunk 5.3.4 game physics engine."
26
+ s.description = s.summary + " "
18
27
  s.version = CHIPMUNK_VERSION
19
28
  s.author = "Scott Lembcke, Beoran, John Mair (banisterfiend)"
20
- s.email = 'jrmair@gmail.com'
29
+ s.email = 'beoran@rubyforge.com'
21
30
  s.date = Time.now.strftime '%Y-%m-%d'
22
31
  s.require_path = 'lib'
23
- s.homepage = "http://code.google.com/p/chipmunk-physics/"
24
- s.platform = Gem::Platform::RUBY
25
- s.extensions = FileList["ext/**/extconf.rb"]
26
- s.files = ["Rakefile", "lib/chipmunk.rb"] + FileList["ext/**/extconf.rb", "ext/**/*.h",
27
- "ext/**/*.c"].to_a
28
- end
29
-
30
- Rake::GemPackageTask.new(spec) do |pkg|
31
- pkg.need_zip = false
32
- pkg.need_tar = false
33
- end
34
-
35
- Rake::ExtensionTask.new('chipmunk', spec) do |ext|
36
- ext.cross_compile = true
37
- ext.cross_platform = 'i386-mswin32'
32
+ s.homepage = "https://github.com/beoran/chipmunk"
38
33
  end
34
+
35
+
36
+ # common tasks
37
+ task :compile => :clean
38
+
39
+ # platform dependent tasks
40
+ if RUBY_PLATFORM =~ /darwin/
41
+
42
+ spec = Gem::Specification.new do |s|
43
+ apply_spec_defaults(s)
44
+ s.platform = Gem::Platform::CURRENT
45
+ s.files = ["Rakefile", "README", "LICENSE", "lib/chipmunk.rb", "lib/1.8/chipmunk.#{dlext}", "lib/1.9/chipmunk.#{dlext}"]
46
+ end
47
+
48
+ Rake::ExtensionTask.new('chipmunk') do |ext|
49
+ ext.ext_dir = "ext"
50
+ ext.lib_dir = "lib/#{RUBY_VERSION[0..2]}"
51
+ ext.config_script = 'extconf.rb'
52
+ ext.config_options << 'macosx'
53
+ end
54
+
55
+ task :compile_multi => :clean do
56
+ `/bin/bash -l -c "rvm 1.8.6,1.9.1 rake compile"`
57
+ end
58
+
59
+ task :gem => :compile_multi
60
+ Rake::GemPackageTask.new(spec) do |pkg|
61
+ pkg.need_zip = false
62
+ pkg.need_tar = false
63
+ end
64
+
65
+ else
66
+
67
+ spec = Gem::Specification.new do |s|
68
+ apply_spec_defaults(s)
69
+ s.platform = Gem::Platform::RUBY
70
+ s.extensions = FileList["ext/**/extconf.rb"]
71
+ s.files = ["Rakefile", "README", "LICENSE", "lib/chipmunk.rb"] +
72
+ FileList["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c"].to_a
73
+ end
74
+
75
+ Rake::ExtensionTask.new('chipmunk', spec) do |ext|
76
+ ext.config_script = 'extconf.rb'
77
+ ext.cross_compile = true
78
+ ext.cross_platform = 'i386-mswin32'
79
+ end
80
+
81
+ Rake::GemPackageTask.new(spec) do |pkg|
82
+ pkg.need_zip = false
83
+ pkg.need_tar = false
84
+ end
85
+ end
@@ -1,4 +1,42 @@
1
1
  require 'mkmf'
2
2
 
3
+ RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
4
+
5
+ dir_config('chipmunk')
6
+
7
+ MINGW = '/usr/i586-mingw32msvc'
8
+ CHIPMUNK_HEADER = 'chipmunk.h'
9
+ CHIPMUNK_NAME = 'chipmunk'
10
+ CHIPMUNK_FUNCTION = 'cpMomentForPoly'
11
+ CHIPMUNK_INCLUDE = ['/usr/include',
12
+ File.join(MINGW, 'include'),
13
+ File.join(MINGW, 'include', 'chipmunk'),
14
+ '/usr/local/include',
15
+ '/usr/include/chipmunk',
16
+ '/usr/local/include/chipmunk'
17
+ ]
18
+ CHIPMUNK_LIBDIR = ['/usr/lib',
19
+ File.join(MINGW, 'lib'),
20
+ '/usr/local/lib']
21
+
22
+ unless find_header(CHIPMUNK_HEADER, *CHIPMUNK_INCLUDE)
23
+ raise "Could not find Chipmunk headers!"
24
+ end
25
+
26
+
27
+ unless find_library(CHIPMUNK_NAME, CHIPMUNK_FUNCTION, *CHIPMUNK_LIBDIR)
28
+ raise "Could not link to Chipmunk library!"
29
+ end
30
+
31
+ =begin
32
+ have_header('chipmunk.h', include_dirs)
33
+ =end
34
+
35
+ if ARGV[0] == "macosx"
36
+ $CFLAGS += ' -arch ppc -arch i386 -arch x86_64'
37
+ $LDFLAGS += ' -arch x86_64 -arch i386 -arch ppc'
38
+ end
39
+
3
40
  $CFLAGS += ' -std=gnu99 -ffast-math'
4
41
  create_makefile('chipmunk')
42
+
@@ -18,7 +18,9 @@
18
18
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
19
  * SOFTWARE.
20
20
  */
21
-
21
+
22
+ #include <stdlib.h>
23
+
22
24
  #include "chipmunk.h"
23
25
 
24
26
  #include "ruby.h"
@@ -29,59 +31,160 @@ VALUE m_Chipmunk;
29
31
  ID id_parent;
30
32
 
31
33
  static VALUE
32
- rb_get_cp_bias_coef(VALUE self)
33
- {
34
+ rb_get_cp_bias_coef(VALUE self) {
34
35
  return rb_float_new(cp_bias_coef);
35
36
  }
36
37
 
37
38
  static VALUE
38
- rb_set_cp_bias_coef(VALUE self, VALUE num)
39
- {
39
+ rb_set_cp_bias_coef(VALUE self, VALUE num) {
40
40
  cp_bias_coef = NUM2DBL(num);
41
41
  return num;
42
42
  }
43
43
 
44
44
  static VALUE
45
- rb_get_cp_collision_slop(VALUE self)
46
- {
45
+ rb_get_cp_collision_slop(VALUE self) {
47
46
  return rb_float_new(cp_collision_slop);
48
47
  }
49
48
 
50
49
  static VALUE
51
- rb_set_cp_collision_slop(VALUE self, VALUE num)
52
- {
50
+ rb_set_cp_collision_slop(VALUE self, VALUE num) {
53
51
  cp_collision_slop = NUM2DBL(num);
54
52
  return num;
55
53
  }
56
54
 
57
55
  static VALUE
58
- rb_momentForCircle(VALUE self, VALUE m, VALUE r1, VALUE r2, VALUE offset)
56
+ rb_set_cp_contact_persistence(VALUE self, VALUE num) {
57
+ cp_contact_persistence = NUM2DBL(num);
58
+ return num;
59
+ }
60
+
61
+ static VALUE
62
+ rb_get_cp_contact_persistence(VALUE self) {
63
+ return rb_float_new(cp_contact_persistence);
64
+ }
65
+
66
+
67
+ static VALUE
68
+ rb_cpMomentForCircle(VALUE self, VALUE m, VALUE r1, VALUE r2, VALUE offset)
59
69
  {
60
70
  cpFloat i = cpMomentForCircle(NUM2DBL(m), NUM2DBL(r1), NUM2DBL(r2), *VGET(offset));
61
71
  return rb_float_new(i);
62
72
  }
63
73
 
64
74
  static VALUE
65
- rb_momentForPoly(VALUE self, VALUE m, VALUE arr, VALUE offset)
75
+ rb_cpMomentForSegment(VALUE self, VALUE m, VALUE v1, VALUE v2)
76
+ {
77
+ cpFloat i = cpMomentForSegment(NUM2DBL(m), *VGET(v1), *VGET(v2));
78
+ return rb_float_new(i);
79
+ }
80
+
81
+ static VALUE
82
+ rb_cpMomentForPoly(VALUE self, VALUE m, VALUE arr, VALUE offset)
66
83
  {
67
84
  Check_Type(arr, T_ARRAY);
68
85
  int numVerts = RARRAY_LEN(arr);
86
+ VALUE *ary_ptr = RARRAY_PTR(arr);
69
87
  cpVect verts[numVerts];
70
88
 
71
89
  for(int i=0; i<numVerts; i++)
72
- verts[i] = *VGET(RARRAY_PTR(arr)[i]);
90
+ verts[i] = *VGET(ary_ptr[i]);
73
91
 
74
92
  cpFloat inertia = cpMomentForPoly(NUM2DBL(m), numVerts, verts, *VGET(offset));
75
93
  return rb_float_new(inertia);
76
94
  }
77
95
 
78
96
  static VALUE
79
- rb_dampedSpring(VALUE self, VALUE a, VALUE b, VALUE r1, VALUE r2, VALUE len, VALUE k, VALUE dmp, VALUE dt)
97
+ rb_cpMomentForBox(VALUE self, VALUE m, VALUE w, VALUE h) {
98
+ cpFloat i = cpMomentForBox(NUM2DBL(m), NUM2DBL(w), NUM2DBL(h));
99
+ return rb_float_new(i);
100
+ }
101
+
102
+ static VALUE
103
+ rb_cpAreaForCircle(VALUE self, VALUE r1, VALUE r2)
104
+ {
105
+ cpFloat i = cpAreaForCircle(NUM2DBL(r1), NUM2DBL(r2));
106
+ return rb_float_new(i);
107
+ }
108
+
109
+ static VALUE
110
+ rb_cpAreaForSegment(VALUE self, VALUE v1, VALUE v2, VALUE r)
111
+ {
112
+ cpFloat i = cpAreaForSegment(*VGET(v1), *VGET(v2), NUM2DBL(r));
113
+ return rb_float_new(i);
114
+ }
115
+
116
+ static VALUE
117
+ rb_cpAreaForPoly(VALUE self, VALUE arr)
118
+ {
119
+ Check_Type(arr, T_ARRAY);
120
+ int numVerts = RARRAY_LEN(arr);
121
+ VALUE *ary_ptr = RARRAY_PTR(arr);
122
+ cpVect verts[numVerts];
123
+
124
+ for(int i=0; i<numVerts; i++)
125
+ verts[i] = *VGET(ary_ptr[i]);
126
+
127
+ cpFloat area = cpAreaForPoly(numVerts, verts);
128
+ return rb_float_new(area);
129
+ }
130
+
131
+ static VALUE
132
+ rb_cpAreaForBox(VALUE self, VALUE w, VALUE h) {
133
+ cpFloat i = NUM2DBL(w) * NUM2DBL(h);
134
+ return rb_float_new(i);
135
+ }
136
+
137
+
138
+ static VALUE rb_cpfclamp(VALUE self, VALUE f, VALUE min, VALUE max) {
139
+ cpFloat result = cpfclamp(NUM2DBL(f), NUM2DBL(min), NUM2DBL(max));
140
+ return rb_float_new(result);
141
+ }
142
+
143
+ static VALUE rb_cpflerp(VALUE self, VALUE f1, VALUE f2, VALUE t) {
144
+ cpFloat result = cpflerp(NUM2DBL(f1), NUM2DBL(f2), NUM2DBL(t));
145
+ return rb_float_new(result);
146
+ }
147
+
148
+ static VALUE rb_cpflerpconst(VALUE self, VALUE f1, VALUE f2, VALUE d) {
149
+ cpFloat result = cpflerpconst(NUM2DBL(f1), NUM2DBL(f2), NUM2DBL(d));
150
+ return rb_float_new(result);
151
+ }
152
+
153
+ static VALUE
154
+ rb_cpCentroidForPoly(VALUE self, VALUE arr)
80
155
  {
81
- cpDampedSpring(BODY(a), BODY(b), *VGET(r1), *VGET(r2), NUM2DBL(len), NUM2DBL(k), NUM2DBL(dmp), NUM2DBL(dt));
82
- return Qnil;
156
+ Check_Type(arr, T_ARRAY);
157
+ int numVerts = RARRAY_LEN(arr);
158
+ VALUE *ary_ptr = RARRAY_PTR(arr);
159
+ cpVect verts[numVerts];
160
+
161
+ for(int i=0; i<numVerts; i++)
162
+ verts[i] = *VGET(ary_ptr[i]);
163
+
164
+ return VNEW(cpCentroidForPoly(numVerts, verts));
83
165
  }
84
166
 
167
+ static VALUE
168
+ rb_cpRecenterPoly(VALUE self, VALUE arr)
169
+ {
170
+ Check_Type(arr, T_ARRAY);
171
+ int numVerts = RARRAY_LEN(arr);
172
+ VALUE *ary_ptr = RARRAY_PTR(arr);
173
+ cpVect verts[numVerts];
174
+
175
+ for(int i=0; i<numVerts; i++)
176
+ verts[i] = *VGET(ary_ptr[i]);
177
+
178
+ cpRecenterPoly(numVerts, verts);
179
+
180
+ for(int i=0; i<numVerts; i++)
181
+ ary_ptr[i] = VNEW(verts[i]);
182
+ return arr;
183
+ }
184
+
185
+
186
+
187
+
85
188
  void
86
189
  Init_chipmunk(void)
87
190
  {
@@ -89,21 +192,59 @@ Init_chipmunk(void)
89
192
 
90
193
  cpInitChipmunk();
91
194
 
195
+
196
+
92
197
  m_Chipmunk = rb_define_module("CP");
93
198
  rb_define_module_function(m_Chipmunk, "bias_coef", rb_get_cp_bias_coef, 0);
94
199
  rb_define_module_function(m_Chipmunk, "bias_coef=", rb_set_cp_bias_coef, 1);
95
200
  rb_define_module_function(m_Chipmunk, "collision_slop", rb_get_cp_collision_slop, 0);
96
201
  rb_define_module_function(m_Chipmunk, "collision_slop=", rb_set_cp_collision_slop, 1);
202
+ rb_define_module_function(m_Chipmunk, "contact_persistence", rb_get_cp_contact_persistence, 0);
203
+ rb_define_module_function(m_Chipmunk, "contact_persistence=", rb_set_cp_contact_persistence, 1);
204
+
205
+
206
+
207
+ rb_define_module_function(m_Chipmunk, "clamp", rb_cpfclamp, 3);
208
+ rb_define_module_function(m_Chipmunk, "flerp", rb_cpflerp, 3);
209
+ rb_define_module_function(m_Chipmunk, "flerpconst", rb_cpflerpconst, 3);
97
210
 
98
- rb_define_module_function(m_Chipmunk, "moment_for_circle", rb_momentForCircle, 4);
99
- rb_define_module_function(m_Chipmunk, "moment_for_poly", rb_momentForPoly, 3);
100
-
101
- rb_define_module_function(m_Chipmunk, "damped_spring", rb_dampedSpring, 8);
102
-
211
+ rb_define_module_function(m_Chipmunk, "moment_for_circle", rb_cpMomentForCircle, 4);
212
+ rb_define_module_function(m_Chipmunk, "moment_for_poly", rb_cpMomentForPoly, 3);
213
+ rb_define_module_function(m_Chipmunk, "moment_for_segment", rb_cpMomentForSegment, 3);
214
+ rb_define_module_function(m_Chipmunk, "moment_for_box", rb_cpMomentForBox, 3);
215
+
216
+ rb_define_module_function(m_Chipmunk, "circle_moment", rb_cpMomentForCircle, 4);
217
+ rb_define_module_function(m_Chipmunk, "poly_moment", rb_cpMomentForPoly, 3);
218
+ rb_define_module_function(m_Chipmunk, "segment_moment", rb_cpMomentForSegment, 3);
219
+ rb_define_module_function(m_Chipmunk, "box_moment", rb_cpMomentForBox, 3);
220
+
221
+
222
+ rb_define_module_function(m_Chipmunk, "area_for_circle", rb_cpAreaForCircle, 2);
223
+ rb_define_module_function(m_Chipmunk, "area_for_poly", rb_cpAreaForPoly, 1);
224
+ rb_define_module_function(m_Chipmunk, "centroid_for_poly",
225
+ rb_cpCentroidForPoly, 1);
226
+ rb_define_module_function(m_Chipmunk, "recenter_poly",
227
+ rb_cpRecenterPoly, 1);
228
+
229
+ rb_define_module_function(m_Chipmunk, "area_for_segment", rb_cpAreaForSegment, 3);
230
+ rb_define_module_function(m_Chipmunk, "area_for_box", rb_cpAreaForBox, 2);
231
+
232
+ rb_define_module_function(m_Chipmunk, "circle_area", rb_cpAreaForCircle, 2);
233
+ rb_define_module_function(m_Chipmunk, "poly_area", rb_cpAreaForPoly, 1);
234
+ rb_define_module_function(m_Chipmunk, "segment_area", rb_cpAreaForSegment, 3);
235
+ rb_define_module_function(m_Chipmunk, "box_area", rb_cpAreaForBox, 2);
236
+
237
+ rb_define_const(m_Chipmunk, "ALL_LAYERS", UINT2NUM((unsigned int)CP_ALL_LAYERS));
238
+ rb_define_const(m_Chipmunk, "NO_GROUP" , UINT2NUM(CP_NO_GROUP));
239
+
240
+ rb_eval_string("Float::INFINITY = 1.0/0.0 unless Float.const_defined? :INFINITY");
241
+ rb_eval_string("CP::INFINITY = 1.0/0.0 unless CP.const_defined? :INFINITY");
242
+
103
243
  Init_cpVect();
104
244
  Init_cpBB();
105
245
  Init_cpBody();
106
246
  Init_cpShape();
107
- Init_cpJoint();
247
+ Init_cpConstraint();
108
248
  Init_cpSpace();
249
+ Init_cpArbiter();
109
250
  }