box2d-bindings 0.1.0-x86_64-darwin → 0.1.2-x86_64-darwin

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
  SHA256:
3
- metadata.gz: 0371ee18574437aa2776807a9c378383b4e1d4a852784651e9fbb77497c03164
4
- data.tar.gz: b45721ea1c2df7baf512af6d29733c2a2e1bb08311ce67013db275cbe773977d
3
+ metadata.gz: 2b65c081606773daefdae56b9dfb025cff5112538d27502f145f780a168d92d4
4
+ data.tar.gz: 9ff0ed5eff35614b2cb2c0a1dbf722718c468886c807951d3121afebbe724b44
5
5
  SHA512:
6
- metadata.gz: 4f1e934383d61bc477184316c4e2447f0b7ca445490f116519127f7c000ed37c0b6b399d5410a8b8c95f9c5732c5bae58b6597d7e9e91e5ad777fc98c449e071
7
- data.tar.gz: c5dccefb0828a85963702fad3c37bd937717ccf392ff35782472e8858675494de962fb8d1f32e9754079c3d0a0add8fb1a8b27b6a32d744f3b85d1f1eef34076
6
+ metadata.gz: 8c7a18c7f22f315283804c37a8f42ffc422f52c574e37c306d090594b3351a9fb57d3b82c063f55f26bd94e529d19aff15d752072a7bc3da3dc5cfafa8c8e06d
7
+ data.tar.gz: 763a3945c959fb676a15004a9acff228b83124571e082f28c6dc860ac7d7dab5341fc49d3eb18a20f385536ec290d7bf56e4e4d06309ba7486a34bc5ac83f06b
data/ChangeLog CHANGED
@@ -1,3 +1,13 @@
1
+ 2025-05-11 vaiorabbit <http://twitter.com/vaiorabbit>
2
+
3
+ * https://github.com/erincatto/box2d/commit/2d088533b921e912c18c654f8b46c43e04ad0ca8
4
+
5
+ 2025-02-01 vaiorabbit <http://twitter.com/vaiorabbit>
6
+
7
+ * https://github.com/erincatto/box2d/commit/28adacf82377d4113f2ed00586141463244b9d10
8
+ * Updated the helper function to use the latest version of Box2D.
9
+ * Added sample_compound.rb
10
+
1
11
  2024-12-29 vaiorabbit <http://twitter.com/vaiorabbit>
2
12
 
3
13
  * 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-05-11
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
 
@@ -65,13 +52,11 @@ module Box2D
65
52
  [:SetAllocator, :b2SetAllocator, [:pointer, :pointer], :void],
66
53
  [:GetByteCount, :b2GetByteCount, [], :int],
67
54
  [:SetAssertFcn, :b2SetAssertFcn, [:pointer], :void],
68
- [:InternalAssertFcn, :b2InternalAssertFcn, [:pointer, :pointer, :int], :int],
69
55
  [:GetVersion, :b2GetVersion, [], Version.by_value],
70
- [:CreateTimer, :b2CreateTimer, [], Timer.by_value],
71
- [:GetTicks, :b2GetTicks, [:pointer], :long_long],
72
- [:GetMilliseconds, :b2GetMilliseconds, [:pointer], :float],
56
+ [:InternalAssertFcn, :b2InternalAssertFcn, [:pointer, :pointer, :int], :int],
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
  ]
@@ -141,13 +141,11 @@ module Box2D
141
141
  end
142
142
  end
143
143
 
144
- class ShapeCastInput < FFI::Struct
144
+ class ShapeProxy < FFI::Struct
145
145
  layout(
146
146
  :points, [Vec2, 8],
147
147
  :count, :int,
148
148
  :radius, :float,
149
- :translation, Vec2,
150
- :maxFraction, :float,
151
149
  )
152
150
  def points = self[:points]
153
151
  def points=(v) self[:points] = v end
@@ -155,17 +153,36 @@ module Box2D
155
153
  def count=(v) self[:count] = v end
156
154
  def radius = self[:radius]
157
155
  def radius=(v) self[:radius] = v end
156
+ def self.create_as(_points_, _count_, _radius_)
157
+ instance = ShapeProxy.new
158
+ instance[:points] = _points_
159
+ instance[:count] = _count_
160
+ instance[:radius] = _radius_
161
+ instance
162
+ end
163
+ end
164
+
165
+ class ShapeCastInput < FFI::Struct
166
+ layout(
167
+ :proxy, ShapeProxy,
168
+ :translation, Vec2,
169
+ :maxFraction, :float,
170
+ :canEncroach, :bool,
171
+ )
172
+ def proxy = self[:proxy]
173
+ def proxy=(v) self[:proxy] = v end
158
174
  def translation = self[:translation]
159
175
  def translation=(v) self[:translation] = v end
160
176
  def maxFraction = self[:maxFraction]
161
177
  def maxFraction=(v) self[:maxFraction] = v end
162
- def self.create_as(_points_, _count_, _radius_, _translation_, _maxFraction_)
178
+ def canEncroach = self[:canEncroach]
179
+ def canEncroach=(v) self[:canEncroach] = v end
180
+ def self.create_as(_proxy_, _translation_, _maxFraction_, _canEncroach_)
163
181
  instance = ShapeCastInput.new
164
- instance[:points] = _points_
165
- instance[:count] = _count_
166
- instance[:radius] = _radius_
182
+ instance[:proxy] = _proxy_
167
183
  instance[:translation] = _translation_
168
184
  instance[:maxFraction] = _maxFraction_
185
+ instance[:canEncroach] = _canEncroach_
169
186
  instance
170
187
  end
171
188
  end
@@ -358,27 +375,6 @@ module Box2D
358
375
  end
359
376
  end
360
377
 
361
- class ShapeProxy < FFI::Struct
362
- layout(
363
- :points, [Vec2, 8],
364
- :count, :int,
365
- :radius, :float,
366
- )
367
- def points = self[:points]
368
- def points=(v) self[:points] = v end
369
- def count = self[:count]
370
- def count=(v) self[:count] = v end
371
- def radius = self[:radius]
372
- def radius=(v) self[:radius] = v end
373
- def self.create_as(_points_, _count_, _radius_)
374
- instance = ShapeProxy.new
375
- instance[:points] = _points_
376
- instance[:count] = _count_
377
- instance[:radius] = _radius_
378
- instance
379
- end
380
- end
381
-
382
378
  class DistanceInput < FFI::Struct
383
379
  layout(
384
380
  :proxyA, ShapeProxy,
@@ -412,6 +408,7 @@ module Box2D
412
408
  layout(
413
409
  :pointA, Vec2,
414
410
  :pointB, Vec2,
411
+ :normal, Vec2,
415
412
  :distance, :float,
416
413
  :iterations, :int,
417
414
  :simplexCount, :int,
@@ -420,16 +417,19 @@ module Box2D
420
417
  def pointA=(v) self[:pointA] = v end
421
418
  def pointB = self[:pointB]
422
419
  def pointB=(v) self[:pointB] = v end
420
+ def normal = self[:normal]
421
+ def normal=(v) self[:normal] = v end
423
422
  def distance = self[:distance]
424
423
  def distance=(v) self[:distance] = v end
425
424
  def iterations = self[:iterations]
426
425
  def iterations=(v) self[:iterations] = v end
427
426
  def simplexCount = self[:simplexCount]
428
427
  def simplexCount=(v) self[:simplexCount] = v end
429
- def self.create_as(_pointA_, _pointB_, _distance_, _iterations_, _simplexCount_)
428
+ def self.create_as(_pointA_, _pointB_, _normal_, _distance_, _iterations_, _simplexCount_)
430
429
  instance = DistanceOutput.new
431
430
  instance[:pointA] = _pointA_
432
431
  instance[:pointB] = _pointB_
432
+ instance[:normal] = _normal_
433
433
  instance[:distance] = _distance_
434
434
  instance[:iterations] = _iterations_
435
435
  instance[:simplexCount] = _simplexCount_
@@ -503,6 +503,7 @@ module Box2D
503
503
  :transformB, Transform,
504
504
  :translationB, Vec2,
505
505
  :maxFraction, :float,
506
+ :canEncroach, :bool,
506
507
  )
507
508
  def proxyA = self[:proxyA]
508
509
  def proxyA=(v) self[:proxyA] = v end
@@ -516,7 +517,9 @@ module Box2D
516
517
  def translationB=(v) self[:translationB] = v end
517
518
  def maxFraction = self[:maxFraction]
518
519
  def maxFraction=(v) self[:maxFraction] = v end
519
- def self.create_as(_proxyA_, _proxyB_, _transformA_, _transformB_, _translationB_, _maxFraction_)
520
+ def canEncroach = self[:canEncroach]
521
+ def canEncroach=(v) self[:canEncroach] = v end
522
+ def self.create_as(_proxyA_, _proxyB_, _transformA_, _transformB_, _translationB_, _maxFraction_, _canEncroach_)
520
523
  instance = ShapeCastPairInput.new
521
524
  instance[:proxyA] = _proxyA_
522
525
  instance[:proxyB] = _proxyB_
@@ -524,6 +527,7 @@ module Box2D
524
527
  instance[:transformB] = _transformB_
525
528
  instance[:translationB] = _translationB_
526
529
  instance[:maxFraction] = _maxFraction_
530
+ instance[:canEncroach] = _canEncroach_
527
531
  instance
528
532
  end
529
533
  end
@@ -611,7 +615,7 @@ module Box2D
611
615
  :separation, :float,
612
616
  :normalImpulse, :float,
613
617
  :tangentImpulse, :float,
614
- :maxNormalImpulse, :float,
618
+ :totalNormalImpulse, :float,
615
619
  :normalVelocity, :float,
616
620
  :id, :ushort,
617
621
  :persisted, :bool,
@@ -628,15 +632,15 @@ module Box2D
628
632
  def normalImpulse=(v) self[:normalImpulse] = v end
629
633
  def tangentImpulse = self[:tangentImpulse]
630
634
  def tangentImpulse=(v) self[:tangentImpulse] = v end
631
- def maxNormalImpulse = self[:maxNormalImpulse]
632
- def maxNormalImpulse=(v) self[:maxNormalImpulse] = v end
635
+ def totalNormalImpulse = self[:totalNormalImpulse]
636
+ def totalNormalImpulse=(v) self[:totalNormalImpulse] = v end
633
637
  def normalVelocity = self[:normalVelocity]
634
638
  def normalVelocity=(v) self[:normalVelocity] = v end
635
639
  def id = self[:id]
636
640
  def id=(v) self[:id] = v end
637
641
  def persisted = self[:persisted]
638
642
  def persisted=(v) self[:persisted] = v end
639
- def self.create_as(_point_, _anchorA_, _anchorB_, _separation_, _normalImpulse_, _tangentImpulse_, _maxNormalImpulse_, _normalVelocity_, _id_, _persisted_)
643
+ def self.create_as(_point_, _anchorA_, _anchorB_, _separation_, _normalImpulse_, _tangentImpulse_, _totalNormalImpulse_, _normalVelocity_, _id_, _persisted_)
640
644
  instance = ManifoldPoint.new
641
645
  instance[:point] = _point_
642
646
  instance[:anchorA] = _anchorA_
@@ -644,7 +648,7 @@ module Box2D
644
648
  instance[:separation] = _separation_
645
649
  instance[:normalImpulse] = _normalImpulse_
646
650
  instance[:tangentImpulse] = _tangentImpulse_
647
- instance[:maxNormalImpulse] = _maxNormalImpulse_
651
+ instance[:totalNormalImpulse] = _totalNormalImpulse_
648
652
  instance[:normalVelocity] = _normalVelocity_
649
653
  instance[:id] = _id_
650
654
  instance[:persisted] = _persisted_
@@ -654,20 +658,24 @@ module Box2D
654
658
 
655
659
  class Manifold < FFI::Struct
656
660
  layout(
657
- :points, [ManifoldPoint, 2],
658
661
  :normal, Vec2,
662
+ :rollingImpulse, :float,
663
+ :points, [ManifoldPoint, 2],
659
664
  :pointCount, :int,
660
665
  )
661
- def points = self[:points]
662
- def points=(v) self[:points] = v end
663
666
  def normal = self[:normal]
664
667
  def normal=(v) self[:normal] = v end
668
+ def rollingImpulse = self[:rollingImpulse]
669
+ def rollingImpulse=(v) self[:rollingImpulse] = v end
670
+ def points = self[:points]
671
+ def points=(v) self[:points] = v end
665
672
  def pointCount = self[:pointCount]
666
673
  def pointCount=(v) self[:pointCount] = v end
667
- def self.create_as(_points_, _normal_, _pointCount_)
674
+ def self.create_as(_normal_, _rollingImpulse_, _points_, _pointCount_)
668
675
  instance = Manifold.new
669
- instance[:points] = _points_
670
676
  instance[:normal] = _normal_
677
+ instance[:rollingImpulse] = _rollingImpulse_
678
+ instance[:points] = _points_
671
679
  instance[:pointCount] = _pointCount_
672
680
  instance
673
681
  end
@@ -743,6 +751,69 @@ module Box2D
743
751
  end
744
752
  end
745
753
 
754
+ class PlaneResult < FFI::Struct
755
+ layout(
756
+ :plane, Plane,
757
+ :point, Vec2,
758
+ :hit, :bool,
759
+ )
760
+ def plane = self[:plane]
761
+ def plane=(v) self[:plane] = v end
762
+ def point = self[:point]
763
+ def point=(v) self[:point] = v end
764
+ def hit = self[:hit]
765
+ def hit=(v) self[:hit] = v end
766
+ def self.create_as(_plane_, _point_, _hit_)
767
+ instance = PlaneResult.new
768
+ instance[:plane] = _plane_
769
+ instance[:point] = _point_
770
+ instance[:hit] = _hit_
771
+ instance
772
+ end
773
+ end
774
+
775
+ class CollisionPlane < FFI::Struct
776
+ layout(
777
+ :plane, Plane,
778
+ :pushLimit, :float,
779
+ :push, :float,
780
+ :clipVelocity, :bool,
781
+ )
782
+ def plane = self[:plane]
783
+ def plane=(v) self[:plane] = v end
784
+ def pushLimit = self[:pushLimit]
785
+ def pushLimit=(v) self[:pushLimit] = v end
786
+ def push = self[:push]
787
+ def push=(v) self[:push] = v end
788
+ def clipVelocity = self[:clipVelocity]
789
+ def clipVelocity=(v) self[:clipVelocity] = v end
790
+ def self.create_as(_plane_, _pushLimit_, _push_, _clipVelocity_)
791
+ instance = CollisionPlane.new
792
+ instance[:plane] = _plane_
793
+ instance[:pushLimit] = _pushLimit_
794
+ instance[:push] = _push_
795
+ instance[:clipVelocity] = _clipVelocity_
796
+ instance
797
+ end
798
+ end
799
+
800
+ class PlaneSolverResult < FFI::Struct
801
+ layout(
802
+ :position, Vec2,
803
+ :iterationCount, :int,
804
+ )
805
+ def position = self[:position]
806
+ def position=(v) self[:position] = v end
807
+ def iterationCount = self[:iterationCount]
808
+ def iterationCount=(v) self[:iterationCount] = v end
809
+ def self.create_as(_position_, _iterationCount_)
810
+ instance = PlaneSolverResult.new
811
+ instance[:position] = _position_
812
+ instance[:iterationCount] = _iterationCount_
813
+ instance
814
+ end
815
+ end
816
+
746
817
 
747
818
  # Function
748
819
 
@@ -782,6 +853,7 @@ module Box2D
782
853
  [:ShapeDistance, :b2ShapeDistance, [:pointer, :pointer, :pointer, :int], DistanceOutput.by_value],
783
854
  [:ShapeCast, :b2ShapeCast, [:pointer], CastOutput.by_value],
784
855
  [:MakeProxy, :b2MakeProxy, [:pointer, :int, :float], ShapeProxy.by_value],
856
+ [:MakeOffsetProxy, :b2MakeOffsetProxy, [:pointer, :int, :float, Vec2.by_value, Rot.by_value], ShapeProxy.by_value],
785
857
  [:GetSweepTransform, :b2GetSweepTransform, [:pointer, :float], Transform.by_value],
786
858
  [:TimeOfImpact, :b2TimeOfImpact, [:pointer], TOIOutput.by_value],
787
859
  [:CollideCircles, :b2CollideCircles, [:pointer, Transform.by_value, :pointer, Transform.by_value], Manifold.by_value],
@@ -798,19 +870,27 @@ module Box2D
798
870
  [:CollideChainSegmentAndPolygon, :b2CollideChainSegmentAndPolygon, [:pointer, Transform.by_value, :pointer, Transform.by_value, :pointer], Manifold.by_value],
799
871
  [:DynamicTree_Create, :b2DynamicTree_Create, [], DynamicTree.by_value],
800
872
  [:DynamicTree_Destroy, :b2DynamicTree_Destroy, [:pointer], :void],
801
- [:DynamicTree_CreateProxy, :b2DynamicTree_CreateProxy, [:pointer, AABB.by_value, :ulong_long, :int], :int],
873
+ [:DynamicTree_CreateProxy, :b2DynamicTree_CreateProxy, [:pointer, AABB.by_value, :ulong_long, :ulong_long], :int],
802
874
  [:DynamicTree_DestroyProxy, :b2DynamicTree_DestroyProxy, [:pointer, :int], :void],
803
875
  [:DynamicTree_MoveProxy, :b2DynamicTree_MoveProxy, [:pointer, :int, AABB.by_value], :void],
804
876
  [:DynamicTree_EnlargeProxy, :b2DynamicTree_EnlargeProxy, [:pointer, :int, AABB.by_value], :void],
877
+ [:DynamicTree_SetCategoryBits, :b2DynamicTree_SetCategoryBits, [:pointer, :int, :ulong_long], :void],
878
+ [:DynamicTree_GetCategoryBits, :b2DynamicTree_GetCategoryBits, [:pointer, :int], :ulong_long],
805
879
  [:DynamicTree_Query, :b2DynamicTree_Query, [:pointer, AABB.by_value, :ulong_long, :pointer, :pointer], TreeStats.by_value],
806
880
  [:DynamicTree_RayCast, :b2DynamicTree_RayCast, [:pointer, :pointer, :ulong_long, :pointer, :pointer], TreeStats.by_value],
807
881
  [:DynamicTree_ShapeCast, :b2DynamicTree_ShapeCast, [:pointer, :pointer, :ulong_long, :pointer, :pointer], TreeStats.by_value],
808
- [:DynamicTree_Validate, :b2DynamicTree_Validate, [:pointer], :void],
809
882
  [:DynamicTree_GetHeight, :b2DynamicTree_GetHeight, [:pointer], :int],
810
883
  [:DynamicTree_GetAreaRatio, :b2DynamicTree_GetAreaRatio, [:pointer], :float],
884
+ [:DynamicTree_GetRootBounds, :b2DynamicTree_GetRootBounds, [:pointer], AABB.by_value],
811
885
  [:DynamicTree_GetProxyCount, :b2DynamicTree_GetProxyCount, [:pointer], :int],
812
886
  [:DynamicTree_Rebuild, :b2DynamicTree_Rebuild, [:pointer, :bool], :int],
813
887
  [:DynamicTree_GetByteCount, :b2DynamicTree_GetByteCount, [:pointer], :int],
888
+ [:DynamicTree_GetUserData, :b2DynamicTree_GetUserData, [:pointer, :int], :ulong_long],
889
+ [:DynamicTree_GetAABB, :b2DynamicTree_GetAABB, [:pointer, :int], AABB.by_value],
890
+ [:DynamicTree_Validate, :b2DynamicTree_Validate, [:pointer], :void],
891
+ [:DynamicTree_ValidateNoEnlarged, :b2DynamicTree_ValidateNoEnlarged, [:pointer], :void],
892
+ [:SolvePlanes, :b2SolvePlanes, [Vec2.by_value, :pointer, :int], PlaneSolverResult.by_value],
893
+ [:ClipVector, :b2ClipVector, [Vec2.by_value, :pointer, :int], Vec2.by_value],
814
894
  ]
815
895
  entries.each do |entry|
816
896
  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
@@ -33,15 +33,12 @@ module Box2D
33
33
  [:World_GetSensorEvents, :b2World_GetSensorEvents, [WorldId.by_value], SensorEvents.by_value],
34
34
  [:World_GetContactEvents, :b2World_GetContactEvents, [WorldId.by_value], ContactEvents.by_value],
35
35
  [:World_OverlapAABB, :b2World_OverlapAABB, [WorldId.by_value, AABB.by_value, QueryFilter.by_value, :pointer, :pointer], TreeStats.by_value],
36
- [:World_OverlapPoint, :b2World_OverlapPoint, [WorldId.by_value, Vec2.by_value, Transform.by_value, QueryFilter.by_value, :pointer, :pointer], TreeStats.by_value],
37
- [:World_OverlapCircle, :b2World_OverlapCircle, [WorldId.by_value, :pointer, Transform.by_value, QueryFilter.by_value, :pointer, :pointer], TreeStats.by_value],
38
- [:World_OverlapCapsule, :b2World_OverlapCapsule, [WorldId.by_value, :pointer, Transform.by_value, QueryFilter.by_value, :pointer, :pointer], TreeStats.by_value],
39
- [:World_OverlapPolygon, :b2World_OverlapPolygon, [WorldId.by_value, :pointer, Transform.by_value, QueryFilter.by_value, :pointer, :pointer], TreeStats.by_value],
36
+ [:World_OverlapShape, :b2World_OverlapShape, [WorldId.by_value, :pointer, QueryFilter.by_value, :pointer, :pointer], TreeStats.by_value],
40
37
  [:World_CastRay, :b2World_CastRay, [WorldId.by_value, Vec2.by_value, Vec2.by_value, QueryFilter.by_value, :pointer, :pointer], TreeStats.by_value],
41
38
  [:World_CastRayClosest, :b2World_CastRayClosest, [WorldId.by_value, Vec2.by_value, Vec2.by_value, QueryFilter.by_value], RayResult.by_value],
42
- [:World_CastCircle, :b2World_CastCircle, [WorldId.by_value, :pointer, Transform.by_value, Vec2.by_value, QueryFilter.by_value, :pointer, :pointer], TreeStats.by_value],
43
- [:World_CastCapsule, :b2World_CastCapsule, [WorldId.by_value, :pointer, Transform.by_value, Vec2.by_value, QueryFilter.by_value, :pointer, :pointer], TreeStats.by_value],
44
- [:World_CastPolygon, :b2World_CastPolygon, [WorldId.by_value, :pointer, Transform.by_value, Vec2.by_value, QueryFilter.by_value, :pointer, :pointer], TreeStats.by_value],
39
+ [:World_CastShape, :b2World_CastShape, [WorldId.by_value, :pointer, Vec2.by_value, QueryFilter.by_value, :pointer, :pointer], TreeStats.by_value],
40
+ [:World_CastMover, :b2World_CastMover, [WorldId.by_value, :pointer, Vec2.by_value, QueryFilter.by_value], :float],
41
+ [:World_CollideMover, :b2World_CollideMover, [WorldId.by_value, :pointer, QueryFilter.by_value, :pointer, :pointer], :void],
45
42
  [:World_EnableSleeping, :b2World_EnableSleeping, [WorldId.by_value, :bool], :void],
46
43
  [:World_IsSleepingEnabled, :b2World_IsSleepingEnabled, [WorldId.by_value], :bool],
47
44
  [:World_EnableContinuous, :b2World_EnableContinuous, [WorldId.by_value, :bool], :void],
@@ -66,6 +63,8 @@ module Box2D
66
63
  [:World_GetCounters, :b2World_GetCounters, [WorldId.by_value], Counters.by_value],
67
64
  [:World_SetUserData, :b2World_SetUserData, [WorldId.by_value, :pointer], :void],
68
65
  [:World_GetUserData, :b2World_GetUserData, [WorldId.by_value], :pointer],
66
+ [:World_SetFrictionCallback, :b2World_SetFrictionCallback, [WorldId.by_value, :pointer], :void],
67
+ [:World_SetRestitutionCallback, :b2World_SetRestitutionCallback, [WorldId.by_value, :pointer], :void],
69
68
  [:World_DumpMemoryStats, :b2World_DumpMemoryStats, [WorldId.by_value], :void],
70
69
  [:World_RebuildStaticTree, :b2World_RebuildStaticTree, [WorldId.by_value], :void],
71
70
  [:World_EnableSpeculative, :b2World_EnableSpeculative, [WorldId.by_value, :bool], :void],
@@ -74,6 +73,8 @@ module Box2D
74
73
  [:Body_IsValid, :b2Body_IsValid, [BodyId.by_value], :bool],
75
74
  [:Body_GetType, :b2Body_GetType, [BodyId.by_value], :int],
76
75
  [:Body_SetType, :b2Body_SetType, [BodyId.by_value, :int], :void],
76
+ [:Body_SetName, :b2Body_SetName, [BodyId.by_value, :pointer], :void],
77
+ [:Body_GetName, :b2Body_GetName, [BodyId.by_value], :pointer],
77
78
  [:Body_SetUserData, :b2Body_SetUserData, [BodyId.by_value, :pointer], :void],
78
79
  [:Body_GetUserData, :b2Body_GetUserData, [BodyId.by_value], :pointer],
79
80
  [:Body_GetPosition, :b2Body_GetPosition, [BodyId.by_value], Vec2.by_value],
@@ -88,6 +89,9 @@ module Box2D
88
89
  [:Body_GetAngularVelocity, :b2Body_GetAngularVelocity, [BodyId.by_value], :float],
89
90
  [:Body_SetLinearVelocity, :b2Body_SetLinearVelocity, [BodyId.by_value, Vec2.by_value], :void],
90
91
  [:Body_SetAngularVelocity, :b2Body_SetAngularVelocity, [BodyId.by_value, :float], :void],
92
+ [:Body_SetTargetTransform, :b2Body_SetTargetTransform, [BodyId.by_value, Transform.by_value, :float], :void],
93
+ [:Body_GetLocalPointVelocity, :b2Body_GetLocalPointVelocity, [BodyId.by_value, Vec2.by_value], Vec2.by_value],
94
+ [:Body_GetWorldPointVelocity, :b2Body_GetWorldPointVelocity, [BodyId.by_value, Vec2.by_value], Vec2.by_value],
91
95
  [:Body_ApplyForce, :b2Body_ApplyForce, [BodyId.by_value, Vec2.by_value, Vec2.by_value, :bool], :void],
92
96
  [:Body_ApplyForceToCenter, :b2Body_ApplyForceToCenter, [BodyId.by_value, Vec2.by_value, :bool], :void],
93
97
  [:Body_ApplyTorque, :b2Body_ApplyTorque, [BodyId.by_value, :float, :bool], :void],
@@ -120,7 +124,6 @@ module Box2D
120
124
  [:Body_IsFixedRotation, :b2Body_IsFixedRotation, [BodyId.by_value], :bool],
121
125
  [:Body_SetBullet, :b2Body_SetBullet, [BodyId.by_value, :bool], :void],
122
126
  [:Body_IsBullet, :b2Body_IsBullet, [BodyId.by_value], :bool],
123
- [:Body_EnableSensorEvents, :b2Body_EnableSensorEvents, [BodyId.by_value, :bool], :void],
124
127
  [:Body_EnableContactEvents, :b2Body_EnableContactEvents, [BodyId.by_value, :bool], :void],
125
128
  [:Body_EnableHitEvents, :b2Body_EnableHitEvents, [BodyId.by_value, :bool], :void],
126
129
  [:Body_GetWorld, :b2Body_GetWorld, [BodyId.by_value], WorldId.by_value],
@@ -149,6 +152,10 @@ module Box2D
149
152
  [:Shape_GetFriction, :b2Shape_GetFriction, [ShapeId.by_value], :float],
150
153
  [:Shape_SetRestitution, :b2Shape_SetRestitution, [ShapeId.by_value, :float], :void],
151
154
  [:Shape_GetRestitution, :b2Shape_GetRestitution, [ShapeId.by_value], :float],
155
+ [:Shape_SetMaterial, :b2Shape_SetMaterial, [ShapeId.by_value, :int], :void],
156
+ [:Shape_GetMaterial, :b2Shape_GetMaterial, [ShapeId.by_value], :int],
157
+ [:Shape_GetSurfaceMaterial, :b2Shape_GetSurfaceMaterial, [ShapeId.by_value], SurfaceMaterial.by_value],
158
+ [:Shape_SetSurfaceMaterial, :b2Shape_SetSurfaceMaterial, [ShapeId.by_value, SurfaceMaterial.by_value], :void],
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
161
  [:Shape_EnableSensorEvents, :b2Shape_EnableSensorEvents, [ShapeId.by_value, :bool], :void],
@@ -176,6 +183,7 @@ module Box2D
176
183
  [:Shape_GetSensorCapacity, :b2Shape_GetSensorCapacity, [ShapeId.by_value], :int],
177
184
  [:Shape_GetSensorOverlaps, :b2Shape_GetSensorOverlaps, [ShapeId.by_value, :pointer, :int], :int],
178
185
  [:Shape_GetAABB, :b2Shape_GetAABB, [ShapeId.by_value], AABB.by_value],
186
+ [:Shape_GetMassData, :b2Shape_GetMassData, [ShapeId.by_value], MassData.by_value],
179
187
  [:Shape_GetClosestPoint, :b2Shape_GetClosestPoint, [ShapeId.by_value, Vec2.by_value], Vec2.by_value],
180
188
  [:CreateChain, :b2CreateChain, [BodyId.by_value, :pointer], ChainId.by_value],
181
189
  [:DestroyChain, :b2DestroyChain, [ChainId.by_value], :void],
@@ -186,6 +194,8 @@ module Box2D
186
194
  [:Chain_GetFriction, :b2Chain_GetFriction, [ChainId.by_value], :float],
187
195
  [:Chain_SetRestitution, :b2Chain_SetRestitution, [ChainId.by_value, :float], :void],
188
196
  [:Chain_GetRestitution, :b2Chain_GetRestitution, [ChainId.by_value], :float],
197
+ [:Chain_SetMaterial, :b2Chain_SetMaterial, [ChainId.by_value, :int], :void],
198
+ [:Chain_GetMaterial, :b2Chain_GetMaterial, [ChainId.by_value], :int],
189
199
  [:Chain_IsValid, :b2Chain_IsValid, [ChainId.by_value], :bool],
190
200
  [:DestroyJoint, :b2DestroyJoint, [JointId.by_value], :void],
191
201
  [:Joint_IsValid, :b2Joint_IsValid, [JointId.by_value], :bool],
@@ -244,7 +254,7 @@ module Box2D
244
254
  [:MouseJoint_GetSpringDampingRatio, :b2MouseJoint_GetSpringDampingRatio, [JointId.by_value], :float],
245
255
  [:MouseJoint_SetMaxForce, :b2MouseJoint_SetMaxForce, [JointId.by_value, :float], :void],
246
256
  [:MouseJoint_GetMaxForce, :b2MouseJoint_GetMaxForce, [JointId.by_value], :float],
247
- [:CreateNullJoint, :b2CreateNullJoint, [WorldId.by_value, :pointer], JointId.by_value],
257
+ [:CreateFilterJoint, :b2CreateFilterJoint, [WorldId.by_value, :pointer], JointId.by_value],
248
258
  [:CreatePrismaticJoint, :b2CreatePrismaticJoint, [WorldId.by_value, :pointer], JointId.by_value],
249
259
  [:PrismaticJoint_EnableSpring, :b2PrismaticJoint_EnableSpring, [JointId.by_value, :bool], :void],
250
260
  [:PrismaticJoint_IsSpringEnabled, :b2PrismaticJoint_IsSpringEnabled, [JointId.by_value], :bool],
@@ -121,6 +121,23 @@ module Box2D
121
121
  end
122
122
  end
123
123
 
124
+ class Plane < FFI::Struct
125
+ layout(
126
+ :normal, Vec2,
127
+ :offset, :float,
128
+ )
129
+ def normal = self[:normal]
130
+ def normal=(v) self[:normal] = v end
131
+ def offset = self[:offset]
132
+ def offset=(v) self[:offset] = v end
133
+ def self.create_as(_normal_, _offset_)
134
+ instance = Plane.new
135
+ instance[:normal] = _normal_
136
+ instance[:offset] = _offset_
137
+ instance
138
+ end
139
+ end
140
+
124
141
 
125
142
  # Function
126
143
 
@@ -133,6 +150,7 @@ module Box2D
133
150
  [:IsValidVec2, :b2IsValidVec2, [Vec2.by_value], :bool],
134
151
  [:IsValidRotation, :b2IsValidRotation, [Rot.by_value], :bool],
135
152
  [:IsValidAABB, :b2IsValidAABB, [AABB.by_value], :bool],
153
+ [:IsValidPlane, :b2IsValidPlane, [Plane.by_value], :bool],
136
154
  [:SetLengthUnitsPerMeter, :b2SetLengthUnitsPerMeter, [:float], :void],
137
155
  [:GetLengthUnitsPerMeter, :b2GetLengthUnitsPerMeter, [], :float],
138
156
  ]