raylib-bindings 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
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_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 Mat2 < FFI::Struct
36
- layout(
37
- :m00, :float,
38
- :m01, :float,
39
- :m10, :float,
40
- :m11, :float,
41
- )
42
- end
43
-
44
- class PolygonData < 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
- :radius, :float,
57
- :transform, Mat2,
58
- :vertexData, PolygonData,
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
- :RunPhysicsStep,
108
- :SetPhysicsTimeStep,
109
- :IsPhysicsEnabled,
110
- :SetPhysicsGravity,
111
- :CreatePhysicsBodyCircle,
112
- :CreatePhysicsBodyRectangle,
113
- :CreatePhysicsBodyPolygon,
114
- :PhysicsAddForce,
115
- :PhysicsAddTorque,
116
- :PhysicsShatter,
117
- :GetPhysicsBodiesCount,
118
- :GetPhysicsBody,
119
- :GetPhysicsShapeType,
120
- :GetPhysicsShapeVerticesCount,
121
- :GetPhysicsShapeVertex,
122
- :SetPhysicsBodyRotation,
123
- :DestroyPhysicsBody,
124
- :ClosePhysics,
125
- ]
126
- args = {
127
- :InitPhysics => [],
128
- :RunPhysicsStep => [],
129
- :SetPhysicsTimeStep => [:double],
130
- :IsPhysicsEnabled => [],
131
- :SetPhysicsGravity => [:float, :float],
132
- :CreatePhysicsBodyCircle => [Vector2.by_value, :float, :float],
133
- :CreatePhysicsBodyRectangle => [Vector2.by_value, :float, :float, :float],
134
- :CreatePhysicsBodyPolygon => [Vector2.by_value, :float, :int, :float],
135
- :PhysicsAddForce => [:pointer, Vector2.by_value],
136
- :PhysicsAddTorque => [:pointer, :float],
137
- :PhysicsShatter => [:pointer, Vector2.by_value, :float],
138
- :GetPhysicsBodiesCount => [],
139
- :GetPhysicsBody => [:int],
140
- :GetPhysicsShapeType => [:int],
141
- :GetPhysicsShapeVerticesCount => [:int],
142
- :GetPhysicsShapeVertex => [:pointer, :int],
143
- :SetPhysicsBodyRotation => [:pointer, :float],
144
- :DestroyPhysicsBody => [:pointer],
145
- :ClosePhysics => [],
146
- }
147
- retvals = {
148
- :InitPhysics => :void,
149
- :RunPhysicsStep => :void,
150
- :SetPhysicsTimeStep => :void,
151
- :IsPhysicsEnabled => :bool,
152
- :SetPhysicsGravity => :void,
153
- :CreatePhysicsBodyCircle => :pointer,
154
- :CreatePhysicsBodyRectangle => :pointer,
155
- :CreatePhysicsBodyPolygon => :pointer,
156
- :PhysicsAddForce => :void,
157
- :PhysicsAddTorque => :void,
158
- :PhysicsShatter => :void,
159
- :GetPhysicsBodiesCount => :int,
160
- :GetPhysicsBody => :pointer,
161
- :GetPhysicsShapeType => :int,
162
- :GetPhysicsShapeVerticesCount => :int,
163
- :GetPhysicsShapeVertex => Vector2.by_value,
164
- :SetPhysicsBodyRotation => :void,
165
- :DestroyPhysicsBody => :void,
166
- :ClosePhysics => :void,
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_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 Mat2 < FFI::Struct
36
+ layout(
37
+ :m00, :float,
38
+ :m01, :float,
39
+ :m10, :float,
40
+ :m11, :float,
41
+ )
42
+ end
43
+
44
+ class PolygonData < 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
+ :radius, :float,
57
+ :transform, Mat2,
58
+ :vertexData, PolygonData,
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
+ :RunPhysicsStep,
108
+ :SetPhysicsTimeStep,
109
+ :IsPhysicsEnabled,
110
+ :SetPhysicsGravity,
111
+ :CreatePhysicsBodyCircle,
112
+ :CreatePhysicsBodyRectangle,
113
+ :CreatePhysicsBodyPolygon,
114
+ :PhysicsAddForce,
115
+ :PhysicsAddTorque,
116
+ :PhysicsShatter,
117
+ :GetPhysicsBodiesCount,
118
+ :GetPhysicsBody,
119
+ :GetPhysicsShapeType,
120
+ :GetPhysicsShapeVerticesCount,
121
+ :GetPhysicsShapeVertex,
122
+ :SetPhysicsBodyRotation,
123
+ :DestroyPhysicsBody,
124
+ :ClosePhysics,
125
+ ]
126
+ args = {
127
+ :InitPhysics => [],
128
+ :RunPhysicsStep => [],
129
+ :SetPhysicsTimeStep => [:double],
130
+ :IsPhysicsEnabled => [],
131
+ :SetPhysicsGravity => [:float, :float],
132
+ :CreatePhysicsBodyCircle => [Vector2.by_value, :float, :float],
133
+ :CreatePhysicsBodyRectangle => [Vector2.by_value, :float, :float, :float],
134
+ :CreatePhysicsBodyPolygon => [Vector2.by_value, :float, :int, :float],
135
+ :PhysicsAddForce => [:pointer, Vector2.by_value],
136
+ :PhysicsAddTorque => [:pointer, :float],
137
+ :PhysicsShatter => [:pointer, Vector2.by_value, :float],
138
+ :GetPhysicsBodiesCount => [],
139
+ :GetPhysicsBody => [:int],
140
+ :GetPhysicsShapeType => [:int],
141
+ :GetPhysicsShapeVerticesCount => [:int],
142
+ :GetPhysicsShapeVertex => [:pointer, :int],
143
+ :SetPhysicsBodyRotation => [:pointer, :float],
144
+ :DestroyPhysicsBody => [:pointer],
145
+ :ClosePhysics => [],
146
+ }
147
+ retvals = {
148
+ :InitPhysics => :void,
149
+ :RunPhysicsStep => :void,
150
+ :SetPhysicsTimeStep => :void,
151
+ :IsPhysicsEnabled => :bool,
152
+ :SetPhysicsGravity => :void,
153
+ :CreatePhysicsBodyCircle => :pointer,
154
+ :CreatePhysicsBodyRectangle => :pointer,
155
+ :CreatePhysicsBodyPolygon => :pointer,
156
+ :PhysicsAddForce => :void,
157
+ :PhysicsAddTorque => :void,
158
+ :PhysicsShatter => :void,
159
+ :GetPhysicsBodiesCount => :int,
160
+ :GetPhysicsBody => :pointer,
161
+ :GetPhysicsShapeType => :int,
162
+ :GetPhysicsShapeVerticesCount => :int,
163
+ :GetPhysicsShapeVertex => Vector2.by_value,
164
+ :SetPhysicsBodyRotation => :void,
165
+ :DestroyPhysicsBody => :void,
166
+ :ClosePhysics => :void,
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.dll CHANGED
Binary file
data/lib/raygui.dylib CHANGED
Binary file