chipmunk 5.3.4.0-x86-mingw32 → 5.3.4.2-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/README +33 -13
  2. data/Rakefile +20 -7
  3. data/ext/chipmunk/extconf.rb +55 -12
  4. data/ext/chipmunk/rb_chipmunk.c +92 -98
  5. data/ext/chipmunk/rb_chipmunk.h +44 -34
  6. data/ext/chipmunk/rb_cpArbiter.c +135 -98
  7. data/ext/chipmunk/rb_cpBB.c +84 -101
  8. data/ext/chipmunk/rb_cpBody.c +219 -241
  9. data/ext/chipmunk/rb_cpConstraint.c +173 -185
  10. data/ext/chipmunk/rb_cpShape.c +347 -251
  11. data/ext/chipmunk/rb_cpSpace.c +376 -408
  12. data/ext/chipmunk/rb_cpVect.c +132 -170
  13. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/chipmunk.h +163 -0
  14. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/chipmunk_ffi.h +59 -0
  15. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/chipmunk_private.h +49 -0
  16. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/chipmunk_types.h +151 -0
  17. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/chipmunk_unsafe.h +54 -0
  18. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpConstraint.h +105 -0
  19. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpDampedRotarySpring.h +46 -0
  20. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpDampedSpring.h +53 -0
  21. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpGearJoint.h +41 -0
  22. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpGrooveJoint.h +48 -0
  23. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpPinJoint.h +43 -0
  24. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpPivotJoint.h +42 -0
  25. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpRatchetJoint.h +40 -0
  26. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpRotaryLimitJoint.h +39 -0
  27. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpSimpleMotor.h +37 -0
  28. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/cpSlideJoint.h +44 -0
  29. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/constraints/util.h +134 -0
  30. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpArbiter.h +188 -0
  31. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpArray.h +49 -0
  32. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpBB.h +74 -0
  33. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpBody.h +219 -0
  34. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpCollision.h +28 -0
  35. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpHashSet.h +82 -0
  36. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpPolyShape.h +103 -0
  37. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpShape.h +177 -0
  38. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpSpace.h +206 -0
  39. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpSpaceHash.h +110 -0
  40. data/ext/chipmunk/vendor/chipmunk-5.3.4/include/chipmunk/cpVect.h +207 -0
  41. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/chipmunk.c +151 -0
  42. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpConstraint.c +54 -0
  43. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpDampedRotarySpring.c +105 -0
  44. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpDampedSpring.c +115 -0
  45. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpGearJoint.c +113 -0
  46. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpGrooveJoint.c +161 -0
  47. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpPinJoint.c +116 -0
  48. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpPivotJoint.c +114 -0
  49. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpRatchetJoint.c +126 -0
  50. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpRotaryLimitJoint.c +120 -0
  51. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpSimpleMotor.c +97 -0
  52. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/constraints/cpSlideJoint.c +129 -0
  53. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpArbiter.c +280 -0
  54. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpArray.c +143 -0
  55. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpBB.c +47 -0
  56. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpBody.c +192 -0
  57. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpCollision.c +411 -0
  58. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpHashSet.c +253 -0
  59. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpPolyShape.c +240 -0
  60. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpShape.c +405 -0
  61. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpSpace.c +499 -0
  62. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpSpaceComponent.c +279 -0
  63. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpSpaceHash.c +534 -0
  64. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpSpaceQuery.c +246 -0
  65. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpSpaceStep.c +398 -0
  66. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/cpVect.c +71 -0
  67. data/ext/chipmunk/vendor/chipmunk-5.3.4/src/prime.h +68 -0
  68. data/lib/1.9/chipmunk.so +0 -0
  69. data/lib/chipmunk.rb +19 -8
  70. metadata +84 -42
  71. data/lib/1.8/chipmunk.so +0 -0
@@ -1,23 +1,23 @@
1
1
  /* Copyright (c) 2007 Scott Lembcke
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 THE
19
- * SOFTWARE.
20
- */
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 THE
19
+ * SOFTWARE.
20
+ */
21
21
 
22
22
  #include <stdlib.h>
23
23
  #include "chipmunk.h"
@@ -27,57 +27,56 @@
27
27
 
28
28
  VALUE m_cpConstraint;
29
29
 
30
- #define CONSTRAINT_GETSET_FUNCS(member) \
31
- static VALUE rb_cpConstraint_get_##member(VALUE self) \
32
- {return rb_float_new(CONSTRAINT(self)->member);} \
33
- static VALUE rb_cpConstraint_set_##member(VALUE self, VALUE value) \
34
- {CONSTRAINT(self)->member = NUM2DBL(value); return value;}
30
+ #define CONSTRAINT_GETSET_FUNCS(member) \
31
+ static VALUE rb_cpConstraint_get_ ## member(VALUE self) \
32
+ { return rb_float_new(CONSTRAINT(self)->member);} \
33
+ static VALUE rb_cpConstraint_set_ ## member(VALUE self, VALUE value) \
34
+ { CONSTRAINT(self)->member = NUM2DBL(value); return value;}
35
35
 
36
36
  CONSTRAINT_GETSET_FUNCS(maxForce)
37
37
  CONSTRAINT_GETSET_FUNCS(biasCoef)
38
38
  CONSTRAINT_GETSET_FUNCS(maxBias)
39
39
 
40
40
 
41
- #define MAKE_FLT_GETTER(func) \
42
- static VALUE rb_##func(VALUE self) \
43
- {return rb_float_new(func(CONSTRAINT(self)));}
41
+ #define MAKE_FLT_GETTER(func) \
42
+ static VALUE rb_ ## func(VALUE self) \
43
+ { return rb_float_new(func(CONSTRAINT(self)));}
44
44
 
45
- #define MAKE_FLT_SETTER(func) \
46
- static VALUE rb_##func(VALUE self, VALUE value) \
47
- {func(CONSTRAINT(self), NUM2DBL(value)); return value;} \
45
+ #define MAKE_FLT_SETTER(func) \
46
+ static VALUE rb_ ## func(VALUE self, VALUE value) \
47
+ { func(CONSTRAINT(self), NUM2DBL(value)); return value;} \
48
48
 
49
49
  #define MAKE_FLT_ACCESSORS(s, m) \
50
- MAKE_FLT_GETTER(s##Get##m) \
51
- MAKE_FLT_SETTER(s##Set##m)
50
+ MAKE_FLT_GETTER(s ## Get ## m) \
51
+ MAKE_FLT_SETTER(s ## Set ## m)
52
52
 
53
- #define MAKE_VEC_GETTER(func) \
54
- static VALUE rb_##func(VALUE self) \
55
- {return VNEW(func(CONSTRAINT(self)));}
53
+ #define MAKE_VEC_GETTER(func) \
54
+ static VALUE rb_ ## func(VALUE self) \
55
+ { return VNEW(func(CONSTRAINT(self)));}
56
56
 
57
- #define MAKE_VEC_SETTER(func) \
58
- static VALUE rb_##func(VALUE self, VALUE value) \
59
- {func(CONSTRAINT(self), *VGET(value)); return value;} \
57
+ #define MAKE_VEC_SETTER(func) \
58
+ static VALUE rb_ ## func(VALUE self, VALUE value) \
59
+ { func(CONSTRAINT(self), *VGET(value)); return value;} \
60
60
 
61
61
  #define MAKE_VEC_ACCESSORS(s, m) \
62
- MAKE_VEC_GETTER(s##Get##m) \
63
- MAKE_VEC_SETTER(s##Set##m)
62
+ MAKE_VEC_GETTER(s ## Get ## m) \
63
+ MAKE_VEC_SETTER(s ## Set ## m)
64
64
 
65
65
 
66
- #define ALLOC_TEMPLATE(s, alloc) \
67
- static VALUE rb_##s##_alloc(VALUE klass) \
68
- {return Data_Wrap_Struct(klass, NULL, cpConstraintFree, alloc);}
66
+ #define ALLOC_TEMPLATE(s, alloc) \
67
+ static VALUE rb_ ## s ## _alloc(VALUE klass) \
68
+ { return Data_Wrap_Struct(klass, NULL, cpConstraintFree, alloc);}
69
69
 
70
70
  ALLOC_TEMPLATE(cpPinJoint, cpPinJointAlloc())
71
71
 
72
72
  static VALUE
73
- rb_cpPinJoint_init(VALUE self, VALUE a, VALUE b, VALUE anchr1, VALUE anchr2)
74
- {
75
- cpPinJoint *joint = (cpPinJoint *)CONSTRAINT(self);
76
- cpPinJointInit(joint, BODY(a), BODY(b), *VGET(anchr1), *VGET(anchr2));
77
- rb_iv_set(self, "@body_a", a);
78
- rb_iv_set(self, "@body_b", b);
79
-
80
- return self;
73
+ rb_cpPinJoint_init(VALUE self, VALUE a, VALUE b, VALUE anchr1, VALUE anchr2) {
74
+ cpPinJoint *joint = (cpPinJoint *)CONSTRAINT(self);
75
+ cpPinJointInit(joint, BODY(a), BODY(b), *VGET(anchr1), *VGET(anchr2));
76
+ rb_iv_set(self, "@body_a", a);
77
+ rb_iv_set(self, "@body_b", b);
78
+
79
+ return self;
81
80
  }
82
81
 
83
82
  MAKE_FLT_ACCESSORS(cpPinJoint, Dist)
@@ -88,14 +87,13 @@ MAKE_VEC_ACCESSORS(cpPinJoint, Anchr2)
88
87
  ALLOC_TEMPLATE(cpDampedRotarySpring, cpDampedRotarySpringAlloc())
89
88
 
90
89
  static VALUE
91
- rb_cpDampedRotarySpring_init(VALUE self, VALUE a, VALUE b, VALUE restAngle, VALUE stiffness, VALUE damping)
92
- {
93
- cpDampedRotarySpring *spring = (cpDampedRotarySpring *)CONSTRAINT(self);
94
- cpDampedRotarySpringInit(spring, BODY(a), BODY(b), NUM2DBL(restAngle), NUM2DBL(stiffness), NUM2DBL(damping));
95
- rb_iv_set(self, "@body_a", a);
96
- rb_iv_set(self, "@body_b", b);
97
-
98
- return self;
90
+ rb_cpDampedRotarySpring_init(VALUE self, VALUE a, VALUE b, VALUE restAngle, VALUE stiffness, VALUE damping) {
91
+ cpDampedRotarySpring *spring = (cpDampedRotarySpring *)CONSTRAINT(self);
92
+ cpDampedRotarySpringInit(spring, BODY(a), BODY(b), NUM2DBL(restAngle), NUM2DBL(stiffness), NUM2DBL(damping));
93
+ rb_iv_set(self, "@body_a", a);
94
+ rb_iv_set(self, "@body_b", b);
95
+
96
+ return self;
99
97
  }
100
98
 
101
99
  MAKE_FLT_ACCESSORS(cpDampedRotarySpring, RestAngle);
@@ -106,14 +104,13 @@ MAKE_FLT_ACCESSORS(cpDampedRotarySpring, Damping);
106
104
  ALLOC_TEMPLATE(cpDampedSpring, cpDampedSpringAlloc())
107
105
 
108
106
  static VALUE
109
- rb_cpDampedSpring_init(VALUE self, VALUE a, VALUE b, VALUE anchr1, VALUE anchr2, VALUE restLength, VALUE stiffness, VALUE damping)
110
- {
111
- cpDampedSpring *spring = (cpDampedSpring *)CONSTRAINT(self);
112
- cpDampedSpringInit(spring, BODY(a), BODY(b), *VGET(anchr1), *VGET(anchr2), NUM2DBL(restLength), NUM2DBL(stiffness), NUM2DBL(damping));
113
- rb_iv_set(self, "@body_a", a);
114
- rb_iv_set(self, "@body_b", b);
115
-
116
- return self;
107
+ rb_cpDampedSpring_init(VALUE self, VALUE a, VALUE b, VALUE anchr1, VALUE anchr2, VALUE restLength, VALUE stiffness, VALUE damping) {
108
+ cpDampedSpring *spring = (cpDampedSpring *)CONSTRAINT(self);
109
+ cpDampedSpringInit(spring, BODY(a), BODY(b), *VGET(anchr1), *VGET(anchr2), NUM2DBL(restLength), NUM2DBL(stiffness), NUM2DBL(damping));
110
+ rb_iv_set(self, "@body_a", a);
111
+ rb_iv_set(self, "@body_b", b);
112
+
113
+ return self;
117
114
  }
118
115
 
119
116
  MAKE_VEC_ACCESSORS(cpDampedSpring, Anchr1)
@@ -126,14 +123,13 @@ MAKE_FLT_ACCESSORS(cpDampedSpring, Damping);
126
123
  ALLOC_TEMPLATE(cpGearJoint, cpGearJointAlloc())
127
124
 
128
125
  static VALUE
129
- rb_cpGearJoint_init(VALUE self, VALUE a, VALUE b, VALUE phase, VALUE ratio)
130
- {
131
- cpGearJoint *joint = (cpGearJoint *)CONSTRAINT(self);
132
- cpGearJointInit(joint, BODY(a), BODY(b), NUM2DBL(phase), NUM2DBL(ratio));
133
- rb_iv_set(self, "@body_a", a);
134
- rb_iv_set(self, "@body_b", b);
135
-
136
- return self;
126
+ rb_cpGearJoint_init(VALUE self, VALUE a, VALUE b, VALUE phase, VALUE ratio) {
127
+ cpGearJoint *joint = (cpGearJoint *)CONSTRAINT(self);
128
+ cpGearJointInit(joint, BODY(a), BODY(b), NUM2DBL(phase), NUM2DBL(ratio));
129
+ rb_iv_set(self, "@body_a", a);
130
+ rb_iv_set(self, "@body_b", b);
131
+
132
+ return self;
137
133
  }
138
134
 
139
135
  MAKE_FLT_ACCESSORS(cpGearJoint, Phase);
@@ -143,14 +139,13 @@ MAKE_FLT_ACCESSORS(cpGearJoint, Ratio);
143
139
  ALLOC_TEMPLATE(cpPivotJoint, cpPivotJointAlloc())
144
140
 
145
141
  static VALUE
146
- rb_cpPivotJoint_init(VALUE self, VALUE a, VALUE b, VALUE anchr1, VALUE anchr2)
147
- {
148
- cpPivotJoint *joint = (cpPivotJoint *)CONSTRAINT(self);
149
- cpPivotJointInit(joint, BODY(a), BODY(b), *VGET(anchr1), *VGET(anchr2));
150
- rb_iv_set(self, "@body_a", a);
151
- rb_iv_set(self, "@body_b", b);
152
-
153
- return self;
142
+ rb_cpPivotJoint_init(VALUE self, VALUE a, VALUE b, VALUE anchr1, VALUE anchr2) {
143
+ cpPivotJoint *joint = (cpPivotJoint *)CONSTRAINT(self);
144
+ cpPivotJointInit(joint, BODY(a), BODY(b), *VGET(anchr1), *VGET(anchr2));
145
+ rb_iv_set(self, "@body_a", a);
146
+ rb_iv_set(self, "@body_b", b);
147
+
148
+ return self;
154
149
  }
155
150
 
156
151
  MAKE_VEC_ACCESSORS(cpPivotJoint, Anchr1);
@@ -160,14 +155,13 @@ MAKE_VEC_ACCESSORS(cpPivotJoint, Anchr2);
160
155
  ALLOC_TEMPLATE(cpRotaryLimitJoint, cpRotaryLimitJointAlloc())
161
156
 
162
157
  static VALUE
163
- rb_cpRotaryLimitJoint_init(VALUE self, VALUE a, VALUE b, VALUE min, VALUE max)
164
- {
165
- cpRotaryLimitJoint *joint = (cpRotaryLimitJoint *)CONSTRAINT(self);
166
- cpRotaryLimitJointInit(joint, BODY(a), BODY(b), NUM2DBL(min), NUM2DBL(max));
167
- rb_iv_set(self, "@body_a", a);
168
- rb_iv_set(self, "@body_b", b);
169
-
170
- return self;
158
+ rb_cpRotaryLimitJoint_init(VALUE self, VALUE a, VALUE b, VALUE min, VALUE max) {
159
+ cpRotaryLimitJoint *joint = (cpRotaryLimitJoint *)CONSTRAINT(self);
160
+ cpRotaryLimitJointInit(joint, BODY(a), BODY(b), NUM2DBL(min), NUM2DBL(max));
161
+ rb_iv_set(self, "@body_a", a);
162
+ rb_iv_set(self, "@body_b", b);
163
+
164
+ return self;
171
165
  }
172
166
 
173
167
  MAKE_FLT_ACCESSORS(cpRotaryLimitJoint, Min);
@@ -177,14 +171,13 @@ MAKE_FLT_ACCESSORS(cpRotaryLimitJoint, Max);
177
171
  ALLOC_TEMPLATE(cpSimpleMotor, cpSimpleMotorAlloc())
178
172
 
179
173
  static VALUE
180
- rb_cpSimpleMotor_init(VALUE self, VALUE a, VALUE b, VALUE rate)
181
- {
182
- cpSimpleMotor *motor = (cpSimpleMotor *)CONSTRAINT(self);
183
- cpSimpleMotorInit(motor, BODY(a), BODY(b), NUM2DBL(rate));
184
- rb_iv_set(self, "@body_a", a);
185
- rb_iv_set(self, "@body_b", b);
186
-
187
- return self;
174
+ rb_cpSimpleMotor_init(VALUE self, VALUE a, VALUE b, VALUE rate) {
175
+ cpSimpleMotor *motor = (cpSimpleMotor *)CONSTRAINT(self);
176
+ cpSimpleMotorInit(motor, BODY(a), BODY(b), NUM2DBL(rate));
177
+ rb_iv_set(self, "@body_a", a);
178
+ rb_iv_set(self, "@body_b", b);
179
+
180
+ return self;
188
181
  }
189
182
 
190
183
  MAKE_FLT_ACCESSORS(cpSimpleMotor, Rate);
@@ -193,14 +186,13 @@ MAKE_FLT_ACCESSORS(cpSimpleMotor, Rate);
193
186
  ALLOC_TEMPLATE(cpSlideJoint, cpSlideJointAlloc())
194
187
 
195
188
  static VALUE
196
- rb_cpSlideJoint_init(VALUE self, VALUE a, VALUE b, VALUE anchr1, VALUE anchr2, VALUE min, VALUE max)
197
- {
198
- cpSlideJoint *joint = (cpSlideJoint *)CONSTRAINT(self);
199
- cpSlideJointInit(joint, BODY(a), BODY(b), *VGET(anchr1), *VGET(anchr2), NUM2DBL(min), NUM2DBL(max));
200
- rb_iv_set(self, "@body_a", a);
201
- rb_iv_set(self, "@body_b", b);
202
-
203
- return self;
189
+ rb_cpSlideJoint_init(VALUE self, VALUE a, VALUE b, VALUE anchr1, VALUE anchr2, VALUE min, VALUE max) {
190
+ cpSlideJoint *joint = (cpSlideJoint *)CONSTRAINT(self);
191
+ cpSlideJointInit(joint, BODY(a), BODY(b), *VGET(anchr1), *VGET(anchr2), NUM2DBL(min), NUM2DBL(max));
192
+ rb_iv_set(self, "@body_a", a);
193
+ rb_iv_set(self, "@body_b", b);
194
+
195
+ return self;
204
196
  }
205
197
 
206
198
  MAKE_VEC_ACCESSORS(cpSlideJoint, Anchr1)
@@ -212,14 +204,13 @@ MAKE_FLT_ACCESSORS(cpSlideJoint, Max);
212
204
  ALLOC_TEMPLATE(cpGrooveJoint, cpGrooveJointAlloc())
213
205
 
214
206
  static VALUE
215
- rb_cpGrooveJoint_init(VALUE self, VALUE a, VALUE b, VALUE grv_a, VALUE grv_b, VALUE anchr2)
216
- {
217
- cpGrooveJoint *joint = (cpGrooveJoint *)CONSTRAINT(self);
218
- cpGrooveJointInit(joint, BODY(a), BODY(b), *VGET(grv_a), *VGET(grv_b), *VGET(anchr2));
219
- rb_iv_set(self, "@body_a", a);
220
- rb_iv_set(self, "@body_b", b);
221
-
222
- return self;
207
+ rb_cpGrooveJoint_init(VALUE self, VALUE a, VALUE b, VALUE grv_a, VALUE grv_b, VALUE anchr2) {
208
+ cpGrooveJoint *joint = (cpGrooveJoint *)CONSTRAINT(self);
209
+ cpGrooveJointInit(joint, BODY(a), BODY(b), *VGET(grv_a), *VGET(grv_b), *VGET(anchr2));
210
+ rb_iv_set(self, "@body_a", a);
211
+ rb_iv_set(self, "@body_b", b);
212
+
213
+ return self;
223
214
  }
224
215
 
225
216
  MAKE_VEC_ACCESSORS(cpGrooveJoint, GrooveA)
@@ -230,13 +221,12 @@ MAKE_VEC_ACCESSORS(cpGrooveJoint, Anchr2)
230
221
  ALLOC_TEMPLATE(cpRatchetJoint, cpRatchetJointAlloc())
231
222
 
232
223
  static VALUE
233
- rb_cpRatchetJoint_init(VALUE self, VALUE a, VALUE b, VALUE phase, VALUE ratchet)
234
- {
224
+ rb_cpRatchetJoint_init(VALUE self, VALUE a, VALUE b, VALUE phase, VALUE ratchet) {
235
225
  cpRatchetJoint * joint = (cpRatchetJoint *)CONSTRAINT(self);
236
226
  cpRatchetJointInit(joint, BODY(a), BODY(b), NUM2DBL(phase), NUM2DBL(ratchet));
237
227
  rb_iv_set(self, "@body_a", a);
238
228
  rb_iv_set(self, "@body_b", b);
239
-
229
+
240
230
  return self;
241
231
  }
242
232
 
@@ -247,90 +237,88 @@ MAKE_FLT_ACCESSORS(cpRatchetJoint, Ratchet);
247
237
  static VALUE
248
238
  rb_cpConstraintGetImpulse(VALUE self) {
249
239
  return rb_float_new(cpConstraintGetImpulse(CONSTRAINT(self)));
250
- }
240
+ }
251
241
 
252
242
 
253
- #define STRINGIFY(v) #v
254
- #define ACCESSOR_METHODS(s, m, name) \
255
- rb_define_method(c_##s, STRINGIFY(name), rb_##s##Get##m, 0); \
256
- rb_define_method(c_##s, STRINGIFY(name=), rb_##s##Set##m, 1);
243
+ #define STRINGIFY(v) # v
244
+ #define ACCESSOR_METHODS(s, m, name) \
245
+ rb_define_method(c_ ## s, STRINGIFY(name), rb_ ## s ## Get ## m, 0); \
246
+ rb_define_method(c_ ## s, STRINGIFY(name = ), rb_ ## s ## Set ## m, 1);
257
247
 
258
248
  static VALUE
259
- make_class(const char *name, void *alloc_func, void *init_func, int init_params)
260
- {
261
- VALUE klass = rb_define_class_under(m_cpConstraint, name, rb_cObject);
262
- rb_include_module(klass, m_cpConstraint);
263
- rb_define_alloc_func(klass, alloc_func);
264
- rb_define_method(klass, "initialize", init_func, init_params);
265
-
266
- return klass;
249
+ make_class(const char *name, void *alloc_func, void *init_func, int init_params) {
250
+ VALUE klass = rb_define_class_under(m_cpConstraint, name, rb_cObject);
251
+ rb_include_module(klass, m_cpConstraint);
252
+ rb_define_alloc_func(klass, alloc_func);
253
+ rb_define_method(klass, "initialize", init_func, init_params);
254
+
255
+ return klass;
267
256
  }
268
257
 
269
258
  void
270
- Init_cpConstraint(void)
271
- {
272
- m_cpConstraint = rb_define_module_under(m_Chipmunk, "Constraint");
273
- rb_define_attr(m_cpConstraint, "body_a", 1, 0);
274
- rb_define_attr(m_cpConstraint, "body_b", 1, 0);
275
- rb_define_method(m_cpConstraint, "max_force", rb_cpConstraint_get_maxForce, 0);
276
- rb_define_method(m_cpConstraint, "max_force=", rb_cpConstraint_set_maxForce, 1);
277
- rb_define_method(m_cpConstraint, "bias_coef", rb_cpConstraint_get_biasCoef, 0);
278
- rb_define_method(m_cpConstraint, "bias_coef=", rb_cpConstraint_set_biasCoef, 1);
279
- rb_define_method(m_cpConstraint, "max_bias", rb_cpConstraint_get_maxBias, 0);
280
- rb_define_method(m_cpConstraint, "max_bias=" , rb_cpConstraint_set_maxBias, 1);
281
- rb_define_method(m_cpConstraint, "impulse" , rb_cpConstraintGetImpulse, 0);
282
-
283
-
284
- VALUE c_cpDampedRotarySpring = make_class("DampedRotarySpring", rb_cpDampedRotarySpring_alloc, rb_cpDampedRotarySpring_init, 5);
285
- ACCESSOR_METHODS(cpDampedRotarySpring, RestAngle, rest_angle)
286
- ACCESSOR_METHODS(cpDampedRotarySpring, Stiffness, stiffness)
287
- ACCESSOR_METHODS(cpDampedRotarySpring, Damping, damping)
288
-
289
- VALUE c_cpDampedSpring = make_class("DampedSpring", rb_cpDampedSpring_alloc, rb_cpDampedSpring_init, 7);
290
- ACCESSOR_METHODS(cpDampedSpring, Anchr1, anchr1)
291
- ACCESSOR_METHODS(cpDampedSpring, Anchr2, anchr2)
292
- ACCESSOR_METHODS(cpDampedSpring, RestLength, rest_length)
293
- ACCESSOR_METHODS(cpDampedSpring, Stiffness, stiffness)
294
- ACCESSOR_METHODS(cpDampedSpring, Damping, damping)
295
-
296
- VALUE c_cpGearJoint = make_class("GearJoint", rb_cpGearJoint_alloc, rb_cpGearJoint_init, 4);
259
+ Init_cpConstraint(void) {
260
+ m_cpConstraint = rb_define_module_under(m_Chipmunk, "Constraint");
261
+ rb_define_attr(m_cpConstraint, "body_a", 1, 0);
262
+ rb_define_attr(m_cpConstraint, "body_b", 1, 0);
263
+ rb_define_method(m_cpConstraint, "max_force", rb_cpConstraint_get_maxForce, 0);
264
+ rb_define_method(m_cpConstraint, "max_force=", rb_cpConstraint_set_maxForce, 1);
265
+ rb_define_method(m_cpConstraint, "bias_coef", rb_cpConstraint_get_biasCoef, 0);
266
+ rb_define_method(m_cpConstraint, "bias_coef=", rb_cpConstraint_set_biasCoef, 1);
267
+ rb_define_method(m_cpConstraint, "max_bias", rb_cpConstraint_get_maxBias, 0);
268
+ rb_define_method(m_cpConstraint, "max_bias=", rb_cpConstraint_set_maxBias, 1);
269
+ rb_define_method(m_cpConstraint, "impulse", rb_cpConstraintGetImpulse, 0);
270
+
271
+
272
+ VALUE c_cpDampedRotarySpring = make_class("DampedRotarySpring", rb_cpDampedRotarySpring_alloc, rb_cpDampedRotarySpring_init, 5);
273
+ ACCESSOR_METHODS(cpDampedRotarySpring, RestAngle, rest_angle)
274
+ ACCESSOR_METHODS(cpDampedRotarySpring, Stiffness, stiffness)
275
+ ACCESSOR_METHODS(cpDampedRotarySpring, Damping, damping)
276
+
277
+ VALUE c_cpDampedSpring = make_class("DampedSpring", rb_cpDampedSpring_alloc, rb_cpDampedSpring_init, 7);
278
+ ACCESSOR_METHODS(cpDampedSpring, Anchr1, anchr1)
279
+ ACCESSOR_METHODS(cpDampedSpring, Anchr2, anchr2)
280
+ ACCESSOR_METHODS(cpDampedSpring, RestLength, rest_length)
281
+ ACCESSOR_METHODS(cpDampedSpring, Stiffness, stiffness)
282
+ ACCESSOR_METHODS(cpDampedSpring, Damping, damping)
283
+
284
+ VALUE c_cpGearJoint = make_class("GearJoint", rb_cpGearJoint_alloc, rb_cpGearJoint_init, 4);
297
285
  ACCESSOR_METHODS(cpGearJoint, Phase, phase)
298
286
  ACCESSOR_METHODS(cpGearJoint, Ratio, ratio)
299
-
300
- VALUE c_cpGrooveJoint = make_class("GrooveJoint", rb_cpGrooveJoint_alloc, rb_cpGrooveJoint_init, 5);
287
+
288
+ VALUE c_cpGrooveJoint = make_class("GrooveJoint", rb_cpGrooveJoint_alloc, rb_cpGrooveJoint_init, 5);
301
289
  ACCESSOR_METHODS(cpGrooveJoint, Anchr2, anchr2)
302
-
303
290
 
304
- VALUE c_cpPinJoint = make_class("PinJoint", rb_cpPinJoint_alloc, rb_cpPinJoint_init, 4);
291
+
292
+ VALUE c_cpPinJoint = make_class("PinJoint", rb_cpPinJoint_alloc, rb_cpPinJoint_init, 4);
305
293
  ACCESSOR_METHODS(cpPinJoint, Anchr1, anchr1)
306
294
  ACCESSOR_METHODS(cpPinJoint, Anchr2, anchr2)
307
295
  ACCESSOR_METHODS(cpPinJoint, Dist, dist)
308
296
 
309
-
310
- VALUE c_cpPivotJoint = make_class("PivotJoint", rb_cpPivotJoint_alloc, rb_cpPivotJoint_init, 4);
311
- ACCESSOR_METHODS(cpPivotJoint, Anchr1, anchr1)
312
- ACCESSOR_METHODS(cpPivotJoint, Anchr2, anchr2)
313
-
314
- VALUE c_cpRotaryLimitJoint = make_class("RotaryLimitJoint", rb_cpRotaryLimitJoint_alloc, rb_cpRotaryLimitJoint_init, 4);
315
- ACCESSOR_METHODS(cpRotaryLimitJoint, Min, min)
316
- ACCESSOR_METHODS(cpRotaryLimitJoint, Max, max)
317
-
318
- VALUE c_cpSimpleMotor = make_class("SimpleMotor", rb_cpSimpleMotor_alloc, rb_cpSimpleMotor_init, 3);
319
- ACCESSOR_METHODS(cpSimpleMotor, Rate, rate);
320
-
321
- VALUE c_cpSlideJoint = make_class("SlideJoint", rb_cpSlideJoint_alloc, rb_cpSlideJoint_init, 6);
322
- ACCESSOR_METHODS(cpSlideJoint, Anchr1, anchr1)
323
- ACCESSOR_METHODS(cpSlideJoint, Anchr2, anchr2)
324
- ACCESSOR_METHODS(cpSlideJoint, Min, min)
325
- ACCESSOR_METHODS(cpSlideJoint, Max, max)
326
-
327
-
328
- VALUE c_cpRatchetJoint = make_class("RatchetJoint", rb_cpRatchetJoint_alloc, rb_cpRatchetJoint_init, 4);
297
+
298
+ VALUE c_cpPivotJoint = make_class("PivotJoint", rb_cpPivotJoint_alloc, rb_cpPivotJoint_init, 4);
299
+ ACCESSOR_METHODS(cpPivotJoint, Anchr1, anchr1)
300
+ ACCESSOR_METHODS(cpPivotJoint, Anchr2, anchr2)
301
+
302
+ VALUE c_cpRotaryLimitJoint = make_class("RotaryLimitJoint", rb_cpRotaryLimitJoint_alloc, rb_cpRotaryLimitJoint_init, 4);
303
+ ACCESSOR_METHODS(cpRotaryLimitJoint, Min, min)
304
+ ACCESSOR_METHODS(cpRotaryLimitJoint, Max, max)
305
+
306
+ VALUE c_cpSimpleMotor = make_class("SimpleMotor", rb_cpSimpleMotor_alloc, rb_cpSimpleMotor_init, 3);
307
+ ACCESSOR_METHODS(cpSimpleMotor, Rate, rate);
308
+
309
+ VALUE c_cpSlideJoint = make_class("SlideJoint", rb_cpSlideJoint_alloc, rb_cpSlideJoint_init, 6);
310
+ ACCESSOR_METHODS(cpSlideJoint, Anchr1, anchr1)
311
+ ACCESSOR_METHODS(cpSlideJoint, Anchr2, anchr2)
312
+ ACCESSOR_METHODS(cpSlideJoint, Min, min)
313
+ ACCESSOR_METHODS(cpSlideJoint, Max, max)
314
+
315
+
316
+ VALUE c_cpRatchetJoint = make_class("RatchetJoint", rb_cpRatchetJoint_alloc, rb_cpRatchetJoint_init, 4);
329
317
  ACCESSOR_METHODS(cpRatchetJoint, Angle, angle)
330
318
  ACCESSOR_METHODS(cpRatchetJoint, Phase, phase)
331
319
  ACCESSOR_METHODS(cpRatchetJoint, Ratchet, ratchet)
332
-
333
-
320
+
321
+
334
322
  // TODO: breakable joints. Seems to be missing in chipmunk 5.4.3.
335
-
323
+
336
324
  }