raylib-bindings 0.1.2 → 0.1.4

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: c5c8bede73961fe6aaedfeb18db2eea3c34d8c3728eae57fdabf762fe300aafe
4
- data.tar.gz: a818ec378250b6791e715b7aeee9f9bb1c65a55417d1ef5ce68e61228c05f7b5
3
+ metadata.gz: 5b3f1d67b53ae29240274be47c367f11b21ca8b0f6ade8d3d7681d85ad4f48d2
4
+ data.tar.gz: 9ca39c8d175730002cff693ac0708ba6f0bca4931b700c70798ed7272d2f5e35
5
5
  SHA512:
6
- metadata.gz: bd713d0c28312cdaf0ebafb49827361ebffe3dc5d41babebd28aba273f6cb7a514a202f2c132c30a16278ee3eea1d0393a8328772e86f9c2f9397390c9ba616d
7
- data.tar.gz: 1feb2faf51280803b259d349b939413ff904afb17f7105acec652645bb0e865b7141351d08bd73c63705175332cfe0c35f5121299e16313c410c7024bcce6280
6
+ metadata.gz: 803d0c18648fd377db9d89b4f603bc0759f147c6281d83d56457215334615c3fca80acb1b324ce7fe6b84369bd452968061a02c7dd46db529286337cd5497f64
7
+ data.tar.gz: 17b06c4f5738faa6f69581155bdf0596fc1db33a8d29ab892a569b0d299d1d39cfd484a40dbfea9a28cd70b6e6eb37b6936bb55d239b532745c0e87d1cb135c9
data/ChangeLog CHANGED
@@ -1,3 +1,21 @@
1
+ 2022-12-25 vaiorabbit <http://twitter.com/vaiorabbit>
2
+
3
+ * Converted DrawModelEx into a wrapper function of rbDrawModelEx to avoid Matrix problem found in models_animation sample
4
+ * Attach functions with an explicit name - Ref.: https://www.rubydoc.info/github/ffi/ffi/FFI%2FLibrary:attach_function
5
+ * setup_xxx_symbols: name, retval and arguments of one function are now packed into one line
6
+ * generator: Now imports descriptions from original API schema
7
+ * Generated with the latest raylib ( https://github.com/raysan5/raylib/commit/03cc540d5f1df71bd7ad8118d0e11b492fa5cc18 )
8
+
9
+ 2022-12-24 vaiorabbit <http://twitter.com/vaiorabbit>
10
+
11
+ * Experimental Linux (Chromebook) support
12
+
13
+ 2022-12-10 vaiorabbit <http://twitter.com/vaiorabbit>
14
+
15
+ * Pulled latest raylib ( https://github.com/raysan5/raylib/commit/2c9d116a5ce835328dc3267313f1b34b2e7ad8c9 ) / and raygui ( https://github.com/raysan5/raygui/commit/64179558e425f6e05054d2a70eb12530e0fec103 )
16
+ * [Windows] Updated DLLs with the latest raylib
17
+ * example/rlgl_compute_shader.rb: Fixed API usage
18
+
1
19
  2022-10-23 vaiorabbit <http://twitter.com/vaiorabbit>
2
20
 
3
21
  * Pulled latest raylib ( https://github.com/raysan5/raylib/commit/483f10397ee37ba551e57bad563a846f2dc5bb5b ) / and raygui ( https://github.com/raysan5/raygui/commit/d981abebd8f36dea9a297b2158b529ad8bf76a69a )
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  # Yet another raylib wrapper for Ruby #
4
4
 
5
5
  * Created : 2021-10-17
6
- * Last modified : 2022-10-23
6
+ * Last modified : 2022-12-25
7
7
 
8
8
  Provides Ruby bindings for raylib-related libraries including:
9
9
 
data/lib/libraylib.dll CHANGED
Binary file
data/lib/libraylib.dylib CHANGED
Binary file
data/lib/physac.dll CHANGED
Binary file
data/lib/physac.rb CHANGED
@@ -2,18 +2,19 @@
2
2
  #
3
3
  # * https://github.com/vaiorabbit/raylib-bindings
4
4
  #
5
- # [NOTICE] This is an automatically generated file.
5
+ # [NOTICE] Autogenerated. Do not edit.
6
6
 
7
7
  require 'ffi'
8
8
 
9
9
  module Raylib
10
10
  extend FFI::Library
11
+
11
12
  # Define/Macro
12
13
 
13
- PHYSAC_MAX_BODIES = 64
14
- PHYSAC_MAX_MANIFOLDS = 4096
15
- PHYSAC_MAX_VERTICES = 24
16
- PHYSAC_DEFAULT_CIRCLE_VERTICES = 24
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
17
18
  PHYSAC_COLLISION_ITERATIONS = 100
18
19
  PHYSAC_PENETRATION_ALLOWANCE = 0.05
19
20
  PHYSAC_PENETRATION_CORRECTION = 0.4
@@ -32,6 +33,7 @@ module Raylib
32
33
 
33
34
  # Struct
34
35
 
36
+ # Matrix2x2 type (used for polygon shape rotation matrix)
35
37
  class Matrix2x2 < FFI::Struct
36
38
  layout(
37
39
  :m00, :float,
@@ -43,133 +45,177 @@ module Raylib
43
45
 
44
46
  class PhysicsVertexData < FFI::Struct
45
47
  layout(
46
- :vertexCount, :uint,
47
- :positions, [Vector2, 24],
48
- :normals, [Vector2, 24],
48
+ :vertexCount, :uint, # Vertex count (positions and normals)
49
+ :positions, [Vector2, 24], # Vertex positions vectors
50
+ :normals, [Vector2, 24], # Vertex normals vectors
49
51
  )
50
52
  end
51
53
 
52
54
  class PhysicsShape < FFI::Struct
53
55
  layout(
54
- :type, :int,
55
- :body, :pointer,
56
- :vertexData, PhysicsVertexData,
57
- :radius, :float,
58
- :transform, Matrix2x2,
56
+ :type, :int, # Shape type (circle or polygon)
57
+ :body, :pointer, # Shape physics body data pointer
58
+ :vertexData, PhysicsVertexData, # Shape vertices data (used for polygon shapes)
59
+ :radius, :float, # Shape radius (used for circle shapes)
60
+ :transform, Matrix2x2, # Vertices transform matrix 2x2
59
61
  )
60
62
  end
61
63
 
62
64
  class PhysicsBodyData < FFI::Struct
63
65
  layout(
64
- :id, :uint,
65
- :enabled, :bool,
66
- :position, Vector2,
67
- :velocity, Vector2,
68
- :force, Vector2,
69
- :angularVelocity, :float,
70
- :torque, :float,
71
- :orient, :float,
72
- :inertia, :float,
73
- :inverseInertia, :float,
74
- :mass, :float,
75
- :inverseMass, :float,
76
- :staticFriction, :float,
77
- :dynamicFriction, :float,
78
- :restitution, :float,
79
- :useGravity, :bool,
80
- :isGrounded, :bool,
81
- :freezeOrient, :bool,
82
- :shape, PhysicsShape,
66
+ :id, :uint, # Unique identifier
67
+ :enabled, :bool, # Enabled dynamics state (collisions are calculated anyway)
68
+ :position, Vector2, # Physics body shape pivot
69
+ :velocity, Vector2, # Current linear velocity applied to position
70
+ :force, Vector2, # Current linear force (reset to 0 every step)
71
+ :angularVelocity, :float, # Current angular velocity applied to orient
72
+ :torque, :float, # Current angular force (reset to 0 every step)
73
+ :orient, :float, # Rotation in radians
74
+ :inertia, :float, # Moment of inertia
75
+ :inverseInertia, :float, # Inverse value of inertia
76
+ :mass, :float, # Physics body mass
77
+ :inverseMass, :float, # Inverse value of mass
78
+ :staticFriction, :float, # Friction when the body has not movement (0 to 1)
79
+ :dynamicFriction, :float, # Friction when the body has movement (0 to 1)
80
+ :restitution, :float, # Restitution coefficient of the body (0 to 1)
81
+ :useGravity, :bool, # Apply gravity force to dynamics
82
+ :isGrounded, :bool, # Physics grounded on other body state
83
+ :freezeOrient, :bool, # Physics rotation constraint
84
+ :shape, PhysicsShape, # Physics body shape information (type, radius, vertices, transform)
83
85
  )
84
86
  end
85
87
 
86
88
  class PhysicsManifoldData < FFI::Struct
87
89
  layout(
88
- :id, :uint,
89
- :bodyA, :pointer,
90
- :bodyB, :pointer,
91
- :penetration, :float,
92
- :normal, Vector2,
93
- :contacts, [Vector2, 2],
94
- :contactsCount, :uint,
95
- :restitution, :float,
96
- :dynamicFriction, :float,
97
- :staticFriction, :float,
90
+ :id, :uint, # Unique identifier
91
+ :bodyA, :pointer, # Manifold first physics body reference
92
+ :bodyB, :pointer, # Manifold second physics body reference
93
+ :penetration, :float, # Depth of penetration from collision
94
+ :normal, Vector2, # Normal direction vector from 'a' to 'b'
95
+ :contacts, [Vector2, 2], # Points of contact during collision
96
+ :contactsCount, :uint, # Current collision number of contacts
97
+ :restitution, :float, # Mixed restitution during collision
98
+ :dynamicFriction, :float, # Mixed dynamic friction during collision
99
+ :staticFriction, :float, # Mixed static friction during collision
98
100
  )
99
101
  end
100
102
 
101
103
 
102
104
  # Function
103
105
 
104
- def self.setup_physac_symbols()
105
- symbols = [
106
- :InitPhysics,
107
- :UpdatePhysics,
108
- :ResetPhysics,
109
- :ClosePhysics,
110
- :SetPhysicsTimeStep,
111
- :SetPhysicsGravity,
112
- :CreatePhysicsBodyCircle,
113
- :CreatePhysicsBodyRectangle,
114
- :CreatePhysicsBodyPolygon,
115
- :DestroyPhysicsBody,
116
- :PhysicsAddForce,
117
- :PhysicsAddTorque,
118
- :PhysicsShatter,
119
- :SetPhysicsBodyRotation,
120
- :GetPhysicsBody,
121
- :GetPhysicsBodiesCount,
122
- :GetPhysicsShapeType,
123
- :GetPhysicsShapeVerticesCount,
124
- :GetPhysicsShapeVertex,
106
+ def self.setup_physac_symbols(output_error = false)
107
+ entries = [
108
+
109
+ # InitPhysics : Initializes physics system
110
+ # @return [void]
111
+ [:InitPhysics, :InitPhysics, [], :void],
112
+
113
+ # UpdatePhysics : Update physics system
114
+ # @return [void]
115
+ [:UpdatePhysics, :UpdatePhysics, [], :void],
116
+
117
+ # ResetPhysics : Reset physics system (global variables)
118
+ # @return [void]
119
+ [:ResetPhysics, :ResetPhysics, [], :void],
120
+
121
+ # ClosePhysics : Close physics system and unload used memory
122
+ # @return [void]
123
+ [:ClosePhysics, :ClosePhysics, [], :void],
124
+
125
+ # SetPhysicsTimeStep : Sets physics fixed time step in milliseconds. 1.666666 by default
126
+ # @param delta [double]
127
+ # @return [void]
128
+ [:SetPhysicsTimeStep, :SetPhysicsTimeStep, [:double], :void],
129
+
130
+ # SetPhysicsGravity : Sets physics global gravity force
131
+ # @param x [float]
132
+ # @param y [float]
133
+ # @return [void]
134
+ [:SetPhysicsGravity, :SetPhysicsGravity, [:float, :float], :void],
135
+
136
+ # CreatePhysicsBodyCircle : Creates a new circle physics body with generic parameters
137
+ # @param pos [Vector2]
138
+ # @param radius [float]
139
+ # @param density [float]
140
+ # @return [PhysicsBody]
141
+ [:CreatePhysicsBodyCircle, :CreatePhysicsBodyCircle, [Vector2.by_value, :float, :float], :pointer],
142
+
143
+ # CreatePhysicsBodyRectangle : Creates a new rectangle physics body with generic parameters
144
+ # @param pos [Vector2]
145
+ # @param width [float]
146
+ # @param height [float]
147
+ # @param density [float]
148
+ # @return [PhysicsBody]
149
+ [:CreatePhysicsBodyRectangle, :CreatePhysicsBodyRectangle, [Vector2.by_value, :float, :float, :float], :pointer],
150
+
151
+ # CreatePhysicsBodyPolygon : Creates a new polygon physics body with generic parameters
152
+ # @param pos [Vector2]
153
+ # @param radius [float]
154
+ # @param sides [int]
155
+ # @param density [float]
156
+ # @return [PhysicsBody]
157
+ [:CreatePhysicsBodyPolygon, :CreatePhysicsBodyPolygon, [Vector2.by_value, :float, :int, :float], :pointer],
158
+
159
+ # DestroyPhysicsBody : Destroy a physics body
160
+ # @param body [PhysicsBody]
161
+ # @return [void]
162
+ [:DestroyPhysicsBody, :DestroyPhysicsBody, [:pointer], :void],
163
+
164
+ # PhysicsAddForce : Adds a force to a physics body
165
+ # @param body [PhysicsBody]
166
+ # @param force [Vector2]
167
+ # @return [void]
168
+ [:PhysicsAddForce, :PhysicsAddForce, [:pointer, Vector2.by_value], :void],
169
+
170
+ # PhysicsAddTorque : Adds an angular force to a physics body
171
+ # @param body [PhysicsBody]
172
+ # @param amount [float]
173
+ # @return [void]
174
+ [:PhysicsAddTorque, :PhysicsAddTorque, [:pointer, :float], :void],
175
+
176
+ # PhysicsShatter : Shatters a polygon shape physics body to little physics bodies with explosion force
177
+ # @param body [PhysicsBody]
178
+ # @param position [Vector2]
179
+ # @param force [float]
180
+ # @return [void]
181
+ [:PhysicsShatter, :PhysicsShatter, [:pointer, Vector2.by_value, :float], :void],
182
+
183
+ # SetPhysicsBodyRotation : Sets physics body shape transform based on radians parameter
184
+ # @param body [PhysicsBody]
185
+ # @param radians [float]
186
+ # @return [void]
187
+ [:SetPhysicsBodyRotation, :SetPhysicsBodyRotation, [:pointer, :float], :void],
188
+
189
+ # GetPhysicsBody : Returns a physics body of the bodies pool at a specific index
190
+ # @param index [int]
191
+ # @return [PhysicsBody]
192
+ [:GetPhysicsBody, :GetPhysicsBody, [:int], :pointer],
193
+
194
+ # GetPhysicsBodiesCount : Returns the current amount of created physics bodies
195
+ # @return [int]
196
+ [:GetPhysicsBodiesCount, :GetPhysicsBodiesCount, [], :int],
197
+
198
+ # GetPhysicsShapeType : Returns the physics body shape type (PHYSICS_CIRCLE or PHYSICS_POLYGON)
199
+ # @param index [int]
200
+ # @return [int]
201
+ [:GetPhysicsShapeType, :GetPhysicsShapeType, [:int], :int],
202
+
203
+ # GetPhysicsShapeVerticesCount : Returns the amount of vertices of a physics body shape
204
+ # @param index [int]
205
+ # @return [int]
206
+ [:GetPhysicsShapeVerticesCount, :GetPhysicsShapeVerticesCount, [:int], :int],
207
+
208
+ # GetPhysicsShapeVertex : Returns transformed position of a body shape (body position + vertex transformed position)
209
+ # @param body [PhysicsBody]
210
+ # @param vertex [int]
211
+ # @return [Vector2]
212
+ [:GetPhysicsShapeVertex, :GetPhysicsShapeVertex, [:pointer, :int], Vector2.by_value],
125
213
  ]
126
- args = {
127
- :InitPhysics => [],
128
- :UpdatePhysics => [],
129
- :ResetPhysics => [],
130
- :ClosePhysics => [],
131
- :SetPhysicsTimeStep => [:double],
132
- :SetPhysicsGravity => [:float, :float],
133
- :CreatePhysicsBodyCircle => [Vector2.by_value, :float, :float],
134
- :CreatePhysicsBodyRectangle => [Vector2.by_value, :float, :float, :float],
135
- :CreatePhysicsBodyPolygon => [Vector2.by_value, :float, :int, :float],
136
- :DestroyPhysicsBody => [:pointer],
137
- :PhysicsAddForce => [:pointer, Vector2.by_value],
138
- :PhysicsAddTorque => [:pointer, :float],
139
- :PhysicsShatter => [:pointer, Vector2.by_value, :float],
140
- :SetPhysicsBodyRotation => [:pointer, :float],
141
- :GetPhysicsBody => [:int],
142
- :GetPhysicsBodiesCount => [],
143
- :GetPhysicsShapeType => [:int],
144
- :GetPhysicsShapeVerticesCount => [:int],
145
- :GetPhysicsShapeVertex => [:pointer, :int],
146
- }
147
- retvals = {
148
- :InitPhysics => :void,
149
- :UpdatePhysics => :void,
150
- :ResetPhysics => :void,
151
- :ClosePhysics => :void,
152
- :SetPhysicsTimeStep => :void,
153
- :SetPhysicsGravity => :void,
154
- :CreatePhysicsBodyCircle => :pointer,
155
- :CreatePhysicsBodyRectangle => :pointer,
156
- :CreatePhysicsBodyPolygon => :pointer,
157
- :DestroyPhysicsBody => :void,
158
- :PhysicsAddForce => :void,
159
- :PhysicsAddTorque => :void,
160
- :PhysicsShatter => :void,
161
- :SetPhysicsBodyRotation => :void,
162
- :GetPhysicsBody => :pointer,
163
- :GetPhysicsBodiesCount => :int,
164
- :GetPhysicsShapeType => :int,
165
- :GetPhysicsShapeVerticesCount => :int,
166
- :GetPhysicsShapeVertex => Vector2.by_value,
167
- }
168
- symbols.each do |sym|
214
+ entries.each do |entry|
169
215
  begin
170
- attach_function sym, args[sym], retvals[sym]
216
+ attach_function entry[0], entry[1], entry[2], entry[3]
171
217
  rescue FFI::NotFoundError => error
172
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
218
+ $stderr.puts("[Warning] Failed to import #{entry[0]} (#{error}).") if output_error
173
219
  end
174
220
  end
175
221
  end
data/lib/raygui.dll CHANGED
Binary file
data/lib/raygui.dylib CHANGED
Binary file