raylib-bindings 0.0.7 → 0.0.10

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/README.md CHANGED
@@ -1,115 +1,122 @@
1
- <!-- -*- mode:markdown; coding:utf-8; -*- -->
2
-
3
- # Yet another raylib wrapper for Ruby #
4
-
5
- * Created : 2021-10-17
6
- * Last modified : 2022-04-29
7
-
8
- Provides Ruby bindings for raylib-related libraries including:
9
-
10
- * [raylib](https://github.com/raysan5/raylib)
11
- * raylib
12
- * raymath
13
- * rlgl
14
- * [raygui](https://github.com/raysan5/raygui)
15
- * [Physac](https://github.com/victorfisac/Physac)
16
-
17
- ## Features ##
18
-
19
- * Generated semi-automatically
20
- * Based on Ruby/FFI
21
- * No need to build C extension library
22
-
23
- ## Prerequisites ##
24
-
25
- * Ruby interpreter
26
- * Tested on:
27
- * [macOS]
28
- * ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin20]
29
- * [Windows] https://rubyinstaller.org/downloads/ Ruby+Devkit
30
- * ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x64-mingw-ucrt]
31
-
32
- * Compiler
33
- * Tested on:
34
- * [macOS] clang
35
-
36
- Apple clang version 13.0.0 (clang-1300.0.29.3)
37
- Target: arm64-apple-darwin20.6.0
38
- Thread model: posix
39
- InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
40
-
41
- * [Windows] gcc
42
-
43
- gcc (Rev10, Built by MSYS2 project) 11.2.0
44
-
45
- * CMake https://cmake.org/download/
46
-
47
- <details>
48
- <summary>Older versions</summary>
49
-
50
- * Ruby interpreter
51
- * Tested on:
52
- * [macOS]
53
- * ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin20]
54
- * ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin20]
55
- * [Windows] https://rubyinstaller.org/downloads/ Ruby+Devkit
56
- * ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x64-mingw-ucrt]
57
- * ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x64-mingw32]
58
-
59
- * Compiler
60
- * Tested on:
61
- * [macOS] clang
62
-
63
- Apple clang version 13.0.0 (clang-1300.0.29.3)
64
- Target: arm64-apple-darwin20.6.0
65
- Thread model: posix
66
- InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
67
-
68
- * [Windows] gcc
69
-
70
- gcc (Rev9, Built by MSYS2 project) 11.2.0
71
-
72
- </details>
73
-
74
- ## Limitation ##
75
-
76
- * `SetTraceLogCallback` and `TraceLogCallback` are unusable since Ruby-FFI does not support `:varargs` parameter in callbacks (`Proc`, etc.)
77
- * Ref.: https://ffi.github.io/ruby-ffi-archive/messages/20130214-%5Bruby-ffi%5D%20Re_%20Callback%20Function%20with%20varargs-345.html
78
-
79
- ## License ##
80
-
81
- Shared libraries in `lib` directory are built on top of these products and are available under the terms of these licenses:
82
-
83
- * `libraylib.dylib`, `libraylib.dll`
84
- * raylib ( https://github.com/raysan5/raylib )
85
- * https://github.com/raysan5/raylib/blob/master/LICENSE
86
- * `raygui.dylib`, `raygui.dll`
87
- * raygui ( https://github.com/raysan5/raygui )
88
- * https://github.com/raysan5/raygui/blob/master/LICENSE
89
- * `physac.dylib`, `physac.dll`
90
- * Physac ( https://github.com/victorfisac/Physac )
91
- * https://github.com/victorfisac/Physac/blob/a8a6c864bfc809f8e4b2f88bb916b90d736b3f4a/src/physac.h#L59-L76
92
-
93
- All ruby codes here are available under the terms of the zlib/libpng License ( http://opensource.org/licenses/Zlib ).
94
-
95
- Ruby-raylib : Yet another raylib wrapper for Ruby
96
- Copyright (c) 2021-2022 vaiorabbit <http://twitter.com/vaiorabbit>
97
-
98
- This software is provided 'as-is', without any express or implied
99
- warranty. In no event will the authors be held liable for any damages
100
- arising from the use of this software.
101
-
102
- Permission is granted to anyone to use this software for any purpose,
103
- including commercial applications, and to alter it and redistribute it
104
- freely, subject to the following restrictions:
105
-
106
- 1. The origin of this software must not be misrepresented; you must not
107
- claim that you wrote the original software. If you use this software
108
- in a product, an acknowledgment in the product documentation would be
109
- appreciated but is not required.
110
-
111
- 2. Altered source versions must be plainly marked as such, and must not be
112
- misrepresented as being the original software.
113
-
114
- 3. This notice may not be removed or altered from any source
115
- distribution.
1
+ <!-- -*- mode:markdown; coding:utf-8; -*- -->
2
+
3
+ # Yet another raylib wrapper for Ruby #
4
+
5
+ * Created : 2021-10-17
6
+ * Last modified : 2022-08-12
7
+
8
+ Provides Ruby bindings for raylib-related libraries including:
9
+
10
+ * [raylib](https://github.com/raysan5/raylib)
11
+ * raylib
12
+ * raymath
13
+ * rlgl
14
+ * [raygui](https://github.com/raysan5/raygui)
15
+ * [Physac](https://github.com/raysan5/physac)
16
+
17
+ ## Features ##
18
+
19
+ * Generated semi-automatically
20
+ * Based on Ruby/FFI
21
+ * No need to build C extension library
22
+
23
+ ## Prerequisites ##
24
+
25
+ * Ruby interpreter
26
+ * Tested on:
27
+ * [macOS]
28
+ * ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
29
+ * [Windows] https://rubyinstaller.org/downloads/ Ruby+Devkit
30
+ * ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x64-mingw-ucrt]
31
+
32
+ * Compiler
33
+ * Tested on:
34
+ * [macOS] clang
35
+
36
+ $ clang --version
37
+ Apple clang version 13.1.6 (clang-1316.0.21.2.5)
38
+ Target: arm64-apple-darwin21.5.0
39
+ Thread model: posix
40
+ InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
41
+
42
+ * [Windows] gcc
43
+
44
+ gcc (Rev10, Built by MSYS2 project) 11.2.0
45
+
46
+ * CMake https://cmake.org/download/
47
+
48
+ <details>
49
+ <summary>Older versions</summary>
50
+
51
+ * Ruby interpreter
52
+ * Tested on:
53
+ * [macOS]
54
+ * ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin20]
55
+ * ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin20]
56
+ * [Windows] https://rubyinstaller.org/downloads/ Ruby+Devkit
57
+ * ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x64-mingw-ucrt]
58
+ * ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x64-mingw32]
59
+
60
+ * Compiler
61
+ * Tested on:
62
+ * [macOS] clang
63
+
64
+ $ clang --version
65
+ Apple clang version 13.1.6 (clang-1316.0.21.2.3)
66
+ Target: arm64-apple-darwin21.5.0
67
+ Thread model: posix
68
+ InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
69
+
70
+ Apple clang version 13.0.0 (clang-1300.0.29.3)
71
+ Target: arm64-apple-darwin20.6.0
72
+ Thread model: posix
73
+ InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
74
+
75
+ * [Windows] gcc
76
+
77
+ gcc (Rev9, Built by MSYS2 project) 11.2.0
78
+
79
+ </details>
80
+
81
+ ## Limitation ##
82
+
83
+ * `SetTraceLogCallback` and `TraceLogCallback` are unusable since Ruby-FFI does not support `:varargs` parameter in callbacks (`Proc`, etc.)
84
+ * Ref.: https://ffi.github.io/ruby-ffi-archive/messages/20130214-%5Bruby-ffi%5D%20Re_%20Callback%20Function%20with%20varargs-345.html
85
+
86
+ ## License ##
87
+
88
+ Shared libraries in `lib` directory are built on top of these products and are available under the terms of these licenses:
89
+
90
+ * `libraylib.dylib`, `libraylib.dll`
91
+ * raylib ( https://github.com/raysan5/raylib )
92
+ * https://github.com/raysan5/raylib/blob/master/LICENSE
93
+ * `raygui.dylib`, `raygui.dll`
94
+ * raygui ( https://github.com/raysan5/raygui )
95
+ * https://github.com/raysan5/raygui/blob/master/LICENSE
96
+ * `physac.dylib`, `physac.dll`
97
+ * Physac ( https://github.com/raysan5/physac )
98
+ * https://github.com/raysan5/physac/blob/4a8e17f263fb8e1150b3fbafc96f880c7d7a4833/src/physac.h#L51-L68
99
+
100
+ All ruby codes here are available under the terms of the zlib/libpng License ( http://opensource.org/licenses/Zlib ).
101
+
102
+ Ruby-raylib : Yet another raylib wrapper for Ruby
103
+ Copyright (c) 2021-2022 vaiorabbit <http://twitter.com/vaiorabbit>
104
+
105
+ This software is provided 'as-is', without any express or implied
106
+ warranty. In no event will the authors be held liable for any damages
107
+ arising from the use of this software.
108
+
109
+ Permission is granted to anyone to use this software for any purpose,
110
+ including commercial applications, and to alter it and redistribute it
111
+ freely, subject to the following restrictions:
112
+
113
+ 1. The origin of this software must not be misrepresented; you must not
114
+ claim that you wrote the original software. If you use this software
115
+ in a product, an acknowledgment in the product documentation would be
116
+ appreciated but is not required.
117
+
118
+ 2. Altered source versions must be plainly marked as such, and must not be
119
+ misrepresented as being the original software.
120
+
121
+ 3. This notice may not be removed or altered from any source
122
+ distribution.
data/lib/libraylib.dll CHANGED
Binary file
data/lib/libraylib.dylib CHANGED
Binary file
data/lib/physac.dll CHANGED
Binary file
data/lib/physac.dylib CHANGED
Binary file
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_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.dll CHANGED
Binary file
data/lib/raygui.dylib CHANGED
Binary file