raylib-bindings 0.2.0 → 0.4.0

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