box2d-bindings 0.1.0-arm64-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.
@@ -0,0 +1,156 @@
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
+ class Vec2 < FFI::Struct
23
+ layout(
24
+ :x, :float,
25
+ :y, :float,
26
+ )
27
+ def x = self[:x]
28
+ def x=(v) self[:x] = v end
29
+ def y = self[:y]
30
+ def y=(v) self[:y] = v end
31
+ def self.create_as(_x_, _y_)
32
+ instance = Vec2.new
33
+ instance[:x] = _x_
34
+ instance[:y] = _y_
35
+ instance
36
+ end
37
+ end
38
+
39
+ class CosSin < FFI::Struct
40
+ layout(
41
+ :cosine, :float,
42
+ :sine, :float,
43
+ )
44
+ def cosine = self[:cosine]
45
+ def cosine=(v) self[:cosine] = v end
46
+ def sine = self[:sine]
47
+ def sine=(v) self[:sine] = v end
48
+ def self.create_as(_cosine_, _sine_)
49
+ instance = CosSin.new
50
+ instance[:cosine] = _cosine_
51
+ instance[:sine] = _sine_
52
+ instance
53
+ end
54
+ end
55
+
56
+ class Rot < FFI::Struct
57
+ layout(
58
+ :c, :float,
59
+ :s, :float,
60
+ )
61
+ def c = self[:c]
62
+ def c=(v) self[:c] = v end
63
+ def s = self[:s]
64
+ def s=(v) self[:s] = v end
65
+ def self.create_as(_c_, _s_)
66
+ instance = Rot.new
67
+ instance[:c] = _c_
68
+ instance[:s] = _s_
69
+ instance
70
+ end
71
+ end
72
+
73
+ class Transform < FFI::Struct
74
+ layout(
75
+ :p, Vec2,
76
+ :q, Rot,
77
+ )
78
+ def p = self[:p]
79
+ def p=(v) self[:p] = v end
80
+ def q = self[:q]
81
+ def q=(v) self[:q] = v end
82
+ def self.create_as(_p_, _q_)
83
+ instance = Transform.new
84
+ instance[:p] = _p_
85
+ instance[:q] = _q_
86
+ instance
87
+ end
88
+ end
89
+
90
+ class Mat22 < FFI::Struct
91
+ layout(
92
+ :cx, Vec2,
93
+ :cy, Vec2,
94
+ )
95
+ def cx = self[:cx]
96
+ def cx=(v) self[:cx] = v end
97
+ def cy = self[:cy]
98
+ def cy=(v) self[:cy] = v end
99
+ def self.create_as(_cx_, _cy_)
100
+ instance = Mat22.new
101
+ instance[:cx] = _cx_
102
+ instance[:cy] = _cy_
103
+ instance
104
+ end
105
+ end
106
+
107
+ class AABB < FFI::Struct
108
+ layout(
109
+ :lowerBound, Vec2,
110
+ :upperBound, Vec2,
111
+ )
112
+ def lowerBound = self[:lowerBound]
113
+ def lowerBound=(v) self[:lowerBound] = v end
114
+ def upperBound = self[:upperBound]
115
+ def upperBound=(v) self[:upperBound] = v end
116
+ def self.create_as(_lowerBound_, _upperBound_)
117
+ instance = AABB.new
118
+ instance[:lowerBound] = _lowerBound_
119
+ instance[:upperBound] = _upperBound_
120
+ instance
121
+ end
122
+ end
123
+
124
+
125
+ # Function
126
+
127
+ def self.setup_math_functions_symbols(method_naming: :original)
128
+ entries = [
129
+ [:Atan2, :b2Atan2, [:float, :float], :float],
130
+ [:ComputeCosSin, :b2ComputeCosSin, [:float], CosSin.by_value],
131
+ [:ComputeRotationBetweenUnitVectors, :b2ComputeRotationBetweenUnitVectors, [Vec2.by_value, Vec2.by_value], Rot.by_value],
132
+ [:IsValidFloat, :b2IsValidFloat, [:float], :bool],
133
+ [:IsValidVec2, :b2IsValidVec2, [Vec2.by_value], :bool],
134
+ [:IsValidRotation, :b2IsValidRotation, [Rot.by_value], :bool],
135
+ [:IsValidAABB, :b2IsValidAABB, [AABB.by_value], :bool],
136
+ [:SetLengthUnitsPerMeter, :b2SetLengthUnitsPerMeter, [:float], :void],
137
+ [:GetLengthUnitsPerMeter, :b2GetLengthUnitsPerMeter, [], :float],
138
+ ]
139
+ entries.each do |entry|
140
+ api_name = if method_naming == :snake_case
141
+ 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
142
+ snake_case_name.gsub!('vector_3', 'vector3_') if snake_case_name.include?('vector_3')
143
+ snake_case_name.gsub!('vector_2', 'vector2_') if snake_case_name.include?('vector_2')
144
+ snake_case_name.chop! if snake_case_name.end_with?('_')
145
+ snake_case_name.to_sym
146
+ else
147
+ entry[0]
148
+ end
149
+ attach_function api_name, entry[1], entry[2], entry[3]
150
+ rescue FFI::NotFoundError => e
151
+ warn "[Warning] Failed to import #{entry[0]} (#{e})."
152
+ end
153
+ end
154
+
155
+ end
156
+
@@ -0,0 +1,104 @@
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_math_inline_functions_symbols(method_naming: :original)
26
+ entries = [
27
+ [:MinInt, :b2MinInt, [:int, :int], :int],
28
+ [:MaxInt, :b2MaxInt, [:int, :int], :int],
29
+ [:AbsInt, :b2AbsInt, [:int], :int],
30
+ [:ClampInt, :b2ClampInt, [:int, :int, :int], :int],
31
+ [:MinFloat, :b2MinFloat, [:float, :float], :float],
32
+ [:MaxFloat, :b2MaxFloat, [:float, :float], :float],
33
+ [:AbsFloat, :b2AbsFloat, [:float], :float],
34
+ [:ClampFloat, :b2ClampFloat, [:float, :float, :float], :float],
35
+ [:Dot, :b2Dot, [Vec2.by_value, Vec2.by_value], :float],
36
+ [:Cross, :b2Cross, [Vec2.by_value, Vec2.by_value], :float],
37
+ [:CrossVS, :b2CrossVS, [Vec2.by_value, :float], Vec2.by_value],
38
+ [:CrossSV, :b2CrossSV, [:float, Vec2.by_value], Vec2.by_value],
39
+ [:LeftPerp, :b2LeftPerp, [Vec2.by_value], Vec2.by_value],
40
+ [:RightPerp, :b2RightPerp, [Vec2.by_value], Vec2.by_value],
41
+ [:Add, :b2Add, [Vec2.by_value, Vec2.by_value], Vec2.by_value],
42
+ [:Sub, :b2Sub, [Vec2.by_value, Vec2.by_value], Vec2.by_value],
43
+ [:Neg, :b2Neg, [Vec2.by_value], Vec2.by_value],
44
+ [:Lerp, :b2Lerp, [Vec2.by_value, Vec2.by_value, :float], Vec2.by_value],
45
+ [:Mul, :b2Mul, [Vec2.by_value, Vec2.by_value], Vec2.by_value],
46
+ [:MulSV, :b2MulSV, [:float, Vec2.by_value], Vec2.by_value],
47
+ [:MulAdd, :b2MulAdd, [Vec2.by_value, :float, Vec2.by_value], Vec2.by_value],
48
+ [:MulSub, :b2MulSub, [Vec2.by_value, :float, Vec2.by_value], Vec2.by_value],
49
+ [:Abs, :b2Abs, [Vec2.by_value], Vec2.by_value],
50
+ [:Min, :b2Min, [Vec2.by_value, Vec2.by_value], Vec2.by_value],
51
+ [:Max, :b2Max, [Vec2.by_value, Vec2.by_value], Vec2.by_value],
52
+ [:Clamp, :b2Clamp, [Vec2.by_value, Vec2.by_value, Vec2.by_value], Vec2.by_value],
53
+ [:Length, :b2Length, [Vec2.by_value], :float],
54
+ [:Distance, :b2Distance, [Vec2.by_value, Vec2.by_value], :float],
55
+ [:Normalize, :b2Normalize, [Vec2.by_value], Vec2.by_value],
56
+ [:GetLengthAndNormalize, :b2GetLengthAndNormalize, [:pointer, Vec2.by_value], Vec2.by_value],
57
+ [:NormalizeRot, :b2NormalizeRot, [Rot.by_value], Rot.by_value],
58
+ [:IntegrateRotation, :b2IntegrateRotation, [Rot.by_value, :float], Rot.by_value],
59
+ [:LengthSquared, :b2LengthSquared, [Vec2.by_value], :float],
60
+ [:DistanceSquared, :b2DistanceSquared, [Vec2.by_value, Vec2.by_value], :float],
61
+ [:MakeRot, :b2MakeRot, [:float], Rot.by_value],
62
+ [:IsNormalized, :b2IsNormalized, [Rot.by_value], :bool],
63
+ [:NLerp, :b2NLerp, [Rot.by_value, Rot.by_value, :float], Rot.by_value],
64
+ [:ComputeAngularVelocity, :b2ComputeAngularVelocity, [Rot.by_value, Rot.by_value, :float], :float],
65
+ [:Rot_GetAngle, :b2Rot_GetAngle, [Rot.by_value], :float],
66
+ [:Rot_GetXAxis, :b2Rot_GetXAxis, [Rot.by_value], Vec2.by_value],
67
+ [:Rot_GetYAxis, :b2Rot_GetYAxis, [Rot.by_value], Vec2.by_value],
68
+ [:MulRot, :b2MulRot, [Rot.by_value, Rot.by_value], Rot.by_value],
69
+ [:InvMulRot, :b2InvMulRot, [Rot.by_value, Rot.by_value], Rot.by_value],
70
+ [:RelativeAngle, :b2RelativeAngle, [Rot.by_value, Rot.by_value], :float],
71
+ [:UnwindAngle, :b2UnwindAngle, [:float], :float],
72
+ [:UnwindLargeAngle, :b2UnwindLargeAngle, [:float], :float],
73
+ [:RotateVector, :b2RotateVector, [Rot.by_value, Vec2.by_value], Vec2.by_value],
74
+ [:InvRotateVector, :b2InvRotateVector, [Rot.by_value, Vec2.by_value], Vec2.by_value],
75
+ [:TransformPoint, :b2TransformPoint, [Transform.by_value, Vec2.by_value], Vec2.by_value],
76
+ [:InvTransformPoint, :b2InvTransformPoint, [Transform.by_value, Vec2.by_value], Vec2.by_value],
77
+ [:MulTransforms, :b2MulTransforms, [Transform.by_value, Transform.by_value], Transform.by_value],
78
+ [:InvMulTransforms, :b2InvMulTransforms, [Transform.by_value, Transform.by_value], Transform.by_value],
79
+ [:MulMV, :b2MulMV, [Mat22.by_value, Vec2.by_value], Vec2.by_value],
80
+ [:GetInverse22, :b2GetInverse22, [Mat22.by_value], Mat22.by_value],
81
+ [:Solve22, :b2Solve22, [Mat22.by_value, Vec2.by_value], Vec2.by_value],
82
+ [:AABB_Contains, :b2AABB_Contains, [AABB.by_value, AABB.by_value], :bool],
83
+ [:AABB_Center, :b2AABB_Center, [AABB.by_value], Vec2.by_value],
84
+ [:AABB_Extents, :b2AABB_Extents, [AABB.by_value], Vec2.by_value],
85
+ [:AABB_Union, :b2AABB_Union, [AABB.by_value, AABB.by_value], AABB.by_value],
86
+ ]
87
+ entries.each do |entry|
88
+ api_name = if method_naming == :snake_case
89
+ 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
90
+ snake_case_name.gsub!('vector_3', 'vector3_') if snake_case_name.include?('vector_3')
91
+ snake_case_name.gsub!('vector_2', 'vector2_') if snake_case_name.include?('vector_2')
92
+ snake_case_name.chop! if snake_case_name.end_with?('_')
93
+ snake_case_name.to_sym
94
+ else
95
+ entry[0]
96
+ end
97
+ attach_function api_name, entry[1], entry[2], entry[3]
98
+ rescue FFI::NotFoundError => e
99
+ warn "[Warning] Failed to import #{entry[0]} (#{e})."
100
+ end
101
+ end
102
+
103
+ end
104
+