raylib-bindings 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ChangeLog +95 -0
- data/LICENSE.txt +21 -0
- data/README.md +76 -0
- data/lib/libraylib.4.0.0.dylib +0 -0
- data/lib/libraylib.400.dylib +1 -0
- data/lib/libraylib.dll +0 -0
- data/lib/libraylib.dylib +1 -0
- data/lib/physac.dll +0 -0
- data/lib/physac.dylib +0 -0
- data/lib/physac.rb +178 -0
- data/lib/raygui.dll +0 -0
- data/lib/raygui.dylib +0 -0
- data/lib/raygui.rb +305 -0
- data/lib/raylib.rb +151 -0
- data/lib/raylib_main.rb +2148 -0
- data/lib/raymath.rb +342 -0
- data/lib/rlgl.rb +648 -0
- metadata +62 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e036ae2e91de703e2fc212088a7856b11660bc8ce11f77bd3a0a72740e014255
|
4
|
+
data.tar.gz: ae6a555ea7abed386675d56402ea4e862a95f4abae4ed1fd9aead19e7be330b9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 22df4ecf798670ecd25ec3b8dd8b117ffc2f4dd0b87b32e1aeb8f3a8a5c74033ef7dc0f57765d383a798fb82d67cb83e70588f465d6ecb01d73d83ecbcefa017
|
7
|
+
data.tar.gz: ea793e3f209ccf93c58677d781476352e4795ac81359d5bc1435c3b980c618474e88c3796e44fa4861d3579c8a73a4cee414fbeec6f6cacd5f26a6ef737f571b
|
data/ChangeLog
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
2021-12-15 vaiorabbit <http://twitter.com/vaiorabbit>
|
2
|
+
|
3
|
+
* Pulled latest raylib ( https://github.com/raysan5/raylib/commit/0454acaacfaae4a3269d443d3d88045240f738c3 )
|
4
|
+
* Added generator scripts for Windows
|
5
|
+
|
6
|
+
2021-11-14 vaiorabbit <http://twitter.com/vaiorabbit>
|
7
|
+
|
8
|
+
* examples/core_storage_values.rb: Added
|
9
|
+
|
10
|
+
2021-11-13 vaiorabbit <http://twitter.com/vaiorabbit>
|
11
|
+
|
12
|
+
* examples/core_drop_files.rb: Added
|
13
|
+
|
14
|
+
2021-11-09 vaiorabbit <http://twitter.com/vaiorabbit>
|
15
|
+
|
16
|
+
* examples/models_first_person_maze.rb: Added
|
17
|
+
|
18
|
+
2021-11-08 vaiorabbit <http://twitter.com/vaiorabbit>
|
19
|
+
|
20
|
+
* examples/raylib_opengl_interop.rb: Added
|
21
|
+
* examples/models_geometric_shapes.rb: Added
|
22
|
+
|
23
|
+
2021-11-07 vaiorabbit <http://twitter.com/vaiorabbit>
|
24
|
+
|
25
|
+
* examples/rlgl_compute_shader.rb: Added
|
26
|
+
* examples/models_billboard.rb: Added
|
27
|
+
|
28
|
+
2021-11-06 vaiorabbit <http://twitter.com/vaiorabbit>
|
29
|
+
|
30
|
+
* examples/physics_demo.rb: Added
|
31
|
+
* examples/textures_background_scrolling.rb: Added
|
32
|
+
* Added dll build scripts for Windows
|
33
|
+
|
34
|
+
2021-11-05 vaiorabbit <http://twitter.com/vaiorabbit>
|
35
|
+
|
36
|
+
* examples/models_box_collisions.rb: Added
|
37
|
+
* Added physac wrapper and wrapper generator
|
38
|
+
* Pulled latest raylib ( https://github.com/raysan5/raylib/commit/2021f09db4df72aea9f963666435bddf0718df94 )
|
39
|
+
|
40
|
+
2021-11-04 vaiorabbit <http://twitter.com/vaiorabbit>
|
41
|
+
|
42
|
+
* Bugfix: Generate correct signatures for raymath and rlgl
|
43
|
+
* Pulled latest raylib ( https://github.com/raysan5/raylib/commit/d18f3fca30858916546908e40cc2e0cea2be03ca )
|
44
|
+
* Bugfix: Fixed wrong signature in raymath.rb
|
45
|
+
* examples/audio_sound_loading.rb: Added
|
46
|
+
* examples/audio_music_stream.rb: Added
|
47
|
+
|
48
|
+
2021-11-03 vaiorabbit <http://twitter.com/vaiorabbit>
|
49
|
+
|
50
|
+
* Added raygui wrapper and wrapper generator
|
51
|
+
* examples/shapes_draw_circle_sector.rb: Added
|
52
|
+
|
53
|
+
2021-10-31 vaiorabbit <http://twitter.com/vaiorabbit>
|
54
|
+
|
55
|
+
* examples/text_unicode.rb: Added
|
56
|
+
* examples/textures_bunnymark.rb: Added
|
57
|
+
|
58
|
+
2021-10-28 vaiorabbit <http://twitter.com/vaiorabbit>
|
59
|
+
|
60
|
+
* examples/core_loading_thread.rb: Added
|
61
|
+
* examples/bitmap_font.rb and font/VP16Font_XNA.png: Added
|
62
|
+
|
63
|
+
2021-10-27 vaiorabbit <http://twitter.com/vaiorabbit>
|
64
|
+
|
65
|
+
* examples/models_waving_cubes.rb: Added
|
66
|
+
|
67
|
+
2021-10-26 vaiorabbit <http://twitter.com/vaiorabbit>
|
68
|
+
|
69
|
+
* examples/models_rlgl_solar_system.rb: Added
|
70
|
+
* Bugfix: DEG2RAD and RAD2DEG duplication
|
71
|
+
* examples/models_cubicmap.rb: Added
|
72
|
+
|
73
|
+
2021-10-25 vaiorabbit <http://twitter.com/vaiorabbit>
|
74
|
+
|
75
|
+
* examples/utf8_font.rb: Added
|
76
|
+
|
77
|
+
2021-10-24 vaiorabbit <http://twitter.com/vaiorabbit>
|
78
|
+
|
79
|
+
* generator: Add ".by_value" to struct arguments
|
80
|
+
* generator: Add struct alias hook
|
81
|
+
* examples: Added
|
82
|
+
* examples/shapes_basic_shapes.rb: Added
|
83
|
+
* generator: Now correctly handles variable-length arguments (TextFormat and TraceLog)
|
84
|
+
* Added helper functions (Color.from_u8, Vector2.create, etc.)
|
85
|
+
* examples/core_3d_camera_first_person.rb: Added
|
86
|
+
* generator: Now correctly handles return values
|
87
|
+
* Bugfix: Removed duplicated enums / Names of some structs must start with capital letter
|
88
|
+
|
89
|
+
2021-10-23 vaiorabbit <http://twitter.com/vaiorabbit>
|
90
|
+
|
91
|
+
* Experimental raylib header parser
|
92
|
+
|
93
|
+
2021-10-17 vaiorabbit <http://twitter.com/vaiorabbit>
|
94
|
+
|
95
|
+
* initial commit
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Ruby-raylib : Yet another raylib wrapper for Ruby
|
2
|
+
Copyright (c) 2021 vaiorabbit <http://twitter.com/vaiorabbit>
|
3
|
+
|
4
|
+
This software is provided 'as-is', without any express or implied
|
5
|
+
warranty. In no event will the authors be held liable for any damages
|
6
|
+
arising from the use of this software.
|
7
|
+
|
8
|
+
Permission is granted to anyone to use this software for any purpose,
|
9
|
+
including commercial applications, and to alter it and redistribute it
|
10
|
+
freely, subject to the following restrictions:
|
11
|
+
|
12
|
+
1. The origin of this software must not be misrepresented; you must not
|
13
|
+
claim that you wrote the original software. If you use this software
|
14
|
+
in a product, an acknowledgment in the product documentation would be
|
15
|
+
appreciated but is not required.
|
16
|
+
|
17
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
18
|
+
misrepresented as being the original software.
|
19
|
+
|
20
|
+
3. This notice may not be removed or altered from any source
|
21
|
+
distribution.
|
data/README.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
<!-- -*- mode:markdown; coding:utf-8; -*- -->
|
2
|
+
|
3
|
+
# Yet another raylib wrapper for Ruby #
|
4
|
+
|
5
|
+
Provides latest [raylib](https://github.com/raysan5/raylib) API for Ruby
|
6
|
+
|
7
|
+
* Created : 2021-10-17
|
8
|
+
* Last modified : 2021-12-15
|
9
|
+
|
10
|
+
## Features ##
|
11
|
+
|
12
|
+
* Generated semi-automatically
|
13
|
+
* Based on Ruby/FFI
|
14
|
+
* No need to build C extension library
|
15
|
+
|
16
|
+
## Prerequisites ##
|
17
|
+
|
18
|
+
* Ruby interpreter
|
19
|
+
* Tested on:
|
20
|
+
* [macOS]
|
21
|
+
* ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin20]
|
22
|
+
* [Windows] https://rubyinstaller.org/downloads/ Ruby+Devkit
|
23
|
+
* ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x64-mingw32]
|
24
|
+
|
25
|
+
* Compiler
|
26
|
+
* Tested on:
|
27
|
+
* [macOS] clang
|
28
|
+
|
29
|
+
Apple clang version 13.0.0 (clang-1300.0.29.3)
|
30
|
+
Target: arm64-apple-darwin20.6.0
|
31
|
+
Thread model: posix
|
32
|
+
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
|
33
|
+
|
34
|
+
* [Windows] gcc
|
35
|
+
|
36
|
+
gcc (Rev5, Built by MSYS2 project) 10.3.0
|
37
|
+
|
38
|
+
* CMake https://cmake.org/download/
|
39
|
+
|
40
|
+
## License ##
|
41
|
+
|
42
|
+
Shared libraries in `lib` directory are built on top of these products and are available under the terms of these licenses:
|
43
|
+
|
44
|
+
* `libraylib.dylib`, `libraylib.dll`
|
45
|
+
* raylib ( https://github.com/raysan5/raylib )
|
46
|
+
* https://github.com/raysan5/raylib/blob/master/LICENSE
|
47
|
+
* `raygui.dylib`, `raygui.dll`
|
48
|
+
* raygui ( https://github.com/raysan5/raygui )
|
49
|
+
* https://github.com/raysan5/raygui/blob/master/LICENSE
|
50
|
+
* `physac.dylib`, `physac.dll`
|
51
|
+
* Physac ( https://github.com/victorfisac/Physac )
|
52
|
+
* https://github.com/victorfisac/Physac/blob/a8a6c864bfc809f8e4b2f88bb916b90d736b3f4a/src/physac.h#L59-L76
|
53
|
+
|
54
|
+
All ruby codes here are available under the terms of the zlib/libpng License ( http://opensource.org/licenses/Zlib ).
|
55
|
+
|
56
|
+
Ruby-raylib : Yet another raylib wrapper for Ruby
|
57
|
+
Copyright (c) 2021 vaiorabbit <http://twitter.com/vaiorabbit>
|
58
|
+
|
59
|
+
This software is provided 'as-is', without any express or implied
|
60
|
+
warranty. In no event will the authors be held liable for any damages
|
61
|
+
arising from the use of this software.
|
62
|
+
|
63
|
+
Permission is granted to anyone to use this software for any purpose,
|
64
|
+
including commercial applications, and to alter it and redistribute it
|
65
|
+
freely, subject to the following restrictions:
|
66
|
+
|
67
|
+
1. The origin of this software must not be misrepresented; you must not
|
68
|
+
claim that you wrote the original software. If you use this software
|
69
|
+
in a product, an acknowledgment in the product documentation would be
|
70
|
+
appreciated but is not required.
|
71
|
+
|
72
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
73
|
+
misrepresented as being the original software.
|
74
|
+
|
75
|
+
3. This notice may not be removed or altered from any source
|
76
|
+
distribution.
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
libraylib.4.0.0.dylib
|
data/lib/libraylib.dll
ADDED
Binary file
|
data/lib/libraylib.dylib
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
libraylib.400.dylib
|
data/lib/physac.dll
ADDED
Binary file
|
data/lib/physac.dylib
ADDED
Binary file
|
data/lib/physac.rb
ADDED
@@ -0,0 +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
|
+
|
data/lib/raygui.dll
ADDED
Binary file
|
data/lib/raygui.dylib
ADDED
Binary file
|
data/lib/raygui.rb
ADDED
@@ -0,0 +1,305 @@
|
|
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
|
+
RAYGUI_VERSION = "3.0"
|
14
|
+
|
15
|
+
# Enum
|
16
|
+
|
17
|
+
GUI_STATE_NORMAL = 0
|
18
|
+
GUI_STATE_FOCUSED = 1
|
19
|
+
GUI_STATE_PRESSED = 2
|
20
|
+
GUI_STATE_DISABLED = 3
|
21
|
+
GUI_TEXT_ALIGN_LEFT = 0
|
22
|
+
GUI_TEXT_ALIGN_CENTER = 1
|
23
|
+
GUI_TEXT_ALIGN_RIGHT = 2
|
24
|
+
DEFAULT = 0
|
25
|
+
LABEL = 1
|
26
|
+
BUTTON = 2
|
27
|
+
TOGGLE = 3
|
28
|
+
SLIDER = 4
|
29
|
+
PROGRESSBAR = 5
|
30
|
+
CHECKBOX = 6
|
31
|
+
COMBOBOX = 7
|
32
|
+
DROPDOWNBOX = 8
|
33
|
+
TEXTBOX = 9
|
34
|
+
VALUEBOX = 10
|
35
|
+
SPINNER = 11
|
36
|
+
LISTVIEW = 12
|
37
|
+
COLORPICKER = 13
|
38
|
+
SCROLLBAR = 14
|
39
|
+
STATUSBAR = 15
|
40
|
+
BORDER_COLOR_NORMAL = 0
|
41
|
+
BASE_COLOR_NORMAL = 1
|
42
|
+
TEXT_COLOR_NORMAL = 2
|
43
|
+
BORDER_COLOR_FOCUSED = 3
|
44
|
+
BASE_COLOR_FOCUSED = 4
|
45
|
+
TEXT_COLOR_FOCUSED = 5
|
46
|
+
BORDER_COLOR_PRESSED = 6
|
47
|
+
BASE_COLOR_PRESSED = 7
|
48
|
+
TEXT_COLOR_PRESSED = 8
|
49
|
+
BORDER_COLOR_DISABLED = 9
|
50
|
+
BASE_COLOR_DISABLED = 10
|
51
|
+
TEXT_COLOR_DISABLED = 11
|
52
|
+
BORDER_WIDTH = 12
|
53
|
+
TEXT_PADDING = 13
|
54
|
+
TEXT_ALIGNMENT = 14
|
55
|
+
RESERVED = 15
|
56
|
+
TEXT_SIZE = 16
|
57
|
+
TEXT_SPACING = 17
|
58
|
+
LINE_COLOR = 18
|
59
|
+
BACKGROUND_COLOR = 19
|
60
|
+
GROUP_PADDING = 16
|
61
|
+
SLIDER_WIDTH = 16
|
62
|
+
SLIDER_PADDING = 17
|
63
|
+
PROGRESS_PADDING = 16
|
64
|
+
CHECK_PADDING = 16
|
65
|
+
COMBO_BUTTON_WIDTH = 16
|
66
|
+
COMBO_BUTTON_PADDING = 17
|
67
|
+
ARROW_PADDING = 16
|
68
|
+
DROPDOWN_ITEMS_PADDING = 17
|
69
|
+
TEXT_INNER_PADDING = 16
|
70
|
+
TEXT_LINES_PADDING = 17
|
71
|
+
COLOR_SELECTED_FG = 18
|
72
|
+
COLOR_SELECTED_BG = 19
|
73
|
+
SPIN_BUTTON_WIDTH = 16
|
74
|
+
SPIN_BUTTON_PADDING = 17
|
75
|
+
ARROWS_SIZE = 16
|
76
|
+
ARROWS_VISIBLE = 17
|
77
|
+
SCROLL_SLIDER_PADDING = 18
|
78
|
+
SCROLL_SLIDER_SIZE = 19
|
79
|
+
SCROLL_PADDING = 20
|
80
|
+
SCROLL_SPEED = 21
|
81
|
+
SCROLLBAR_LEFT_SIDE = 0
|
82
|
+
SCROLLBAR_RIGHT_SIDE = 1
|
83
|
+
LIST_ITEMS_HEIGHT = 16
|
84
|
+
LIST_ITEMS_PADDING = 17
|
85
|
+
SCROLLBAR_WIDTH = 18
|
86
|
+
SCROLLBAR_SIDE = 19
|
87
|
+
COLOR_SELECTOR_SIZE = 16
|
88
|
+
HUEBAR_WIDTH = 17
|
89
|
+
HUEBAR_PADDING = 18
|
90
|
+
HUEBAR_SELECTOR_HEIGHT = 19
|
91
|
+
HUEBAR_SELECTOR_OVERFLOW = 20
|
92
|
+
|
93
|
+
# Typedef
|
94
|
+
|
95
|
+
typedef :int, :GuiControlState
|
96
|
+
typedef :int, :GuiTextAlignment
|
97
|
+
typedef :int, :GuiControl
|
98
|
+
typedef :int, :GuiControlProperty
|
99
|
+
typedef :int, :GuiDefaultProperty
|
100
|
+
typedef :int, :GuiToggleProperty
|
101
|
+
typedef :int, :GuiSliderProperty
|
102
|
+
typedef :int, :GuiProgressBarProperty
|
103
|
+
typedef :int, :GuiCheckBoxProperty
|
104
|
+
typedef :int, :GuiComboBoxProperty
|
105
|
+
typedef :int, :GuiDropdownBoxProperty
|
106
|
+
typedef :int, :GuiTextBoxProperty
|
107
|
+
typedef :int, :GuiSpinnerProperty
|
108
|
+
typedef :int, :GuiScrollBarProperty
|
109
|
+
typedef :int, :GuiScrollBarSide
|
110
|
+
typedef :int, :GuiListViewProperty
|
111
|
+
typedef :int, :GuiColorPickerProperty
|
112
|
+
|
113
|
+
# Struct
|
114
|
+
|
115
|
+
class GuiStyleProp < FFI::Struct
|
116
|
+
layout(
|
117
|
+
:controlId, :ushort,
|
118
|
+
:propertyId, :ushort,
|
119
|
+
:propertyValue, :int,
|
120
|
+
)
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
# Function
|
125
|
+
|
126
|
+
def self.setup_raygui_symbols()
|
127
|
+
symbols = [
|
128
|
+
:GuiEnable,
|
129
|
+
:GuiDisable,
|
130
|
+
:GuiLock,
|
131
|
+
:GuiUnlock,
|
132
|
+
:GuiIsLocked,
|
133
|
+
:GuiFade,
|
134
|
+
:GuiSetState,
|
135
|
+
:GuiGetState,
|
136
|
+
:GuiSetFont,
|
137
|
+
:GuiGetFont,
|
138
|
+
:GuiSetStyle,
|
139
|
+
:GuiGetStyle,
|
140
|
+
:GuiWindowBox,
|
141
|
+
:GuiGroupBox,
|
142
|
+
:GuiLine,
|
143
|
+
:GuiPanel,
|
144
|
+
:GuiScrollPanel,
|
145
|
+
:GuiLabel,
|
146
|
+
:GuiButton,
|
147
|
+
:GuiLabelButton,
|
148
|
+
:GuiToggle,
|
149
|
+
:GuiToggleGroup,
|
150
|
+
:GuiCheckBox,
|
151
|
+
:GuiComboBox,
|
152
|
+
:GuiDropdownBox,
|
153
|
+
:GuiSpinner,
|
154
|
+
:GuiValueBox,
|
155
|
+
:GuiTextBox,
|
156
|
+
:GuiTextBoxMulti,
|
157
|
+
:GuiSlider,
|
158
|
+
:GuiSliderBar,
|
159
|
+
:GuiProgressBar,
|
160
|
+
:GuiStatusBar,
|
161
|
+
:GuiDummyRec,
|
162
|
+
:GuiScrollBar,
|
163
|
+
:GuiGrid,
|
164
|
+
:GuiListView,
|
165
|
+
:GuiListViewEx,
|
166
|
+
:GuiMessageBox,
|
167
|
+
:GuiTextInputBox,
|
168
|
+
:GuiColorPicker,
|
169
|
+
:GuiColorPanel,
|
170
|
+
:GuiColorBarAlpha,
|
171
|
+
:GuiColorBarHue,
|
172
|
+
:GuiLoadStyle,
|
173
|
+
:GuiLoadStyleDefault,
|
174
|
+
:GuiIconText,
|
175
|
+
:GuiDrawIcon,
|
176
|
+
:GuiGetIcons,
|
177
|
+
:GuiGetIconData,
|
178
|
+
:GuiSetIconData,
|
179
|
+
:GuiSetIconPixel,
|
180
|
+
:GuiClearIconPixel,
|
181
|
+
:GuiCheckIconPixel,
|
182
|
+
]
|
183
|
+
args = {
|
184
|
+
:GuiEnable => [],
|
185
|
+
:GuiDisable => [],
|
186
|
+
:GuiLock => [],
|
187
|
+
:GuiUnlock => [],
|
188
|
+
:GuiIsLocked => [],
|
189
|
+
:GuiFade => [:float],
|
190
|
+
:GuiSetState => [:int],
|
191
|
+
:GuiGetState => [],
|
192
|
+
:GuiSetFont => [Font.by_value],
|
193
|
+
:GuiGetFont => [],
|
194
|
+
:GuiSetStyle => [:int, :int, :int],
|
195
|
+
:GuiGetStyle => [:int, :int],
|
196
|
+
:GuiWindowBox => [Rectangle.by_value, :pointer],
|
197
|
+
:GuiGroupBox => [Rectangle.by_value, :pointer],
|
198
|
+
:GuiLine => [Rectangle.by_value, :pointer],
|
199
|
+
:GuiPanel => [Rectangle.by_value],
|
200
|
+
:GuiScrollPanel => [Rectangle.by_value, Rectangle.by_value, :pointer],
|
201
|
+
:GuiLabel => [Rectangle.by_value, :pointer],
|
202
|
+
:GuiButton => [Rectangle.by_value, :pointer],
|
203
|
+
:GuiLabelButton => [Rectangle.by_value, :pointer],
|
204
|
+
:GuiToggle => [Rectangle.by_value, :pointer, :bool],
|
205
|
+
:GuiToggleGroup => [Rectangle.by_value, :pointer, :int],
|
206
|
+
:GuiCheckBox => [Rectangle.by_value, :pointer, :bool],
|
207
|
+
:GuiComboBox => [Rectangle.by_value, :pointer, :int],
|
208
|
+
:GuiDropdownBox => [Rectangle.by_value, :pointer, :pointer, :bool],
|
209
|
+
:GuiSpinner => [Rectangle.by_value, :pointer, :pointer, :int, :int, :bool],
|
210
|
+
:GuiValueBox => [Rectangle.by_value, :pointer, :pointer, :int, :int, :bool],
|
211
|
+
:GuiTextBox => [Rectangle.by_value, :pointer, :int, :bool],
|
212
|
+
:GuiTextBoxMulti => [Rectangle.by_value, :pointer, :int, :bool],
|
213
|
+
:GuiSlider => [Rectangle.by_value, :pointer, :pointer, :float, :float, :float],
|
214
|
+
:GuiSliderBar => [Rectangle.by_value, :pointer, :pointer, :float, :float, :float],
|
215
|
+
:GuiProgressBar => [Rectangle.by_value, :pointer, :pointer, :float, :float, :float],
|
216
|
+
:GuiStatusBar => [Rectangle.by_value, :pointer],
|
217
|
+
:GuiDummyRec => [Rectangle.by_value, :pointer],
|
218
|
+
:GuiScrollBar => [Rectangle.by_value, :int, :int, :int],
|
219
|
+
:GuiGrid => [Rectangle.by_value, :float, :int],
|
220
|
+
:GuiListView => [Rectangle.by_value, :pointer, :pointer, :int],
|
221
|
+
:GuiListViewEx => [Rectangle.by_value, :pointer, :int, :pointer, :pointer, :int],
|
222
|
+
:GuiMessageBox => [Rectangle.by_value, :pointer, :pointer, :pointer],
|
223
|
+
:GuiTextInputBox => [Rectangle.by_value, :pointer, :pointer, :pointer, :pointer],
|
224
|
+
:GuiColorPicker => [Rectangle.by_value, Color.by_value],
|
225
|
+
:GuiColorPanel => [Rectangle.by_value, Color.by_value],
|
226
|
+
:GuiColorBarAlpha => [Rectangle.by_value, :float],
|
227
|
+
:GuiColorBarHue => [Rectangle.by_value, :float],
|
228
|
+
:GuiLoadStyle => [:pointer],
|
229
|
+
:GuiLoadStyleDefault => [],
|
230
|
+
:GuiIconText => [:int, :pointer],
|
231
|
+
:GuiDrawIcon => [:int, :int, :int, :int, Color.by_value],
|
232
|
+
:GuiGetIcons => [],
|
233
|
+
:GuiGetIconData => [:int],
|
234
|
+
:GuiSetIconData => [:int, :pointer],
|
235
|
+
:GuiSetIconPixel => [:int, :int, :int],
|
236
|
+
:GuiClearIconPixel => [:int, :int, :int],
|
237
|
+
:GuiCheckIconPixel => [:int, :int, :int],
|
238
|
+
}
|
239
|
+
retvals = {
|
240
|
+
:GuiEnable => :void,
|
241
|
+
:GuiDisable => :void,
|
242
|
+
:GuiLock => :void,
|
243
|
+
:GuiUnlock => :void,
|
244
|
+
:GuiIsLocked => :bool,
|
245
|
+
:GuiFade => :void,
|
246
|
+
:GuiSetState => :void,
|
247
|
+
:GuiGetState => :int,
|
248
|
+
:GuiSetFont => :void,
|
249
|
+
:GuiGetFont => Font.by_value,
|
250
|
+
:GuiSetStyle => :void,
|
251
|
+
:GuiGetStyle => :int,
|
252
|
+
:GuiWindowBox => :bool,
|
253
|
+
:GuiGroupBox => :void,
|
254
|
+
:GuiLine => :void,
|
255
|
+
:GuiPanel => :void,
|
256
|
+
:GuiScrollPanel => Rectangle.by_value,
|
257
|
+
:GuiLabel => :void,
|
258
|
+
:GuiButton => :bool,
|
259
|
+
:GuiLabelButton => :bool,
|
260
|
+
:GuiToggle => :bool,
|
261
|
+
:GuiToggleGroup => :int,
|
262
|
+
:GuiCheckBox => :bool,
|
263
|
+
:GuiComboBox => :int,
|
264
|
+
:GuiDropdownBox => :bool,
|
265
|
+
:GuiSpinner => :bool,
|
266
|
+
:GuiValueBox => :bool,
|
267
|
+
:GuiTextBox => :bool,
|
268
|
+
:GuiTextBoxMulti => :bool,
|
269
|
+
:GuiSlider => :float,
|
270
|
+
:GuiSliderBar => :float,
|
271
|
+
:GuiProgressBar => :float,
|
272
|
+
:GuiStatusBar => :void,
|
273
|
+
:GuiDummyRec => :void,
|
274
|
+
:GuiScrollBar => :int,
|
275
|
+
:GuiGrid => Vector2.by_value,
|
276
|
+
:GuiListView => :int,
|
277
|
+
:GuiListViewEx => :int,
|
278
|
+
:GuiMessageBox => :int,
|
279
|
+
:GuiTextInputBox => :int,
|
280
|
+
:GuiColorPicker => Color.by_value,
|
281
|
+
:GuiColorPanel => Color.by_value,
|
282
|
+
:GuiColorBarAlpha => :float,
|
283
|
+
:GuiColorBarHue => :float,
|
284
|
+
:GuiLoadStyle => :void,
|
285
|
+
:GuiLoadStyleDefault => :void,
|
286
|
+
:GuiIconText => :pointer,
|
287
|
+
:GuiDrawIcon => :void,
|
288
|
+
:GuiGetIcons => :pointer,
|
289
|
+
:GuiGetIconData => :pointer,
|
290
|
+
:GuiSetIconData => :void,
|
291
|
+
:GuiSetIconPixel => :void,
|
292
|
+
:GuiClearIconPixel => :void,
|
293
|
+
:GuiCheckIconPixel => :bool,
|
294
|
+
}
|
295
|
+
symbols.each do |sym|
|
296
|
+
begin
|
297
|
+
attach_function sym, args[sym], retvals[sym]
|
298
|
+
rescue FFI::NotFoundError => error
|
299
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
300
|
+
end
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
end
|
305
|
+
|