raylib-bindings 0.0.10 → 0.1.0

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,178 +1,178 @@
1
- # Yet another raylib wrapper for Ruby
2
- #
3
- # * https://github.com/vaiorabbit/raylib-bindings
4
- #
5
- # [NOTICE] This is an automatically generated file.
6
-
7
- require 'ffi'
8
-
9
- module Raylib
10
- extend FFI::Library
11
- # Define/Macro
12
-
13
- PHYSAC_MAX_BODIES = 64
14
- PHYSAC_MAX_MANIFOLDS = 4096
15
- PHYSAC_MAX_VERTICES = 24
16
- PHYSAC_DEFAULT_CIRCLE_VERTICES = 24
17
- PHYSAC_COLLISION_ITERATIONS = 100
18
- PHYSAC_PENETRATION_ALLOWANCE = 0.05
19
- PHYSAC_PENETRATION_CORRECTION = 0.4
20
- PHYSAC_PI = 3.14159265358979323846
21
-
22
- # Enum
23
-
24
- PHYSICS_CIRCLE = 0
25
- PHYSICS_POLYGON = 1
26
-
27
- # Typedef
28
-
29
- typedef :int, :PhysicsShapeType
30
- typedef :pointer, :PhysicsBody
31
- typedef :pointer, :PhysicsManifold
32
-
33
- # Struct
34
-
35
- class Matrix2x2 < FFI::Struct
36
- layout(
37
- :m00, :float,
38
- :m01, :float,
39
- :m10, :float,
40
- :m11, :float,
41
- )
42
- end
43
-
44
- class PhysicsVertexData < FFI::Struct
45
- layout(
46
- :vertexCount, :uint,
47
- :positions, [Vector2, 24],
48
- :normals, [Vector2, 24],
49
- )
50
- end
51
-
52
- class PhysicsShape < FFI::Struct
53
- layout(
54
- :type, :int,
55
- :body, :pointer,
56
- :vertexData, PhysicsVertexData,
57
- :radius, :float,
58
- :transform, Matrix2x2,
59
- )
60
- end
61
-
62
- class PhysicsBodyData < FFI::Struct
63
- 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,
83
- )
84
- end
85
-
86
- class PhysicsManifoldData < FFI::Struct
87
- 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,
98
- )
99
- end
100
-
101
-
102
- # Function
103
-
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,
125
- ]
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|
169
- begin
170
- attach_function sym, args[sym], retvals[sym]
171
- rescue FFI::NotFoundError => error
172
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
173
- end
174
- end
175
- end
176
-
177
- end
178
-
1
+ # Yet another raylib wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/raylib-bindings
4
+ #
5
+ # [NOTICE] This is an automatically generated file.
6
+
7
+ require 'ffi'
8
+
9
+ module Raylib
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+ PHYSAC_MAX_BODIES = 64
14
+ PHYSAC_MAX_MANIFOLDS = 4096
15
+ PHYSAC_MAX_VERTICES = 24
16
+ PHYSAC_DEFAULT_CIRCLE_VERTICES = 24
17
+ PHYSAC_COLLISION_ITERATIONS = 100
18
+ PHYSAC_PENETRATION_ALLOWANCE = 0.05
19
+ PHYSAC_PENETRATION_CORRECTION = 0.4
20
+ PHYSAC_PI = 3.14159265358979323846
21
+
22
+ # Enum
23
+
24
+ PHYSICS_CIRCLE = 0
25
+ PHYSICS_POLYGON = 1
26
+
27
+ # Typedef
28
+
29
+ typedef :int, :PhysicsShapeType
30
+ typedef :pointer, :PhysicsBody
31
+ typedef :pointer, :PhysicsManifold
32
+
33
+ # Struct
34
+
35
+ class Matrix2x2 < FFI::Struct
36
+ layout(
37
+ :m00, :float,
38
+ :m01, :float,
39
+ :m10, :float,
40
+ :m11, :float,
41
+ )
42
+ end
43
+
44
+ class PhysicsVertexData < FFI::Struct
45
+ layout(
46
+ :vertexCount, :uint,
47
+ :positions, [Vector2, 24],
48
+ :normals, [Vector2, 24],
49
+ )
50
+ end
51
+
52
+ class PhysicsShape < FFI::Struct
53
+ layout(
54
+ :type, :int,
55
+ :body, :pointer,
56
+ :vertexData, PhysicsVertexData,
57
+ :radius, :float,
58
+ :transform, Matrix2x2,
59
+ )
60
+ end
61
+
62
+ class PhysicsBodyData < FFI::Struct
63
+ 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,
83
+ )
84
+ end
85
+
86
+ class PhysicsManifoldData < FFI::Struct
87
+ 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,
98
+ )
99
+ end
100
+
101
+
102
+ # Function
103
+
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,
125
+ ]
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|
169
+ begin
170
+ attach_function sym, args[sym], retvals[sym]
171
+ rescue FFI::NotFoundError => error
172
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
173
+ end
174
+ end
175
+ end
176
+
177
+ end
178
+
data/lib/raygui.dylib CHANGED
File without changes