box2d-bindings 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9cff3908b7ab1206501e768a88861e1bccf1a198a538c7bbba49c8fb5690cbea
4
- data.tar.gz: 4eadc06d80a179c71cb47493f5123f4a7e898bc74e8836d1882b46bb6a64bd6c
3
+ metadata.gz: b9ce43f8725a8347229f668291548f0674a2e76a8bfc6d2253a0a625a67c16d2
4
+ data.tar.gz: 824ae8d8615bd34af4179602c5eb2d5fd5412a94f79ee018fd3575d44ee402c3
5
5
  SHA512:
6
- metadata.gz: 73fdd8dae87707cf81054a4e1debb446a898416e6dcc4bd651f848d57242724d0d845ae6339ddae63a7334518b233d83798b80fcc79148d5c2c788db0e9d473c
7
- data.tar.gz: 48a7b491fdb0db10ff18205d0c69d3ad940f0b4fe6f82ba915021ae2255ed4fc35fe83039822f901118b312f25a96b1a4543e0adc670bf630a8007327f8f0335
6
+ metadata.gz: 7936366ac024d6bbdd1cfccbb2ef0d116ba93c292ec5a710677bd7585d463ec3c64bb8f7d284c9bd6a3b96e156355c14afafc5888794b835f8e385c4652220d4
7
+ data.tar.gz: 8e6fb8e321f401ffd46fb8c27739df7dd976af8ed29403b7372e6d6eb7fa7d418a3f56021e5306d8688dbd41f33245b6e943386a0101abdce2afa35d2bf51673
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ 2025-02-01 vaiorabbit <http://twitter.com/vaiorabbit>
2
+
3
+ * https://github.com/erincatto/box2d/commit/28adacf82377d4113f2ed00586141463244b9d10
4
+ * Updated the helper function to use the latest version of Box2D.
5
+ * Added sample_compound.rb
6
+
1
7
  2024-12-29 vaiorabbit <http://twitter.com/vaiorabbit>
2
8
 
3
9
  * Added sample_softbody.rb
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  # Box2D bindings for Ruby #
4
4
 
5
5
  * Created : 2024-08-18
6
- * Last modified : 2025-01-01
6
+ * Last modified : 2025-02-01
7
7
 
8
8
  Provides Ruby bindings for Box2D
9
9
  * https://box2d.org
data/lib/box2d.rb CHANGED
@@ -9,7 +9,6 @@ require_relative 'box2d_math_inline_functions.rb'
9
9
  require_relative 'box2d_id.rb'
10
10
  require_relative 'box2d_id_inline.rb'
11
11
  require_relative 'box2d_collision.rb'
12
- require_relative 'box2d_collision_inline.rb'
13
12
  require_relative 'box2d_types.rb'
14
13
  require_relative 'box2d_main.rb'
15
14
  require_relative 'box2d_helper.rb'
@@ -42,7 +41,6 @@ module Box2D
42
41
  setup_id_symbols(method_naming: method_naming)
43
42
  setup_id_inline_symbols(method_naming: method_naming)
44
43
  setup_collision_symbols(method_naming: method_naming)
45
- setup_collision_inline_symbols(method_naming: method_naming)
46
44
  setup_types_symbols(method_naming: method_naming)
47
45
  setup_main_symbols(method_naming: method_naming)
48
46
  end
data/lib/box2d_base.rb CHANGED
@@ -44,19 +44,6 @@ module Box2D
44
44
  end
45
45
  end
46
46
 
47
- class Timer < FFI::Struct
48
- layout(
49
- :start, :long_long,
50
- )
51
- def start = self[:start]
52
- def start=(v) self[:start] = v end
53
- def self.create_as(_start_)
54
- instance = Timer.new
55
- instance[:start] = _start_
56
- instance
57
- end
58
- end
59
-
60
47
 
61
48
  # Function
62
49
 
@@ -67,11 +54,9 @@ module Box2D
67
54
  [:SetAssertFcn, :b2SetAssertFcn, [:pointer], :void],
68
55
  [:InternalAssertFcn, :b2InternalAssertFcn, [:pointer, :pointer, :int], :int],
69
56
  [:GetVersion, :b2GetVersion, [], Version.by_value],
70
- [:CreateTimer, :b2CreateTimer, [], Timer.by_value],
71
- [:GetTicks, :b2GetTicks, [:pointer], :long_long],
72
- [:GetMilliseconds, :b2GetMilliseconds, [:pointer], :float],
57
+ [:GetTicks, :b2GetTicks, [], :ulong_long],
58
+ [:GetMilliseconds, :b2GetMilliseconds, [:ulong_long], :float],
73
59
  [:GetMillisecondsAndReset, :b2GetMillisecondsAndReset, [:pointer], :float],
74
- [:SleepMilliseconds, :b2SleepMilliseconds, [:int], :void],
75
60
  [:Yield, :b2Yield, [], :void],
76
61
  [:Hash, :b2Hash, [:uint, :pointer, :int], :uint],
77
62
  ]
@@ -654,20 +654,24 @@ module Box2D
654
654
 
655
655
  class Manifold < FFI::Struct
656
656
  layout(
657
- :points, [ManifoldPoint, 2],
658
657
  :normal, Vec2,
658
+ :rollingImpulse, :float,
659
+ :points, [ManifoldPoint, 2],
659
660
  :pointCount, :int,
660
661
  )
661
- def points = self[:points]
662
- def points=(v) self[:points] = v end
663
662
  def normal = self[:normal]
664
663
  def normal=(v) self[:normal] = v end
664
+ def rollingImpulse = self[:rollingImpulse]
665
+ def rollingImpulse=(v) self[:rollingImpulse] = v end
666
+ def points = self[:points]
667
+ def points=(v) self[:points] = v end
665
668
  def pointCount = self[:pointCount]
666
669
  def pointCount=(v) self[:pointCount] = v end
667
- def self.create_as(_points_, _normal_, _pointCount_)
670
+ def self.create_as(_normal_, _rollingImpulse_, _points_, _pointCount_)
668
671
  instance = Manifold.new
669
- instance[:points] = _points_
670
672
  instance[:normal] = _normal_
673
+ instance[:rollingImpulse] = _rollingImpulse_
674
+ instance[:points] = _points_
671
675
  instance[:pointCount] = _pointCount_
672
676
  instance
673
677
  end
@@ -805,12 +809,15 @@ module Box2D
805
809
  [:DynamicTree_Query, :b2DynamicTree_Query, [:pointer, AABB.by_value, :ulong_long, :pointer, :pointer], TreeStats.by_value],
806
810
  [:DynamicTree_RayCast, :b2DynamicTree_RayCast, [:pointer, :pointer, :ulong_long, :pointer, :pointer], TreeStats.by_value],
807
811
  [:DynamicTree_ShapeCast, :b2DynamicTree_ShapeCast, [:pointer, :pointer, :ulong_long, :pointer, :pointer], TreeStats.by_value],
808
- [:DynamicTree_Validate, :b2DynamicTree_Validate, [:pointer], :void],
809
812
  [:DynamicTree_GetHeight, :b2DynamicTree_GetHeight, [:pointer], :int],
810
813
  [:DynamicTree_GetAreaRatio, :b2DynamicTree_GetAreaRatio, [:pointer], :float],
811
814
  [:DynamicTree_GetProxyCount, :b2DynamicTree_GetProxyCount, [:pointer], :int],
812
815
  [:DynamicTree_Rebuild, :b2DynamicTree_Rebuild, [:pointer, :bool], :int],
813
816
  [:DynamicTree_GetByteCount, :b2DynamicTree_GetByteCount, [:pointer], :int],
817
+ [:DynamicTree_GetUserData, :b2DynamicTree_GetUserData, [:pointer, :int], :int],
818
+ [:DynamicTree_GetAABB, :b2DynamicTree_GetAABB, [:pointer, :int], AABB.by_value],
819
+ [:DynamicTree_Validate, :b2DynamicTree_Validate, [:pointer], :void],
820
+ [:DynamicTree_ValidateNoEnlarged, :b2DynamicTree_ValidateNoEnlarged, [:pointer], :void],
814
821
  ]
815
822
  entries.each do |entry|
816
823
  api_name = if method_naming == :snake_case
data/lib/box2d_helper.rb CHANGED
@@ -24,7 +24,7 @@ module Box2D
24
24
  end
25
25
 
26
26
  def self.id_equals(id1, id2)
27
- id1.index1 == id2.index1 && id1.world0 == id2.world0 && id1.revision == id2.revision
27
+ id1.index1 == id2.index1 && id1.world0 == id2.world0 && id1.generation == id2.generation
28
28
  end
29
29
 
30
30
  #
data/lib/box2d_id.rb CHANGED
@@ -22,16 +22,16 @@ module Box2D
22
22
  class WorldId < FFI::Struct
23
23
  layout(
24
24
  :index1, :ushort,
25
- :revision, :ushort,
25
+ :generation, :ushort,
26
26
  )
27
27
  def index1 = self[:index1]
28
28
  def index1=(v) self[:index1] = v end
29
- def revision = self[:revision]
30
- def revision=(v) self[:revision] = v end
31
- def self.create_as(_index1_, _revision_)
29
+ def generation = self[:generation]
30
+ def generation=(v) self[:generation] = v end
31
+ def self.create_as(_index1_, _generation_)
32
32
  instance = WorldId.new
33
33
  instance[:index1] = _index1_
34
- instance[:revision] = _revision_
34
+ instance[:generation] = _generation_
35
35
  instance
36
36
  end
37
37
  end
@@ -40,19 +40,19 @@ module Box2D
40
40
  layout(
41
41
  :index1, :int,
42
42
  :world0, :ushort,
43
- :revision, :ushort,
43
+ :generation, :ushort,
44
44
  )
45
45
  def index1 = self[:index1]
46
46
  def index1=(v) self[:index1] = v end
47
47
  def world0 = self[:world0]
48
48
  def world0=(v) self[:world0] = v end
49
- def revision = self[:revision]
50
- def revision=(v) self[:revision] = v end
51
- def self.create_as(_index1_, _world0_, _revision_)
49
+ def generation = self[:generation]
50
+ def generation=(v) self[:generation] = v end
51
+ def self.create_as(_index1_, _world0_, _generation_)
52
52
  instance = BodyId.new
53
53
  instance[:index1] = _index1_
54
54
  instance[:world0] = _world0_
55
- instance[:revision] = _revision_
55
+ instance[:generation] = _generation_
56
56
  instance
57
57
  end
58
58
  end
@@ -61,19 +61,19 @@ module Box2D
61
61
  layout(
62
62
  :index1, :int,
63
63
  :world0, :ushort,
64
- :revision, :ushort,
64
+ :generation, :ushort,
65
65
  )
66
66
  def index1 = self[:index1]
67
67
  def index1=(v) self[:index1] = v end
68
68
  def world0 = self[:world0]
69
69
  def world0=(v) self[:world0] = v end
70
- def revision = self[:revision]
71
- def revision=(v) self[:revision] = v end
72
- def self.create_as(_index1_, _world0_, _revision_)
70
+ def generation = self[:generation]
71
+ def generation=(v) self[:generation] = v end
72
+ def self.create_as(_index1_, _world0_, _generation_)
73
73
  instance = ShapeId.new
74
74
  instance[:index1] = _index1_
75
75
  instance[:world0] = _world0_
76
- instance[:revision] = _revision_
76
+ instance[:generation] = _generation_
77
77
  instance
78
78
  end
79
79
  end
@@ -82,19 +82,19 @@ module Box2D
82
82
  layout(
83
83
  :index1, :int,
84
84
  :world0, :ushort,
85
- :revision, :ushort,
85
+ :generation, :ushort,
86
86
  )
87
87
  def index1 = self[:index1]
88
88
  def index1=(v) self[:index1] = v end
89
89
  def world0 = self[:world0]
90
90
  def world0=(v) self[:world0] = v end
91
- def revision = self[:revision]
92
- def revision=(v) self[:revision] = v end
93
- def self.create_as(_index1_, _world0_, _revision_)
91
+ def generation = self[:generation]
92
+ def generation=(v) self[:generation] = v end
93
+ def self.create_as(_index1_, _world0_, _generation_)
94
94
  instance = ChainId.new
95
95
  instance[:index1] = _index1_
96
96
  instance[:world0] = _world0_
97
- instance[:revision] = _revision_
97
+ instance[:generation] = _generation_
98
98
  instance
99
99
  end
100
100
  end
@@ -103,19 +103,19 @@ module Box2D
103
103
  layout(
104
104
  :index1, :int,
105
105
  :world0, :ushort,
106
- :revision, :ushort,
106
+ :generation, :ushort,
107
107
  )
108
108
  def index1 = self[:index1]
109
109
  def index1=(v) self[:index1] = v end
110
110
  def world0 = self[:world0]
111
111
  def world0=(v) self[:world0] = v end
112
- def revision = self[:revision]
113
- def revision=(v) self[:revision] = v end
114
- def self.create_as(_index1_, _world0_, _revision_)
112
+ def generation = self[:generation]
113
+ def generation=(v) self[:generation] = v end
114
+ def self.create_as(_index1_, _world0_, _generation_)
115
115
  instance = JointId.new
116
116
  instance[:index1] = _index1_
117
117
  instance[:world0] = _world0_
118
- instance[:revision] = _revision_
118
+ instance[:generation] = _generation_
119
119
  instance
120
120
  end
121
121
  end
data/lib/box2d_main.rb CHANGED
@@ -66,6 +66,8 @@ module Box2D
66
66
  [:World_GetCounters, :b2World_GetCounters, [WorldId.by_value], Counters.by_value],
67
67
  [:World_SetUserData, :b2World_SetUserData, [WorldId.by_value, :pointer], :void],
68
68
  [:World_GetUserData, :b2World_GetUserData, [WorldId.by_value], :pointer],
69
+ [:World_SetFrictionCallback, :b2World_SetFrictionCallback, [WorldId.by_value, :pointer], :void],
70
+ [:World_SetRestitutionCallback, :b2World_SetRestitutionCallback, [WorldId.by_value, :pointer], :void],
69
71
  [:World_DumpMemoryStats, :b2World_DumpMemoryStats, [WorldId.by_value], :void],
70
72
  [:World_RebuildStaticTree, :b2World_RebuildStaticTree, [WorldId.by_value], :void],
71
73
  [:World_EnableSpeculative, :b2World_EnableSpeculative, [WorldId.by_value, :bool], :void],
@@ -74,6 +76,8 @@ module Box2D
74
76
  [:Body_IsValid, :b2Body_IsValid, [BodyId.by_value], :bool],
75
77
  [:Body_GetType, :b2Body_GetType, [BodyId.by_value], :int],
76
78
  [:Body_SetType, :b2Body_SetType, [BodyId.by_value, :int], :void],
79
+ [:Body_SetName, :b2Body_SetName, [BodyId.by_value, :pointer], :void],
80
+ [:Body_GetName, :b2Body_GetName, [BodyId.by_value], :pointer],
77
81
  [:Body_SetUserData, :b2Body_SetUserData, [BodyId.by_value, :pointer], :void],
78
82
  [:Body_GetUserData, :b2Body_GetUserData, [BodyId.by_value], :pointer],
79
83
  [:Body_GetPosition, :b2Body_GetPosition, [BodyId.by_value], Vec2.by_value],
@@ -88,6 +92,8 @@ module Box2D
88
92
  [:Body_GetAngularVelocity, :b2Body_GetAngularVelocity, [BodyId.by_value], :float],
89
93
  [:Body_SetLinearVelocity, :b2Body_SetLinearVelocity, [BodyId.by_value, Vec2.by_value], :void],
90
94
  [:Body_SetAngularVelocity, :b2Body_SetAngularVelocity, [BodyId.by_value, :float], :void],
95
+ [:Body_GetLocalPointVelocity, :b2Body_GetLocalPointVelocity, [BodyId.by_value, Vec2.by_value], Vec2.by_value],
96
+ [:Body_GetWorldPointVelocity, :b2Body_GetWorldPointVelocity, [BodyId.by_value, Vec2.by_value], Vec2.by_value],
91
97
  [:Body_ApplyForce, :b2Body_ApplyForce, [BodyId.by_value, Vec2.by_value, Vec2.by_value, :bool], :void],
92
98
  [:Body_ApplyForceToCenter, :b2Body_ApplyForceToCenter, [BodyId.by_value, Vec2.by_value, :bool], :void],
93
99
  [:Body_ApplyTorque, :b2Body_ApplyTorque, [BodyId.by_value, :float, :bool], :void],
@@ -120,7 +126,6 @@ module Box2D
120
126
  [:Body_IsFixedRotation, :b2Body_IsFixedRotation, [BodyId.by_value], :bool],
121
127
  [:Body_SetBullet, :b2Body_SetBullet, [BodyId.by_value, :bool], :void],
122
128
  [:Body_IsBullet, :b2Body_IsBullet, [BodyId.by_value], :bool],
123
- [:Body_EnableSensorEvents, :b2Body_EnableSensorEvents, [BodyId.by_value, :bool], :void],
124
129
  [:Body_EnableContactEvents, :b2Body_EnableContactEvents, [BodyId.by_value, :bool], :void],
125
130
  [:Body_EnableHitEvents, :b2Body_EnableHitEvents, [BodyId.by_value, :bool], :void],
126
131
  [:Body_GetWorld, :b2Body_GetWorld, [BodyId.by_value], WorldId.by_value],
@@ -149,10 +154,10 @@ module Box2D
149
154
  [:Shape_GetFriction, :b2Shape_GetFriction, [ShapeId.by_value], :float],
150
155
  [:Shape_SetRestitution, :b2Shape_SetRestitution, [ShapeId.by_value, :float], :void],
151
156
  [:Shape_GetRestitution, :b2Shape_GetRestitution, [ShapeId.by_value], :float],
157
+ [:Shape_SetMaterial, :b2Shape_SetMaterial, [ShapeId.by_value, :int], :void],
158
+ [:Shape_GetMaterial, :b2Shape_GetMaterial, [ShapeId.by_value], :int],
152
159
  [:Shape_GetFilter, :b2Shape_GetFilter, [ShapeId.by_value], Filter.by_value],
153
160
  [:Shape_SetFilter, :b2Shape_SetFilter, [ShapeId.by_value, Filter.by_value], :void],
154
- [:Shape_EnableSensorEvents, :b2Shape_EnableSensorEvents, [ShapeId.by_value, :bool], :void],
155
- [:Shape_AreSensorEventsEnabled, :b2Shape_AreSensorEventsEnabled, [ShapeId.by_value], :bool],
156
161
  [:Shape_EnableContactEvents, :b2Shape_EnableContactEvents, [ShapeId.by_value, :bool], :void],
157
162
  [:Shape_AreContactEventsEnabled, :b2Shape_AreContactEventsEnabled, [ShapeId.by_value], :bool],
158
163
  [:Shape_EnablePreSolveEvents, :b2Shape_EnablePreSolveEvents, [ShapeId.by_value, :bool], :void],
@@ -176,6 +181,7 @@ module Box2D
176
181
  [:Shape_GetSensorCapacity, :b2Shape_GetSensorCapacity, [ShapeId.by_value], :int],
177
182
  [:Shape_GetSensorOverlaps, :b2Shape_GetSensorOverlaps, [ShapeId.by_value, :pointer, :int], :int],
178
183
  [:Shape_GetAABB, :b2Shape_GetAABB, [ShapeId.by_value], AABB.by_value],
184
+ [:Shape_GetMassData, :b2Shape_GetMassData, [ShapeId.by_value], MassData.by_value],
179
185
  [:Shape_GetClosestPoint, :b2Shape_GetClosestPoint, [ShapeId.by_value, Vec2.by_value], Vec2.by_value],
180
186
  [:CreateChain, :b2CreateChain, [BodyId.by_value, :pointer], ChainId.by_value],
181
187
  [:DestroyChain, :b2DestroyChain, [ChainId.by_value], :void],
@@ -186,6 +192,8 @@ module Box2D
186
192
  [:Chain_GetFriction, :b2Chain_GetFriction, [ChainId.by_value], :float],
187
193
  [:Chain_SetRestitution, :b2Chain_SetRestitution, [ChainId.by_value, :float], :void],
188
194
  [:Chain_GetRestitution, :b2Chain_GetRestitution, [ChainId.by_value], :float],
195
+ [:Chain_SetMaterial, :b2Chain_SetMaterial, [ChainId.by_value, :int], :void],
196
+ [:Chain_GetMaterial, :b2Chain_GetMaterial, [ChainId.by_value], :int],
189
197
  [:Chain_IsValid, :b2Chain_IsValid, [ChainId.by_value], :bool],
190
198
  [:DestroyJoint, :b2DestroyJoint, [JointId.by_value], :void],
191
199
  [:Joint_IsValid, :b2Joint_IsValid, [JointId.by_value], :bool],
data/lib/box2d_types.rb CHANGED
@@ -14,11 +14,6 @@ module Box2D
14
14
 
15
15
  # Enum
16
16
 
17
- MixingRule_mixAverage = 0
18
- MixingRule_mixGeometricMean = 1
19
- MixingRule_mixMultiply = 2
20
- MixingRule_mixMinimum = 3
21
- MixingRule_mixMaximum = 4
22
17
  BodyType_staticBody = 0
23
18
  BodyType_kinematicBody = 1
24
19
  BodyType_dynamicBody = 2
@@ -188,7 +183,8 @@ module Box2D
188
183
  typedef :pointer, :b2TaskCallback
189
184
  typedef :pointer, :b2EnqueueTaskCallback
190
185
  typedef :pointer, :b2FinishTaskCallback
191
- typedef :int, :b2MixingRule
186
+ typedef :pointer, :b2FrictionCallback
187
+ typedef :pointer, :b2RestitutionCallback
192
188
  typedef :int, :b2BodyType
193
189
  typedef :int, :b2ShapeType
194
190
  typedef :int, :b2JointType
@@ -241,15 +237,15 @@ module Box2D
241
237
  layout(
242
238
  :gravity, Vec2,
243
239
  :restitutionThreshold, :float,
244
- :contactPushSpeed, :float,
245
240
  :hitEventThreshold, :float,
246
241
  :contactHertz, :float,
247
242
  :contactDampingRatio, :float,
243
+ :contactPushMaxSpeed, :float,
248
244
  :jointHertz, :float,
249
245
  :jointDampingRatio, :float,
250
246
  :maximumLinearSpeed, :float,
251
- :frictionMixingRule, :int,
252
- :restitutionMixingRule, :int,
247
+ :frictionCallback, :pointer,
248
+ :restitutionCallback, :pointer,
253
249
  :enableSleep, :bool,
254
250
  :enableContinuous, :bool,
255
251
  :workerCount, :int,
@@ -263,24 +259,24 @@ module Box2D
263
259
  def gravity=(v) self[:gravity] = v end
264
260
  def restitutionThreshold = self[:restitutionThreshold]
265
261
  def restitutionThreshold=(v) self[:restitutionThreshold] = v end
266
- def contactPushSpeed = self[:contactPushSpeed]
267
- def contactPushSpeed=(v) self[:contactPushSpeed] = v end
268
262
  def hitEventThreshold = self[:hitEventThreshold]
269
263
  def hitEventThreshold=(v) self[:hitEventThreshold] = v end
270
264
  def contactHertz = self[:contactHertz]
271
265
  def contactHertz=(v) self[:contactHertz] = v end
272
266
  def contactDampingRatio = self[:contactDampingRatio]
273
267
  def contactDampingRatio=(v) self[:contactDampingRatio] = v end
268
+ def contactPushMaxSpeed = self[:contactPushMaxSpeed]
269
+ def contactPushMaxSpeed=(v) self[:contactPushMaxSpeed] = v end
274
270
  def jointHertz = self[:jointHertz]
275
271
  def jointHertz=(v) self[:jointHertz] = v end
276
272
  def jointDampingRatio = self[:jointDampingRatio]
277
273
  def jointDampingRatio=(v) self[:jointDampingRatio] = v end
278
274
  def maximumLinearSpeed = self[:maximumLinearSpeed]
279
275
  def maximumLinearSpeed=(v) self[:maximumLinearSpeed] = v end
280
- def frictionMixingRule = self[:frictionMixingRule]
281
- def frictionMixingRule=(v) self[:frictionMixingRule] = v end
282
- def restitutionMixingRule = self[:restitutionMixingRule]
283
- def restitutionMixingRule=(v) self[:restitutionMixingRule] = v end
276
+ def frictionCallback = self[:frictionCallback]
277
+ def frictionCallback=(v) self[:frictionCallback] = v end
278
+ def restitutionCallback = self[:restitutionCallback]
279
+ def restitutionCallback=(v) self[:restitutionCallback] = v end
284
280
  def enableSleep = self[:enableSleep]
285
281
  def enableSleep=(v) self[:enableSleep] = v end
286
282
  def enableContinuous = self[:enableContinuous]
@@ -297,19 +293,19 @@ module Box2D
297
293
  def userData=(v) self[:userData] = v end
298
294
  def internalValue = self[:internalValue]
299
295
  def internalValue=(v) self[:internalValue] = v end
300
- def self.create_as(_gravity_, _restitutionThreshold_, _contactPushSpeed_, _hitEventThreshold_, _contactHertz_, _contactDampingRatio_, _jointHertz_, _jointDampingRatio_, _maximumLinearSpeed_, _frictionMixingRule_, _restitutionMixingRule_, _enableSleep_, _enableContinuous_, _workerCount_, _enqueueTask_, _finishTask_, _userTaskContext_, _userData_, _internalValue_)
296
+ def self.create_as(_gravity_, _restitutionThreshold_, _hitEventThreshold_, _contactHertz_, _contactDampingRatio_, _contactPushMaxSpeed_, _jointHertz_, _jointDampingRatio_, _maximumLinearSpeed_, _frictionCallback_, _restitutionCallback_, _enableSleep_, _enableContinuous_, _workerCount_, _enqueueTask_, _finishTask_, _userTaskContext_, _userData_, _internalValue_)
301
297
  instance = WorldDef.new
302
298
  instance[:gravity] = _gravity_
303
299
  instance[:restitutionThreshold] = _restitutionThreshold_
304
- instance[:contactPushSpeed] = _contactPushSpeed_
305
300
  instance[:hitEventThreshold] = _hitEventThreshold_
306
301
  instance[:contactHertz] = _contactHertz_
307
302
  instance[:contactDampingRatio] = _contactDampingRatio_
303
+ instance[:contactPushMaxSpeed] = _contactPushMaxSpeed_
308
304
  instance[:jointHertz] = _jointHertz_
309
305
  instance[:jointDampingRatio] = _jointDampingRatio_
310
306
  instance[:maximumLinearSpeed] = _maximumLinearSpeed_
311
- instance[:frictionMixingRule] = _frictionMixingRule_
312
- instance[:restitutionMixingRule] = _restitutionMixingRule_
307
+ instance[:frictionCallback] = _frictionCallback_
308
+ instance[:restitutionCallback] = _restitutionCallback_
313
309
  instance[:enableSleep] = _enableSleep_
314
310
  instance[:enableContinuous] = _enableContinuous_
315
311
  instance[:workerCount] = _workerCount_
@@ -333,6 +329,7 @@ module Box2D
333
329
  :angularDamping, :float,
334
330
  :gravityScale, :float,
335
331
  :sleepThreshold, :float,
332
+ :name, :pointer,
336
333
  :userData, :pointer,
337
334
  :enableSleep, :bool,
338
335
  :isAwake, :bool,
@@ -360,6 +357,8 @@ module Box2D
360
357
  def gravityScale=(v) self[:gravityScale] = v end
361
358
  def sleepThreshold = self[:sleepThreshold]
362
359
  def sleepThreshold=(v) self[:sleepThreshold] = v end
360
+ def name = self[:name]
361
+ def name=(v) self[:name] = v end
363
362
  def userData = self[:userData]
364
363
  def userData=(v) self[:userData] = v end
365
364
  def enableSleep = self[:enableSleep]
@@ -376,7 +375,7 @@ module Box2D
376
375
  def allowFastRotation=(v) self[:allowFastRotation] = v end
377
376
  def internalValue = self[:internalValue]
378
377
  def internalValue=(v) self[:internalValue] = v end
379
- def self.create_as(_type_, _position_, _rotation_, _linearVelocity_, _angularVelocity_, _linearDamping_, _angularDamping_, _gravityScale_, _sleepThreshold_, _userData_, _enableSleep_, _isAwake_, _fixedRotation_, _isBullet_, _isEnabled_, _allowFastRotation_, _internalValue_)
378
+ def self.create_as(_type_, _position_, _rotation_, _linearVelocity_, _angularVelocity_, _linearDamping_, _angularDamping_, _gravityScale_, _sleepThreshold_, _name_, _userData_, _enableSleep_, _isAwake_, _fixedRotation_, _isBullet_, _isEnabled_, _allowFastRotation_, _internalValue_)
380
379
  instance = BodyDef.new
381
380
  instance[:type] = _type_
382
381
  instance[:position] = _position_
@@ -387,6 +386,7 @@ module Box2D
387
386
  instance[:angularDamping] = _angularDamping_
388
387
  instance[:gravityScale] = _gravityScale_
389
388
  instance[:sleepThreshold] = _sleepThreshold_
389
+ instance[:name] = _name_
390
390
  instance[:userData] = _userData_
391
391
  instance[:enableSleep] = _enableSleep_
392
392
  instance[:isAwake] = _isAwake_
@@ -443,11 +443,12 @@ module Box2D
443
443
  :friction, :float,
444
444
  :restitution, :float,
445
445
  :rollingResistance, :float,
446
+ :tangentSpeed, :float,
447
+ :material, :int,
446
448
  :density, :float,
447
449
  :filter, Filter,
448
450
  :customColor, :uint,
449
451
  :isSensor, :bool,
450
- :enableSensorEvents, :bool,
451
452
  :enableContactEvents, :bool,
452
453
  :enableHitEvents, :bool,
453
454
  :enablePreSolveEvents, :bool,
@@ -463,6 +464,10 @@ module Box2D
463
464
  def restitution=(v) self[:restitution] = v end
464
465
  def rollingResistance = self[:rollingResistance]
465
466
  def rollingResistance=(v) self[:rollingResistance] = v end
467
+ def tangentSpeed = self[:tangentSpeed]
468
+ def tangentSpeed=(v) self[:tangentSpeed] = v end
469
+ def material = self[:material]
470
+ def material=(v) self[:material] = v end
466
471
  def density = self[:density]
467
472
  def density=(v) self[:density] = v end
468
473
  def filter = self[:filter]
@@ -471,8 +476,6 @@ module Box2D
471
476
  def customColor=(v) self[:customColor] = v end
472
477
  def isSensor = self[:isSensor]
473
478
  def isSensor=(v) self[:isSensor] = v end
474
- def enableSensorEvents = self[:enableSensorEvents]
475
- def enableSensorEvents=(v) self[:enableSensorEvents] = v end
476
479
  def enableContactEvents = self[:enableContactEvents]
477
480
  def enableContactEvents=(v) self[:enableContactEvents] = v end
478
481
  def enableHitEvents = self[:enableHitEvents]
@@ -485,17 +488,18 @@ module Box2D
485
488
  def updateBodyMass=(v) self[:updateBodyMass] = v end
486
489
  def internalValue = self[:internalValue]
487
490
  def internalValue=(v) self[:internalValue] = v end
488
- def self.create_as(_userData_, _friction_, _restitution_, _rollingResistance_, _density_, _filter_, _customColor_, _isSensor_, _enableSensorEvents_, _enableContactEvents_, _enableHitEvents_, _enablePreSolveEvents_, _invokeContactCreation_, _updateBodyMass_, _internalValue_)
491
+ def self.create_as(_userData_, _friction_, _restitution_, _rollingResistance_, _tangentSpeed_, _material_, _density_, _filter_, _customColor_, _isSensor_, _enableContactEvents_, _enableHitEvents_, _enablePreSolveEvents_, _invokeContactCreation_, _updateBodyMass_, _internalValue_)
489
492
  instance = ShapeDef.new
490
493
  instance[:userData] = _userData_
491
494
  instance[:friction] = _friction_
492
495
  instance[:restitution] = _restitution_
493
496
  instance[:rollingResistance] = _rollingResistance_
497
+ instance[:tangentSpeed] = _tangentSpeed_
498
+ instance[:material] = _material_
494
499
  instance[:density] = _density_
495
500
  instance[:filter] = _filter_
496
501
  instance[:customColor] = _customColor_
497
502
  instance[:isSensor] = _isSensor_
498
- instance[:enableSensorEvents] = _enableSensorEvents_
499
503
  instance[:enableContactEvents] = _enableContactEvents_
500
504
  instance[:enableHitEvents] = _enableHitEvents_
501
505
  instance[:enablePreSolveEvents] = _enablePreSolveEvents_
@@ -506,15 +510,47 @@ module Box2D
506
510
  end
507
511
  end
508
512
 
513
+ class SurfaceMaterial < FFI::Struct
514
+ layout(
515
+ :friction, :float,
516
+ :restitution, :float,
517
+ :rollingResistance, :float,
518
+ :tangentSpeed, :float,
519
+ :material, :int,
520
+ :customColor, :uint,
521
+ )
522
+ def friction = self[:friction]
523
+ def friction=(v) self[:friction] = v end
524
+ def restitution = self[:restitution]
525
+ def restitution=(v) self[:restitution] = v end
526
+ def rollingResistance = self[:rollingResistance]
527
+ def rollingResistance=(v) self[:rollingResistance] = v end
528
+ def tangentSpeed = self[:tangentSpeed]
529
+ def tangentSpeed=(v) self[:tangentSpeed] = v end
530
+ def material = self[:material]
531
+ def material=(v) self[:material] = v end
532
+ def customColor = self[:customColor]
533
+ def customColor=(v) self[:customColor] = v end
534
+ def self.create_as(_friction_, _restitution_, _rollingResistance_, _tangentSpeed_, _material_, _customColor_)
535
+ instance = SurfaceMaterial.new
536
+ instance[:friction] = _friction_
537
+ instance[:restitution] = _restitution_
538
+ instance[:rollingResistance] = _rollingResistance_
539
+ instance[:tangentSpeed] = _tangentSpeed_
540
+ instance[:material] = _material_
541
+ instance[:customColor] = _customColor_
542
+ instance
543
+ end
544
+ end
545
+
509
546
  class ChainDef < FFI::Struct
510
547
  layout(
511
548
  :userData, :pointer,
512
549
  :points, :pointer,
513
550
  :count, :int,
514
- :friction, :float,
515
- :restitution, :float,
551
+ :materials, :pointer,
552
+ :materialCount, :int,
516
553
  :filter, Filter,
517
- :customColor, :uint,
518
554
  :isLoop, :bool,
519
555
  :internalValue, :int,
520
556
  )
@@ -524,27 +560,24 @@ module Box2D
524
560
  def points=(v) self[:points] = v end
525
561
  def count = self[:count]
526
562
  def count=(v) self[:count] = v end
527
- def friction = self[:friction]
528
- def friction=(v) self[:friction] = v end
529
- def restitution = self[:restitution]
530
- def restitution=(v) self[:restitution] = v end
563
+ def materials = self[:materials]
564
+ def materials=(v) self[:materials] = v end
565
+ def materialCount = self[:materialCount]
566
+ def materialCount=(v) self[:materialCount] = v end
531
567
  def filter = self[:filter]
532
568
  def filter=(v) self[:filter] = v end
533
- def customColor = self[:customColor]
534
- def customColor=(v) self[:customColor] = v end
535
569
  def isLoop = self[:isLoop]
536
570
  def isLoop=(v) self[:isLoop] = v end
537
571
  def internalValue = self[:internalValue]
538
572
  def internalValue=(v) self[:internalValue] = v end
539
- def self.create_as(_userData_, _points_, _count_, _friction_, _restitution_, _filter_, _customColor_, _isLoop_, _internalValue_)
573
+ def self.create_as(_userData_, _points_, _count_, _materials_, _materialCount_, _filter_, _isLoop_, _internalValue_)
540
574
  instance = ChainDef.new
541
575
  instance[:userData] = _userData_
542
576
  instance[:points] = _points_
543
577
  instance[:count] = _count_
544
- instance[:friction] = _friction_
545
- instance[:restitution] = _restitution_
578
+ instance[:materials] = _materials_
579
+ instance[:materialCount] = _materialCount_
546
580
  instance[:filter] = _filter_
547
- instance[:customColor] = _customColor_
548
581
  instance[:isLoop] = _isLoop_
549
582
  instance[:internalValue] = _internalValue_
550
583
  instance
@@ -557,24 +590,24 @@ module Box2D
557
590
  :pairs, :float,
558
591
  :collide, :float,
559
592
  :solve, :float,
560
- :buildIslands, :float,
593
+ :mergeIslands, :float,
594
+ :prepareStages, :float,
561
595
  :solveConstraints, :float,
562
- :prepareTasks, :float,
563
- :solverTasks, :float,
564
596
  :prepareConstraints, :float,
565
597
  :integrateVelocities, :float,
566
598
  :warmStart, :float,
567
- :solveVelocities, :float,
599
+ :solveImpulses, :float,
568
600
  :integratePositions, :float,
569
- :relaxVelocities, :float,
601
+ :relaxImpulses, :float,
570
602
  :applyRestitution, :float,
571
603
  :storeImpulses, :float,
572
- :finalizeBodies, :float,
573
604
  :splitIslands, :float,
574
- :sleepIslands, :float,
605
+ :transforms, :float,
575
606
  :hitEvents, :float,
576
- :broadphase, :float,
577
- :continuous, :float,
607
+ :refit, :float,
608
+ :bullets, :float,
609
+ :sleepIslands, :float,
610
+ :sensors, :float,
578
611
  )
579
612
  def step = self[:step]
580
613
  def step=(v) self[:step] = v end
@@ -584,66 +617,66 @@ module Box2D
584
617
  def collide=(v) self[:collide] = v end
585
618
  def solve = self[:solve]
586
619
  def solve=(v) self[:solve] = v end
587
- def buildIslands = self[:buildIslands]
588
- def buildIslands=(v) self[:buildIslands] = v end
620
+ def mergeIslands = self[:mergeIslands]
621
+ def mergeIslands=(v) self[:mergeIslands] = v end
622
+ def prepareStages = self[:prepareStages]
623
+ def prepareStages=(v) self[:prepareStages] = v end
589
624
  def solveConstraints = self[:solveConstraints]
590
625
  def solveConstraints=(v) self[:solveConstraints] = v end
591
- def prepareTasks = self[:prepareTasks]
592
- def prepareTasks=(v) self[:prepareTasks] = v end
593
- def solverTasks = self[:solverTasks]
594
- def solverTasks=(v) self[:solverTasks] = v end
595
626
  def prepareConstraints = self[:prepareConstraints]
596
627
  def prepareConstraints=(v) self[:prepareConstraints] = v end
597
628
  def integrateVelocities = self[:integrateVelocities]
598
629
  def integrateVelocities=(v) self[:integrateVelocities] = v end
599
630
  def warmStart = self[:warmStart]
600
631
  def warmStart=(v) self[:warmStart] = v end
601
- def solveVelocities = self[:solveVelocities]
602
- def solveVelocities=(v) self[:solveVelocities] = v end
632
+ def solveImpulses = self[:solveImpulses]
633
+ def solveImpulses=(v) self[:solveImpulses] = v end
603
634
  def integratePositions = self[:integratePositions]
604
635
  def integratePositions=(v) self[:integratePositions] = v end
605
- def relaxVelocities = self[:relaxVelocities]
606
- def relaxVelocities=(v) self[:relaxVelocities] = v end
636
+ def relaxImpulses = self[:relaxImpulses]
637
+ def relaxImpulses=(v) self[:relaxImpulses] = v end
607
638
  def applyRestitution = self[:applyRestitution]
608
639
  def applyRestitution=(v) self[:applyRestitution] = v end
609
640
  def storeImpulses = self[:storeImpulses]
610
641
  def storeImpulses=(v) self[:storeImpulses] = v end
611
- def finalizeBodies = self[:finalizeBodies]
612
- def finalizeBodies=(v) self[:finalizeBodies] = v end
613
642
  def splitIslands = self[:splitIslands]
614
643
  def splitIslands=(v) self[:splitIslands] = v end
615
- def sleepIslands = self[:sleepIslands]
616
- def sleepIslands=(v) self[:sleepIslands] = v end
644
+ def transforms = self[:transforms]
645
+ def transforms=(v) self[:transforms] = v end
617
646
  def hitEvents = self[:hitEvents]
618
647
  def hitEvents=(v) self[:hitEvents] = v end
619
- def broadphase = self[:broadphase]
620
- def broadphase=(v) self[:broadphase] = v end
621
- def continuous = self[:continuous]
622
- def continuous=(v) self[:continuous] = v end
623
- def self.create_as(_step_, _pairs_, _collide_, _solve_, _buildIslands_, _solveConstraints_, _prepareTasks_, _solverTasks_, _prepareConstraints_, _integrateVelocities_, _warmStart_, _solveVelocities_, _integratePositions_, _relaxVelocities_, _applyRestitution_, _storeImpulses_, _finalizeBodies_, _splitIslands_, _sleepIslands_, _hitEvents_, _broadphase_, _continuous_)
648
+ def refit = self[:refit]
649
+ def refit=(v) self[:refit] = v end
650
+ def bullets = self[:bullets]
651
+ def bullets=(v) self[:bullets] = v end
652
+ def sleepIslands = self[:sleepIslands]
653
+ def sleepIslands=(v) self[:sleepIslands] = v end
654
+ def sensors = self[:sensors]
655
+ def sensors=(v) self[:sensors] = v end
656
+ def self.create_as(_step_, _pairs_, _collide_, _solve_, _mergeIslands_, _prepareStages_, _solveConstraints_, _prepareConstraints_, _integrateVelocities_, _warmStart_, _solveImpulses_, _integratePositions_, _relaxImpulses_, _applyRestitution_, _storeImpulses_, _splitIslands_, _transforms_, _hitEvents_, _refit_, _bullets_, _sleepIslands_, _sensors_)
624
657
  instance = Profile.new
625
658
  instance[:step] = _step_
626
659
  instance[:pairs] = _pairs_
627
660
  instance[:collide] = _collide_
628
661
  instance[:solve] = _solve_
629
- instance[:buildIslands] = _buildIslands_
662
+ instance[:mergeIslands] = _mergeIslands_
663
+ instance[:prepareStages] = _prepareStages_
630
664
  instance[:solveConstraints] = _solveConstraints_
631
- instance[:prepareTasks] = _prepareTasks_
632
- instance[:solverTasks] = _solverTasks_
633
665
  instance[:prepareConstraints] = _prepareConstraints_
634
666
  instance[:integrateVelocities] = _integrateVelocities_
635
667
  instance[:warmStart] = _warmStart_
636
- instance[:solveVelocities] = _solveVelocities_
668
+ instance[:solveImpulses] = _solveImpulses_
637
669
  instance[:integratePositions] = _integratePositions_
638
- instance[:relaxVelocities] = _relaxVelocities_
670
+ instance[:relaxImpulses] = _relaxImpulses_
639
671
  instance[:applyRestitution] = _applyRestitution_
640
672
  instance[:storeImpulses] = _storeImpulses_
641
- instance[:finalizeBodies] = _finalizeBodies_
642
673
  instance[:splitIslands] = _splitIslands_
643
- instance[:sleepIslands] = _sleepIslands_
674
+ instance[:transforms] = _transforms_
644
675
  instance[:hitEvents] = _hitEvents_
645
- instance[:broadphase] = _broadphase_
646
- instance[:continuous] = _continuous_
676
+ instance[:refit] = _refit_
677
+ instance[:bullets] = _bullets_
678
+ instance[:sleepIslands] = _sleepIslands_
679
+ instance[:sensors] = _sensors_
647
680
  instance
648
681
  end
649
682
  end
@@ -1462,6 +1495,7 @@ module Box2D
1462
1495
  :drawJointExtras, :bool,
1463
1496
  :drawAABBs, :bool,
1464
1497
  :drawMass, :bool,
1498
+ :drawBodyNames, :bool,
1465
1499
  :drawContacts, :bool,
1466
1500
  :drawGraphColors, :bool,
1467
1501
  :drawContactNormals, :bool,
@@ -1501,6 +1535,8 @@ module Box2D
1501
1535
  def drawAABBs=(v) self[:drawAABBs] = v end
1502
1536
  def drawMass = self[:drawMass]
1503
1537
  def drawMass=(v) self[:drawMass] = v end
1538
+ def drawBodyNames = self[:drawBodyNames]
1539
+ def drawBodyNames=(v) self[:drawBodyNames] = v end
1504
1540
  def drawContacts = self[:drawContacts]
1505
1541
  def drawContacts=(v) self[:drawContacts] = v end
1506
1542
  def drawGraphColors = self[:drawGraphColors]
@@ -1513,7 +1549,7 @@ module Box2D
1513
1549
  def drawFrictionImpulses=(v) self[:drawFrictionImpulses] = v end
1514
1550
  def context = self[:context]
1515
1551
  def context=(v) self[:context] = v end
1516
- def self.create_as(_DrawPolygon_, _DrawSolidPolygon_, _DrawCircle_, _DrawSolidCircle_, _DrawSolidCapsule_, _DrawSegment_, _DrawTransform_, _DrawPoint_, _DrawString_, _drawingBounds_, _useDrawingBounds_, _drawShapes_, _drawJoints_, _drawJointExtras_, _drawAABBs_, _drawMass_, _drawContacts_, _drawGraphColors_, _drawContactNormals_, _drawContactImpulses_, _drawFrictionImpulses_, _context_)
1552
+ def self.create_as(_DrawPolygon_, _DrawSolidPolygon_, _DrawCircle_, _DrawSolidCircle_, _DrawSolidCapsule_, _DrawSegment_, _DrawTransform_, _DrawPoint_, _DrawString_, _drawingBounds_, _useDrawingBounds_, _drawShapes_, _drawJoints_, _drawJointExtras_, _drawAABBs_, _drawMass_, _drawBodyNames_, _drawContacts_, _drawGraphColors_, _drawContactNormals_, _drawContactImpulses_, _drawFrictionImpulses_, _context_)
1517
1553
  instance = DebugDraw.new
1518
1554
  instance[:DrawPolygon] = _DrawPolygon_
1519
1555
  instance[:DrawSolidPolygon] = _DrawSolidPolygon_
@@ -1531,6 +1567,7 @@ module Box2D
1531
1567
  instance[:drawJointExtras] = _drawJointExtras_
1532
1568
  instance[:drawAABBs] = _drawAABBs_
1533
1569
  instance[:drawMass] = _drawMass_
1570
+ instance[:drawBodyNames] = _drawBodyNames_
1534
1571
  instance[:drawContacts] = _drawContacts_
1535
1572
  instance[:drawGraphColors] = _drawGraphColors_
1536
1573
  instance[:drawContactNormals] = _drawContactNormals_
@@ -1551,6 +1588,7 @@ module Box2D
1551
1588
  [:DefaultFilter, :b2DefaultFilter, [], Filter.by_value],
1552
1589
  [:DefaultQueryFilter, :b2DefaultQueryFilter, [], QueryFilter.by_value],
1553
1590
  [:DefaultShapeDef, :b2DefaultShapeDef, [], ShapeDef.by_value],
1591
+ [:DefaultSurfaceMaterial, :b2DefaultSurfaceMaterial, [], SurfaceMaterial.by_value],
1554
1592
  [:DefaultChainDef, :b2DefaultChainDef, [], ChainDef.by_value],
1555
1593
  [:DefaultDistanceJointDef, :b2DefaultDistanceJointDef, [], DistanceJointDef.by_value],
1556
1594
  [:DefaultMotorJointDef, :b2DefaultMotorJointDef, [], MotorJointDef.by_value],
Binary file
Binary file
data/lib/libbox2d.dll CHANGED
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: box2d-bindings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaiorabbit
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-01 00:00:00.000000000 Z
10
+ date: 2025-02-01 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: ffi
@@ -38,7 +38,6 @@ files:
38
38
  - lib/box2d.rb
39
39
  - lib/box2d_base.rb
40
40
  - lib/box2d_collision.rb
41
- - lib/box2d_collision_inline.rb
42
41
  - lib/box2d_helper.rb
43
42
  - lib/box2d_id.rb
44
43
  - lib/box2d_id_inline.rb
@@ -1,47 +0,0 @@
1
- # Ruby-Box2D : Yet another Box2D wrapper for Ruby
2
- #
3
- # * https://github.com/vaiorabbit/box2d-bindings
4
- #
5
- # [NOTICE] Autogenerated. Do not edit.
6
-
7
- require 'ffi'
8
-
9
- module Box2D
10
- extend FFI::Library
11
- # Define/Macro
12
-
13
-
14
- # Enum
15
-
16
-
17
- # Typedef
18
-
19
-
20
- # Struct
21
-
22
-
23
- # Function
24
-
25
- def self.setup_collision_inline_symbols(method_naming: :original)
26
- entries = [
27
- [:DynamicTree_GetUserData, :b2DynamicTree_GetUserData, [:pointer, :int], :int],
28
- [:DynamicTree_GetAABB, :b2DynamicTree_GetAABB, [:pointer, :int], AABB.by_value],
29
- ]
30
- entries.each do |entry|
31
- api_name = if method_naming == :snake_case
32
- snake_case_name = entry[0].to_s.gsub(/([A-Z]+)([A-Z0-9][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z0-9])/, '\1_\2').downcase
33
- snake_case_name.gsub!('vector_3', 'vector3_') if snake_case_name.include?('vector_3')
34
- snake_case_name.gsub!('vector_2', 'vector2_') if snake_case_name.include?('vector_2')
35
- snake_case_name.chop! if snake_case_name.end_with?('_')
36
- snake_case_name.to_sym
37
- else
38
- entry[0]
39
- end
40
- attach_function api_name, entry[1], entry[2], entry[3]
41
- rescue FFI::NotFoundError => e
42
- warn "[Warning] Failed to import #{entry[0]} (#{e})."
43
- end
44
- end
45
-
46
- end
47
-