raylib-bindings 0.7.8-arm64-darwin → 0.7.10-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.
data/lib/physac.rb CHANGED
@@ -1,331 +1,331 @@
1
- # Yet another raylib wrapper for Ruby
2
- #
3
- # * https://github.com/vaiorabbit/raylib-bindings
4
- #
5
- # [NOTICE] Autogenerated. Do not edit.
6
-
7
- require 'ffi'
8
-
9
- module Raylib
10
- extend FFI::Library
11
-
12
- # Define/Macro
13
-
14
- PHYSAC_MAX_BODIES = 64 # Maximum number of physic bodies supported
15
- PHYSAC_MAX_MANIFOLDS = 4096 # Maximum number of physic bodies interactions (64x64)
16
- PHYSAC_MAX_VERTICES = 24 # Maximum number of vertex for polygons shapes
17
- PHYSAC_DEFAULT_CIRCLE_VERTICES = 24 # Default number of vertices for circle shapes
18
- PHYSAC_COLLISION_ITERATIONS = 100
19
- PHYSAC_PENETRATION_ALLOWANCE = 0.05
20
- PHYSAC_PENETRATION_CORRECTION = 0.4
21
-
22
- # Enum
23
-
24
- # enum PhysicsShapeType
25
- PHYSICS_CIRCLE = 0
26
- PHYSICS_POLYGON = 1
27
-
28
-
29
- # Typedef
30
-
31
- typedef :int, :PhysicsShapeType
32
- typedef :pointer, :PhysicsBody
33
- typedef :pointer, :PhysicsManifold
34
-
35
- # Struct
36
-
37
- # Matrix2x2 type (used for polygon shape rotation matrix)
38
- class Matrix2x2 < FFI::Struct
39
- layout(
40
- :m00, :float,
41
- :m01, :float,
42
- :m10, :float,
43
- :m11, :float,
44
- )
45
- def m00 = self[:m00]
46
- def m00=(v) self[:m00] = v end
47
- def m01 = self[:m01]
48
- def m01=(v) self[:m01] = v end
49
- def m10 = self[:m10]
50
- def m10=(v) self[:m10] = v end
51
- def m11 = self[:m11]
52
- def m11=(v) self[:m11] = v end
53
- end
54
-
55
- class PhysicsVertexData < FFI::Struct
56
- layout(
57
- :vertexCount, :uint, # Vertex count (positions and normals)
58
- :positions, [Vector2, 24], # Vertex positions vectors
59
- :normals, [Vector2, 24], # Vertex normals vectors
60
- )
61
- def vertexCount = self[:vertexCount]
62
- def vertexCount=(v) self[:vertexCount] = v end
63
- def positions = self[:positions]
64
- def positions=(v) self[:positions] = v end
65
- def normals = self[:normals]
66
- def normals=(v) self[:normals] = v end
67
- end
68
-
69
- class PhysicsShape < FFI::Struct
70
- layout(
71
- :type, :int, # Shape type (circle or polygon)
72
- :body, :pointer, # Shape physics body data pointer
73
- :vertexData, PhysicsVertexData, # Shape vertices data (used for polygon shapes)
74
- :radius, :float, # Shape radius (used for circle shapes)
75
- :transform, Matrix2x2, # Vertices transform matrix 2x2
76
- )
77
- def type = self[:type]
78
- def type=(v) self[:type] = v end
79
- def body = self[:body]
80
- def body=(v) self[:body] = v end
81
- def vertexData = self[:vertexData]
82
- def vertexData=(v) self[:vertexData] = v end
83
- def radius = self[:radius]
84
- def radius=(v) self[:radius] = v end
85
- def transform = self[:transform]
86
- def transform=(v) self[:transform] = v end
87
- end
88
-
89
- class PhysicsBodyData < FFI::Struct
90
- layout(
91
- :id, :uint, # Unique identifier
92
- :enabled, :bool, # Enabled dynamics state (collisions are calculated anyway)
93
- :position, Vector2, # Physics body shape pivot
94
- :velocity, Vector2, # Current linear velocity applied to position
95
- :force, Vector2, # Current linear force (reset to 0 every step)
96
- :angularVelocity, :float, # Current angular velocity applied to orient
97
- :torque, :float, # Current angular force (reset to 0 every step)
98
- :orient, :float, # Rotation in radians
99
- :inertia, :float, # Moment of inertia
100
- :inverseInertia, :float, # Inverse value of inertia
101
- :mass, :float, # Physics body mass
102
- :inverseMass, :float, # Inverse value of mass
103
- :staticFriction, :float, # Friction when the body has not movement (0 to 1)
104
- :dynamicFriction, :float, # Friction when the body has movement (0 to 1)
105
- :restitution, :float, # Restitution coefficient of the body (0 to 1)
106
- :useGravity, :bool, # Apply gravity force to dynamics
107
- :isGrounded, :bool, # Physics grounded on other body state
108
- :freezeOrient, :bool, # Physics rotation constraint
109
- :shape, PhysicsShape, # Physics body shape information (type, radius, vertices, transform)
110
- )
111
- def id = self[:id]
112
- def id=(v) self[:id] = v end
113
- def enabled = self[:enabled]
114
- def enabled=(v) self[:enabled] = v end
115
- def position = self[:position]
116
- def position=(v) self[:position] = v end
117
- def velocity = self[:velocity]
118
- def velocity=(v) self[:velocity] = v end
119
- def force = self[:force]
120
- def force=(v) self[:force] = v end
121
- def angularVelocity = self[:angularVelocity]
122
- def angularVelocity=(v) self[:angularVelocity] = v end
123
- def torque = self[:torque]
124
- def torque=(v) self[:torque] = v end
125
- def orient = self[:orient]
126
- def orient=(v) self[:orient] = v end
127
- def inertia = self[:inertia]
128
- def inertia=(v) self[:inertia] = v end
129
- def inverseInertia = self[:inverseInertia]
130
- def inverseInertia=(v) self[:inverseInertia] = v end
131
- def mass = self[:mass]
132
- def mass=(v) self[:mass] = v end
133
- def inverseMass = self[:inverseMass]
134
- def inverseMass=(v) self[:inverseMass] = v end
135
- def staticFriction = self[:staticFriction]
136
- def staticFriction=(v) self[:staticFriction] = v end
137
- def dynamicFriction = self[:dynamicFriction]
138
- def dynamicFriction=(v) self[:dynamicFriction] = v end
139
- def restitution = self[:restitution]
140
- def restitution=(v) self[:restitution] = v end
141
- def useGravity = self[:useGravity]
142
- def useGravity=(v) self[:useGravity] = v end
143
- def isGrounded = self[:isGrounded]
144
- def isGrounded=(v) self[:isGrounded] = v end
145
- def freezeOrient = self[:freezeOrient]
146
- def freezeOrient=(v) self[:freezeOrient] = v end
147
- def shape = self[:shape]
148
- def shape=(v) self[:shape] = v end
149
- end
150
-
151
- class PhysicsManifoldData < FFI::Struct
152
- layout(
153
- :id, :uint, # Unique identifier
154
- :bodyA, :pointer, # Manifold first physics body reference
155
- :bodyB, :pointer, # Manifold second physics body reference
156
- :penetration, :float, # Depth of penetration from collision
157
- :normal, Vector2, # Normal direction vector from 'a' to 'b'
158
- :contacts, [Vector2, 2], # Points of contact during collision
159
- :contactsCount, :uint, # Current collision number of contacts
160
- :restitution, :float, # Mixed restitution during collision
161
- :dynamicFriction, :float, # Mixed dynamic friction during collision
162
- :staticFriction, :float, # Mixed static friction during collision
163
- )
164
- def id = self[:id]
165
- def id=(v) self[:id] = v end
166
- def bodyA = self[:bodyA]
167
- def bodyA=(v) self[:bodyA] = v end
168
- def bodyB = self[:bodyB]
169
- def bodyB=(v) self[:bodyB] = v end
170
- def penetration = self[:penetration]
171
- def penetration=(v) self[:penetration] = v end
172
- def normal = self[:normal]
173
- def normal=(v) self[:normal] = v end
174
- def contacts = self[:contacts]
175
- def contacts=(v) self[:contacts] = v end
176
- def contactsCount = self[:contactsCount]
177
- def contactsCount=(v) self[:contactsCount] = v end
178
- def restitution = self[:restitution]
179
- def restitution=(v) self[:restitution] = v end
180
- def dynamicFriction = self[:dynamicFriction]
181
- def dynamicFriction=(v) self[:dynamicFriction] = v end
182
- def staticFriction = self[:staticFriction]
183
- def staticFriction=(v) self[:staticFriction] = v end
184
- end
185
-
186
-
187
- # Function
188
-
189
- def self.setup_physac_symbols(method_naming: :original)
190
- entries = [
191
-
192
- # @!method InitPhysics()
193
- # InitPhysics : Initializes physics system
194
- # @return [void]
195
- [:InitPhysics, :InitPhysics, [], :void],
196
-
197
- # @!method UpdatePhysics()
198
- # UpdatePhysics : Update physics system
199
- # @return [void]
200
- [:UpdatePhysics, :UpdatePhysics, [], :void],
201
-
202
- # @!method ResetPhysics()
203
- # ResetPhysics : Reset physics system (global variables)
204
- # @return [void]
205
- [:ResetPhysics, :ResetPhysics, [], :void],
206
-
207
- # @!method ClosePhysics()
208
- # ClosePhysics : Close physics system and unload used memory
209
- # @return [void]
210
- [:ClosePhysics, :ClosePhysics, [], :void],
211
-
212
- # @!method SetPhysicsTimeStep(delta)
213
- # SetPhysicsTimeStep : Sets physics fixed time step in milliseconds. 1.666666 by default
214
- # @param delta [double]
215
- # @return [void]
216
- [:SetPhysicsTimeStep, :SetPhysicsTimeStep, [:double], :void],
217
-
218
- # @!method SetPhysicsGravity(x, y)
219
- # SetPhysicsGravity : Sets physics global gravity force
220
- # @param x [float]
221
- # @param y [float]
222
- # @return [void]
223
- [:SetPhysicsGravity, :SetPhysicsGravity, [:float, :float], :void],
224
-
225
- # @!method CreatePhysicsBodyCircle(pos, radius, density)
226
- # CreatePhysicsBodyCircle : Creates a new circle physics body with generic parameters
227
- # @param pos [Vector2]
228
- # @param radius [float]
229
- # @param density [float]
230
- # @return [PhysicsBody]
231
- [:CreatePhysicsBodyCircle, :CreatePhysicsBodyCircle, [Vector2.by_value, :float, :float], :pointer],
232
-
233
- # @!method CreatePhysicsBodyRectangle(pos, width, height, density)
234
- # CreatePhysicsBodyRectangle : Creates a new rectangle physics body with generic parameters
235
- # @param pos [Vector2]
236
- # @param width [float]
237
- # @param height [float]
238
- # @param density [float]
239
- # @return [PhysicsBody]
240
- [:CreatePhysicsBodyRectangle, :CreatePhysicsBodyRectangle, [Vector2.by_value, :float, :float, :float], :pointer],
241
-
242
- # @!method CreatePhysicsBodyPolygon(pos, radius, sides, density)
243
- # CreatePhysicsBodyPolygon : Creates a new polygon physics body with generic parameters
244
- # @param pos [Vector2]
245
- # @param radius [float]
246
- # @param sides [int]
247
- # @param density [float]
248
- # @return [PhysicsBody]
249
- [:CreatePhysicsBodyPolygon, :CreatePhysicsBodyPolygon, [Vector2.by_value, :float, :int, :float], :pointer],
250
-
251
- # @!method DestroyPhysicsBody(body)
252
- # DestroyPhysicsBody : Destroy a physics body
253
- # @param body [PhysicsBody]
254
- # @return [void]
255
- [:DestroyPhysicsBody, :DestroyPhysicsBody, [:pointer], :void],
256
-
257
- # @!method PhysicsAddForce(body, force)
258
- # PhysicsAddForce : Adds a force to a physics body
259
- # @param body [PhysicsBody]
260
- # @param force [Vector2]
261
- # @return [void]
262
- [:PhysicsAddForce, :PhysicsAddForce, [:pointer, Vector2.by_value], :void],
263
-
264
- # @!method PhysicsAddTorque(body, amount)
265
- # PhysicsAddTorque : Adds an angular force to a physics body
266
- # @param body [PhysicsBody]
267
- # @param amount [float]
268
- # @return [void]
269
- [:PhysicsAddTorque, :PhysicsAddTorque, [:pointer, :float], :void],
270
-
271
- # @!method PhysicsShatter(body, position, force)
272
- # PhysicsShatter : Shatters a polygon shape physics body to little physics bodies with explosion force
273
- # @param body [PhysicsBody]
274
- # @param position [Vector2]
275
- # @param force [float]
276
- # @return [void]
277
- [:PhysicsShatter, :PhysicsShatter, [:pointer, Vector2.by_value, :float], :void],
278
-
279
- # @!method SetPhysicsBodyRotation(body, radians)
280
- # SetPhysicsBodyRotation : Sets physics body shape transform based on radians parameter
281
- # @param body [PhysicsBody]
282
- # @param radians [float]
283
- # @return [void]
284
- [:SetPhysicsBodyRotation, :SetPhysicsBodyRotation, [:pointer, :float], :void],
285
-
286
- # @!method GetPhysicsBody(index)
287
- # GetPhysicsBody : Returns a physics body of the bodies pool at a specific index
288
- # @param index [int]
289
- # @return [PhysicsBody]
290
- [:GetPhysicsBody, :GetPhysicsBody, [:int], :pointer],
291
-
292
- # @!method GetPhysicsBodiesCount()
293
- # GetPhysicsBodiesCount : Returns the current amount of created physics bodies
294
- # @return [int]
295
- [:GetPhysicsBodiesCount, :GetPhysicsBodiesCount, [], :int],
296
-
297
- # @!method GetPhysicsShapeType(index)
298
- # GetPhysicsShapeType : Returns the physics body shape type (PHYSICS_CIRCLE or PHYSICS_POLYGON)
299
- # @param index [int]
300
- # @return [int]
301
- [:GetPhysicsShapeType, :GetPhysicsShapeType, [:int], :int],
302
-
303
- # @!method GetPhysicsShapeVerticesCount(index)
304
- # GetPhysicsShapeVerticesCount : Returns the amount of vertices of a physics body shape
305
- # @param index [int]
306
- # @return [int]
307
- [:GetPhysicsShapeVerticesCount, :GetPhysicsShapeVerticesCount, [:int], :int],
308
-
309
- # @!method GetPhysicsShapeVertex(body, vertex)
310
- # GetPhysicsShapeVertex : Returns transformed position of a body shape (body position + vertex transformed position)
311
- # @param body [PhysicsBody]
312
- # @param vertex [int]
313
- # @return [Vector2]
314
- [:GetPhysicsShapeVertex, :GetPhysicsShapeVertex, [:pointer, :int], Vector2.by_value],
315
- ]
316
- entries.each do |entry|
317
- api_name = if method_naming == :snake_case
318
- 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
319
- snake_case_name.gsub!('vector_3', 'vector3_') if snake_case_name.include?('vector_3')
320
- snake_case_name.gsub!('vector_2', 'vector2_') if snake_case_name.include?('vector_2')
321
- snake_case_name.chop! if snake_case_name.end_with?('_')
322
- snake_case_name.to_sym
323
- else
324
- entry[0]
325
- end
326
- attach_function api_name, entry[1], entry[2], entry[3]
327
- rescue FFI::NotFoundError => e
328
- warn "[Warning] Failed to import #{entry[0]} (#{e})."
329
- end
330
- end
331
- end
1
+ # Yet another raylib wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/raylib-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module Raylib
10
+ extend FFI::Library
11
+
12
+ # Define/Macro
13
+
14
+ PHYSAC_MAX_BODIES = 64 # Maximum number of physic bodies supported
15
+ PHYSAC_MAX_MANIFOLDS = 4096 # Maximum number of physic bodies interactions (64x64)
16
+ PHYSAC_MAX_VERTICES = 24 # Maximum number of vertex for polygons shapes
17
+ PHYSAC_DEFAULT_CIRCLE_VERTICES = 24 # Default number of vertices for circle shapes
18
+ PHYSAC_COLLISION_ITERATIONS = 100
19
+ PHYSAC_PENETRATION_ALLOWANCE = 0.05
20
+ PHYSAC_PENETRATION_CORRECTION = 0.4
21
+
22
+ # Enum
23
+
24
+ # enum PhysicsShapeType
25
+ PHYSICS_CIRCLE = 0
26
+ PHYSICS_POLYGON = 1
27
+
28
+
29
+ # Typedef
30
+
31
+ typedef :int, :PhysicsShapeType
32
+ typedef :pointer, :PhysicsBody
33
+ typedef :pointer, :PhysicsManifold
34
+
35
+ # Struct
36
+
37
+ # Matrix2x2 type (used for polygon shape rotation matrix)
38
+ class Matrix2x2 < FFI::Struct
39
+ layout(
40
+ :m00, :float,
41
+ :m01, :float,
42
+ :m10, :float,
43
+ :m11, :float,
44
+ )
45
+ def m00 = self[:m00]
46
+ def m00=(v) self[:m00] = v end
47
+ def m01 = self[:m01]
48
+ def m01=(v) self[:m01] = v end
49
+ def m10 = self[:m10]
50
+ def m10=(v) self[:m10] = v end
51
+ def m11 = self[:m11]
52
+ def m11=(v) self[:m11] = v end
53
+ end
54
+
55
+ class PhysicsVertexData < FFI::Struct
56
+ layout(
57
+ :vertexCount, :uint, # Vertex count (positions and normals)
58
+ :positions, [Vector2, 24], # Vertex positions vectors
59
+ :normals, [Vector2, 24], # Vertex normals vectors
60
+ )
61
+ def vertexCount = self[:vertexCount]
62
+ def vertexCount=(v) self[:vertexCount] = v end
63
+ def positions = self[:positions]
64
+ def positions=(v) self[:positions] = v end
65
+ def normals = self[:normals]
66
+ def normals=(v) self[:normals] = v end
67
+ end
68
+
69
+ class PhysicsShape < FFI::Struct
70
+ layout(
71
+ :type, :int, # Shape type (circle or polygon)
72
+ :body, :pointer, # Shape physics body data pointer
73
+ :vertexData, PhysicsVertexData, # Shape vertices data (used for polygon shapes)
74
+ :radius, :float, # Shape radius (used for circle shapes)
75
+ :transform, Matrix2x2, # Vertices transform matrix 2x2
76
+ )
77
+ def type = self[:type]
78
+ def type=(v) self[:type] = v end
79
+ def body = self[:body]
80
+ def body=(v) self[:body] = v end
81
+ def vertexData = self[:vertexData]
82
+ def vertexData=(v) self[:vertexData] = v end
83
+ def radius = self[:radius]
84
+ def radius=(v) self[:radius] = v end
85
+ def transform = self[:transform]
86
+ def transform=(v) self[:transform] = v end
87
+ end
88
+
89
+ class PhysicsBodyData < FFI::Struct
90
+ layout(
91
+ :id, :uint, # Unique identifier
92
+ :enabled, :bool, # Enabled dynamics state (collisions are calculated anyway)
93
+ :position, Vector2, # Physics body shape pivot
94
+ :velocity, Vector2, # Current linear velocity applied to position
95
+ :force, Vector2, # Current linear force (reset to 0 every step)
96
+ :angularVelocity, :float, # Current angular velocity applied to orient
97
+ :torque, :float, # Current angular force (reset to 0 every step)
98
+ :orient, :float, # Rotation in radians
99
+ :inertia, :float, # Moment of inertia
100
+ :inverseInertia, :float, # Inverse value of inertia
101
+ :mass, :float, # Physics body mass
102
+ :inverseMass, :float, # Inverse value of mass
103
+ :staticFriction, :float, # Friction when the body has not movement (0 to 1)
104
+ :dynamicFriction, :float, # Friction when the body has movement (0 to 1)
105
+ :restitution, :float, # Restitution coefficient of the body (0 to 1)
106
+ :useGravity, :bool, # Apply gravity force to dynamics
107
+ :isGrounded, :bool, # Physics grounded on other body state
108
+ :freezeOrient, :bool, # Physics rotation constraint
109
+ :shape, PhysicsShape, # Physics body shape information (type, radius, vertices, transform)
110
+ )
111
+ def id = self[:id]
112
+ def id=(v) self[:id] = v end
113
+ def enabled = self[:enabled]
114
+ def enabled=(v) self[:enabled] = v end
115
+ def position = self[:position]
116
+ def position=(v) self[:position] = v end
117
+ def velocity = self[:velocity]
118
+ def velocity=(v) self[:velocity] = v end
119
+ def force = self[:force]
120
+ def force=(v) self[:force] = v end
121
+ def angularVelocity = self[:angularVelocity]
122
+ def angularVelocity=(v) self[:angularVelocity] = v end
123
+ def torque = self[:torque]
124
+ def torque=(v) self[:torque] = v end
125
+ def orient = self[:orient]
126
+ def orient=(v) self[:orient] = v end
127
+ def inertia = self[:inertia]
128
+ def inertia=(v) self[:inertia] = v end
129
+ def inverseInertia = self[:inverseInertia]
130
+ def inverseInertia=(v) self[:inverseInertia] = v end
131
+ def mass = self[:mass]
132
+ def mass=(v) self[:mass] = v end
133
+ def inverseMass = self[:inverseMass]
134
+ def inverseMass=(v) self[:inverseMass] = v end
135
+ def staticFriction = self[:staticFriction]
136
+ def staticFriction=(v) self[:staticFriction] = v end
137
+ def dynamicFriction = self[:dynamicFriction]
138
+ def dynamicFriction=(v) self[:dynamicFriction] = v end
139
+ def restitution = self[:restitution]
140
+ def restitution=(v) self[:restitution] = v end
141
+ def useGravity = self[:useGravity]
142
+ def useGravity=(v) self[:useGravity] = v end
143
+ def isGrounded = self[:isGrounded]
144
+ def isGrounded=(v) self[:isGrounded] = v end
145
+ def freezeOrient = self[:freezeOrient]
146
+ def freezeOrient=(v) self[:freezeOrient] = v end
147
+ def shape = self[:shape]
148
+ def shape=(v) self[:shape] = v end
149
+ end
150
+
151
+ class PhysicsManifoldData < FFI::Struct
152
+ layout(
153
+ :id, :uint, # Unique identifier
154
+ :bodyA, :pointer, # Manifold first physics body reference
155
+ :bodyB, :pointer, # Manifold second physics body reference
156
+ :penetration, :float, # Depth of penetration from collision
157
+ :normal, Vector2, # Normal direction vector from 'a' to 'b'
158
+ :contacts, [Vector2, 2], # Points of contact during collision
159
+ :contactsCount, :uint, # Current collision number of contacts
160
+ :restitution, :float, # Mixed restitution during collision
161
+ :dynamicFriction, :float, # Mixed dynamic friction during collision
162
+ :staticFriction, :float, # Mixed static friction during collision
163
+ )
164
+ def id = self[:id]
165
+ def id=(v) self[:id] = v end
166
+ def bodyA = self[:bodyA]
167
+ def bodyA=(v) self[:bodyA] = v end
168
+ def bodyB = self[:bodyB]
169
+ def bodyB=(v) self[:bodyB] = v end
170
+ def penetration = self[:penetration]
171
+ def penetration=(v) self[:penetration] = v end
172
+ def normal = self[:normal]
173
+ def normal=(v) self[:normal] = v end
174
+ def contacts = self[:contacts]
175
+ def contacts=(v) self[:contacts] = v end
176
+ def contactsCount = self[:contactsCount]
177
+ def contactsCount=(v) self[:contactsCount] = v end
178
+ def restitution = self[:restitution]
179
+ def restitution=(v) self[:restitution] = v end
180
+ def dynamicFriction = self[:dynamicFriction]
181
+ def dynamicFriction=(v) self[:dynamicFriction] = v end
182
+ def staticFriction = self[:staticFriction]
183
+ def staticFriction=(v) self[:staticFriction] = v end
184
+ end
185
+
186
+
187
+ # Function
188
+
189
+ def self.setup_physac_symbols(method_naming: :original)
190
+ entries = [
191
+
192
+ # @!method InitPhysics()
193
+ # InitPhysics : Initializes physics system
194
+ # @return [void]
195
+ [:InitPhysics, :InitPhysics, [], :void],
196
+
197
+ # @!method UpdatePhysics()
198
+ # UpdatePhysics : Update physics system
199
+ # @return [void]
200
+ [:UpdatePhysics, :UpdatePhysics, [], :void],
201
+
202
+ # @!method ResetPhysics()
203
+ # ResetPhysics : Reset physics system (global variables)
204
+ # @return [void]
205
+ [:ResetPhysics, :ResetPhysics, [], :void],
206
+
207
+ # @!method ClosePhysics()
208
+ # ClosePhysics : Close physics system and unload used memory
209
+ # @return [void]
210
+ [:ClosePhysics, :ClosePhysics, [], :void],
211
+
212
+ # @!method SetPhysicsTimeStep(delta)
213
+ # SetPhysicsTimeStep : Sets physics fixed time step in milliseconds. 1.666666 by default
214
+ # @param delta [double]
215
+ # @return [void]
216
+ [:SetPhysicsTimeStep, :SetPhysicsTimeStep, [:double], :void],
217
+
218
+ # @!method SetPhysicsGravity(x, y)
219
+ # SetPhysicsGravity : Sets physics global gravity force
220
+ # @param x [float]
221
+ # @param y [float]
222
+ # @return [void]
223
+ [:SetPhysicsGravity, :SetPhysicsGravity, [:float, :float], :void],
224
+
225
+ # @!method CreatePhysicsBodyCircle(pos, radius, density)
226
+ # CreatePhysicsBodyCircle : Creates a new circle physics body with generic parameters
227
+ # @param pos [Vector2]
228
+ # @param radius [float]
229
+ # @param density [float]
230
+ # @return [PhysicsBody]
231
+ [:CreatePhysicsBodyCircle, :CreatePhysicsBodyCircle, [Vector2.by_value, :float, :float], :pointer],
232
+
233
+ # @!method CreatePhysicsBodyRectangle(pos, width, height, density)
234
+ # CreatePhysicsBodyRectangle : Creates a new rectangle physics body with generic parameters
235
+ # @param pos [Vector2]
236
+ # @param width [float]
237
+ # @param height [float]
238
+ # @param density [float]
239
+ # @return [PhysicsBody]
240
+ [:CreatePhysicsBodyRectangle, :CreatePhysicsBodyRectangle, [Vector2.by_value, :float, :float, :float], :pointer],
241
+
242
+ # @!method CreatePhysicsBodyPolygon(pos, radius, sides, density)
243
+ # CreatePhysicsBodyPolygon : Creates a new polygon physics body with generic parameters
244
+ # @param pos [Vector2]
245
+ # @param radius [float]
246
+ # @param sides [int]
247
+ # @param density [float]
248
+ # @return [PhysicsBody]
249
+ [:CreatePhysicsBodyPolygon, :CreatePhysicsBodyPolygon, [Vector2.by_value, :float, :int, :float], :pointer],
250
+
251
+ # @!method DestroyPhysicsBody(body)
252
+ # DestroyPhysicsBody : Destroy a physics body
253
+ # @param body [PhysicsBody]
254
+ # @return [void]
255
+ [:DestroyPhysicsBody, :DestroyPhysicsBody, [:pointer], :void],
256
+
257
+ # @!method PhysicsAddForce(body, force)
258
+ # PhysicsAddForce : Adds a force to a physics body
259
+ # @param body [PhysicsBody]
260
+ # @param force [Vector2]
261
+ # @return [void]
262
+ [:PhysicsAddForce, :PhysicsAddForce, [:pointer, Vector2.by_value], :void],
263
+
264
+ # @!method PhysicsAddTorque(body, amount)
265
+ # PhysicsAddTorque : Adds an angular force to a physics body
266
+ # @param body [PhysicsBody]
267
+ # @param amount [float]
268
+ # @return [void]
269
+ [:PhysicsAddTorque, :PhysicsAddTorque, [:pointer, :float], :void],
270
+
271
+ # @!method PhysicsShatter(body, position, force)
272
+ # PhysicsShatter : Shatters a polygon shape physics body to little physics bodies with explosion force
273
+ # @param body [PhysicsBody]
274
+ # @param position [Vector2]
275
+ # @param force [float]
276
+ # @return [void]
277
+ [:PhysicsShatter, :PhysicsShatter, [:pointer, Vector2.by_value, :float], :void],
278
+
279
+ # @!method SetPhysicsBodyRotation(body, radians)
280
+ # SetPhysicsBodyRotation : Sets physics body shape transform based on radians parameter
281
+ # @param body [PhysicsBody]
282
+ # @param radians [float]
283
+ # @return [void]
284
+ [:SetPhysicsBodyRotation, :SetPhysicsBodyRotation, [:pointer, :float], :void],
285
+
286
+ # @!method GetPhysicsBody(index)
287
+ # GetPhysicsBody : Returns a physics body of the bodies pool at a specific index
288
+ # @param index [int]
289
+ # @return [PhysicsBody]
290
+ [:GetPhysicsBody, :GetPhysicsBody, [:int], :pointer],
291
+
292
+ # @!method GetPhysicsBodiesCount()
293
+ # GetPhysicsBodiesCount : Returns the current amount of created physics bodies
294
+ # @return [int]
295
+ [:GetPhysicsBodiesCount, :GetPhysicsBodiesCount, [], :int],
296
+
297
+ # @!method GetPhysicsShapeType(index)
298
+ # GetPhysicsShapeType : Returns the physics body shape type (PHYSICS_CIRCLE or PHYSICS_POLYGON)
299
+ # @param index [int]
300
+ # @return [int]
301
+ [:GetPhysicsShapeType, :GetPhysicsShapeType, [:int], :int],
302
+
303
+ # @!method GetPhysicsShapeVerticesCount(index)
304
+ # GetPhysicsShapeVerticesCount : Returns the amount of vertices of a physics body shape
305
+ # @param index [int]
306
+ # @return [int]
307
+ [:GetPhysicsShapeVerticesCount, :GetPhysicsShapeVerticesCount, [:int], :int],
308
+
309
+ # @!method GetPhysicsShapeVertex(body, vertex)
310
+ # GetPhysicsShapeVertex : Returns transformed position of a body shape (body position + vertex transformed position)
311
+ # @param body [PhysicsBody]
312
+ # @param vertex [int]
313
+ # @return [Vector2]
314
+ [:GetPhysicsShapeVertex, :GetPhysicsShapeVertex, [:pointer, :int], Vector2.by_value],
315
+ ]
316
+ entries.each do |entry|
317
+ api_name = if method_naming == :snake_case
318
+ 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
319
+ snake_case_name.gsub!('vector_3', 'vector3_') if snake_case_name.include?('vector_3')
320
+ snake_case_name.gsub!('vector_2', 'vector2_') if snake_case_name.include?('vector_2')
321
+ snake_case_name.chop! if snake_case_name.end_with?('_')
322
+ snake_case_name.to_sym
323
+ else
324
+ entry[0]
325
+ end
326
+ attach_function api_name, entry[1], entry[2], entry[3]
327
+ rescue FFI::NotFoundError => e
328
+ warn "[Warning] Failed to import #{entry[0]} (#{e})."
329
+ end
330
+ end
331
+ end
Binary file