raylib-bindings 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b3f1d67b53ae29240274be47c367f11b21ca8b0f6ade8d3d7681d85ad4f48d2
4
- data.tar.gz: 9ca39c8d175730002cff693ac0708ba6f0bca4931b700c70798ed7272d2f5e35
3
+ metadata.gz: ec140a3aeb14467dddc0851eb6dc9b26f1e189955eda32aede4cdb9068163d2a
4
+ data.tar.gz: 9edeefc3c423bb8436b9d0a3779c86abe584a0c719090a8819dd8489689079db
5
5
  SHA512:
6
- metadata.gz: 803d0c18648fd377db9d89b4f603bc0759f147c6281d83d56457215334615c3fca80acb1b324ce7fe6b84369bd452968061a02c7dd46db529286337cd5497f64
7
- data.tar.gz: 17b06c4f5738faa6f69581155bdf0596fc1db33a8d29ab892a569b0d299d1d39cfd484a40dbfea9a28cd70b6e6eb37b6936bb55d239b532745c0e87d1cb135c9
6
+ metadata.gz: 6f46201e5a1c794a319ccae7008220e092837aa860040710d9ba41ff5836bf81c179d48ba72994cf863ce9dce393134d1218e237b76c4f414de6422ddd19bf19
7
+ data.tar.gz: 349f290348f0fe2ac8690dd2bf712a2d1a41f979f4c95e4ca5a1cf7d85dcdd278714688aa359112a845960549870d0deb4775ef88642c4e567b1999966c515ce
data/ChangeLog CHANGED
@@ -1,3 +1,13 @@
1
+ 2022-12-30 vaiorabbit <http://twitter.com/vaiorabbit>
2
+
3
+ * generator: Now generates binding code for config.h
4
+
5
+ 2022-12-29 vaiorabbit <http://twitter.com/vaiorabbit>
6
+
7
+ * generator: Now generates enum descriptions
8
+ * Fixed several codes according to Rubocop warnings
9
+ * lib/raylib_helper.rb: Added several helper functions/classes
10
+
1
11
  2022-12-25 vaiorabbit <http://twitter.com/vaiorabbit>
2
12
 
3
13
  * Converted DrawModelEx into a wrapper function of rbDrawModelEx to avoid Matrix problem found in models_animation sample
data/LICENSE.txt CHANGED
@@ -1,5 +1,5 @@
1
1
  Ruby-raylib : Yet another raylib wrapper for Ruby
2
- Copyright (c) 2021-2022 vaiorabbit <http://twitter.com/vaiorabbit>
2
+ Copyright (c) 2021-2023 vaiorabbit <http://twitter.com/vaiorabbit>
3
3
 
4
4
  This software is provided 'as-is', without any express or implied
5
5
  warranty. In no event will the authors be held liable for any damages
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-12-25
6
+ * Last modified : 2022-12-31
7
7
 
8
8
  Provides Ruby bindings for raylib-related libraries including:
9
9
 
@@ -45,9 +45,9 @@ D:\> ruby template.rb
45
45
  * Ruby interpreter
46
46
  * Tested on:
47
47
  * [macOS]
48
- * ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
48
+ * ruby 3.2.0 (2022-12-25 revision a528908271) [arm64-darwin21]
49
49
  * [Windows] https://rubyinstaller.org/downloads/ Ruby+Devkit
50
- * ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x64-mingw-ucrt]
50
+ * ruby 3.2.0 (2022-12-25 revision a528908271) [x64-mingw-ucrt]
51
51
 
52
52
  * If you need to build DLLs/shared libralies for your own runtime envrioenment (Linux, etc.):
53
53
  * CMake https://cmake.org/download/
@@ -63,7 +63,7 @@ D:\> ruby template.rb
63
63
 
64
64
  * [Windows] gcc
65
65
 
66
- gcc (Rev10, Built by MSYS2 project) 11.2.0
66
+ gcc (Rev7, Built by MSYS2 project) 12.2.0
67
67
 
68
68
 
69
69
  <details>
@@ -72,9 +72,11 @@ D:\> ruby template.rb
72
72
  * Ruby interpreter
73
73
  * Tested on:
74
74
  * [macOS]
75
+ * ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
75
76
  * ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin20]
76
77
  * ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin20]
77
78
  * [Windows] https://rubyinstaller.org/downloads/ Ruby+Devkit
79
+ * ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x64-mingw-ucrt]
78
80
  * ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x64-mingw-ucrt]
79
81
  * ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x64-mingw32]
80
82
 
@@ -96,9 +98,18 @@ D:\> ruby template.rb
96
98
  * [Windows] gcc
97
99
 
98
100
  gcc (Rev9, Built by MSYS2 project) 11.2.0
101
+ gcc (Rev10, Built by MSYS2 project) 11.2.0
99
102
 
100
103
  </details>
101
104
 
105
+ ## Project ##
106
+
107
+ See the project below to learn how to use this library:
108
+
109
+ * Whac-a-Mole! : Ruby raylib bindings demo
110
+ * <img src="https://raw.githubusercontent.com/vaiorabbit/raylib-bindings-whacamole/main/doc/screenshot_00.png" width="300"> <img src="https://raw.githubusercontent.com/vaiorabbit/raylib-bindings-whacamole/main/doc/screenshot_01.png" width="300">
111
+ * <https://github.com/vaiorabbit/raylib-bindings-whacamole>
112
+
102
113
  ## Limitation ##
103
114
 
104
115
  * `SetTraceLogCallback` and `TraceLogCallback` are unusable since Ruby-FFI does not support `:varargs` parameter in callbacks (`Proc`, etc.)
@@ -121,7 +132,7 @@ Shared libraries in `lib` directory are built on top of these products and are a
121
132
  All ruby codes here are available under the terms of the zlib/libpng License ( http://opensource.org/licenses/Zlib ).
122
133
 
123
134
  Ruby-raylib : Yet another raylib wrapper for Ruby
124
- Copyright (c) 2021-2022 vaiorabbit <http://twitter.com/vaiorabbit>
135
+ Copyright (c) 2021-2023 vaiorabbit <http://twitter.com/vaiorabbit>
125
136
 
126
137
  This software is provided 'as-is', without any express or implied
127
138
  warranty. In no event will the authors be held liable for any damages
data/examples/template.rb CHANGED
@@ -20,6 +20,8 @@ when /mswin|msys|mingw|cygwin/
20
20
  Raylib.load_lib(shared_lib_path + 'libraylib.dll', raygui_libpath: shared_lib_path + 'raygui.dll', physac_libpath: shared_lib_path + 'physac.dll')
21
21
  when /darwin/
22
22
  Raylib.load_lib(shared_lib_path + 'libraylib.dylib', raygui_libpath: shared_lib_path + 'raygui.dylib', physac_libpath: shared_lib_path + 'physac.dylib')
23
+ when /linux/
24
+ Raylib.load_lib(shared_lib_path + 'libraylib.so', raygui_libpath: shared_lib_path + 'raygui.so', physac_libpath: shared_lib_path + 'physac.so')
23
25
  else
24
26
  raise RuntimeError, "Unknown OS: #{RUBY_PLATFORM}"
25
27
  end
@@ -37,11 +39,11 @@ if __FILE__ == $PROGRAM_NAME
37
39
  # Camera
38
40
  camera = Camera.new
39
41
  reset_camera = lambda {
40
- camera[:position] = Vector3.create(0.0, 10.0, 10.0)
41
- camera[:target] = Vector3.create(0.0, 0.0, 0.0)
42
- camera[:up] = Vector3.create(0.0, 1.0, 0.0)
43
- camera[:fovy] = 45.0
44
- camera[:projection] = CAMERA_PERSPECTIVE
42
+ camera.position.set(0.0, 10.0, 10.0)
43
+ camera.target.set(0.0, 0.0, 0.0)
44
+ camera.up.set(0.0, 1.0, 0.0)
45
+ camera.fovy = 45.0
46
+ camera.projection = CAMERA_PERSPECTIVE
45
47
  }
46
48
  reset_camera.call
47
49
  SetCameraMode(camera, CAMERA_FREE)
@@ -76,29 +78,29 @@ if __FILE__ == $PROGRAM_NAME
76
78
  move[:z] += speed if IsKeyDown(KEY_DOWN)
77
79
  move[:z] -= speed if IsKeyDown(KEY_UP)
78
80
 
79
- to_camera = Vector3Normalize(Vector3.create(camera[:position][:x], 0, camera[:position][:z]))
81
+ to_camera = Vector3Normalize(Vector3.create(camera.position.x, 0, camera.position.z))
80
82
  rotate_y = QuaternionFromVector3ToVector3(Vector3.create(0, 0, 1), to_camera)
81
83
  move = Vector3RotateByQuaternion(move, rotate_y)
82
84
 
83
85
  player_pos = Vector3Add(player_pos, move)
84
- player_screen_pos = GetWorldToScreen(Vector3.create(player_pos[:x], player_pos[:y] + 2.5, player_pos[:z]), camera)
86
+ player_screen_pos = GetWorldToScreen(Vector3.create(player_pos.x, player_pos.y + 2.5, player_pos.z), camera)
85
87
 
86
88
  # Check collision status
87
89
  collision = false
88
90
 
89
- player_bbox = BoundingBox.create(player_pos[:x] - player_size[:x]/2,
90
- player_pos[:y] - player_size[:y]/2,
91
- player_pos[:z] - player_size[:z]/2,
92
- player_pos[:x] + player_size[:x]/2,
93
- player_pos[:y] + player_size[:y]/2,
94
- player_pos[:z] + player_size[:z]/2)
91
+ player_bbox = BoundingBox.create(player_pos.x - player_size.x/2,
92
+ player_pos.y - player_size.y/2,
93
+ player_pos.z - player_size.z/2,
94
+ player_pos.x + player_size.x/2,
95
+ player_pos.y + player_size.y/2,
96
+ player_pos.z + player_size.z/2)
95
97
 
96
- obstacle_cube_bbox = BoundingBox.create(obstacle_cube_pos[:x] - obstacle_cube_size[:x]/2,
97
- obstacle_cube_pos[:y] - obstacle_cube_size[:y]/2,
98
- obstacle_cube_pos[:z] - obstacle_cube_size[:z]/2,
99
- obstacle_cube_pos[:x] + obstacle_cube_size[:x]/2,
100
- obstacle_cube_pos[:y] + obstacle_cube_size[:y]/2,
101
- obstacle_cube_pos[:z] + obstacle_cube_size[:z]/2)
98
+ obstacle_cube_bbox = BoundingBox.create(obstacle_cube_pos.x - obstacle_cube_size.x/2,
99
+ obstacle_cube_pos.y - obstacle_cube_size.y/2,
100
+ obstacle_cube_pos.z - obstacle_cube_size.z/2,
101
+ obstacle_cube_pos.x + obstacle_cube_size.x/2,
102
+ obstacle_cube_pos.y + obstacle_cube_size.y/2,
103
+ obstacle_cube_pos.z + obstacle_cube_size.z/2)
102
104
 
103
105
  # Check collisions player vs obstacle_cube
104
106
  collision = true if CheckCollisionBoxes(player_bbox, obstacle_cube_bbox)
@@ -118,8 +120,8 @@ if __FILE__ == $PROGRAM_NAME
118
120
  DrawCube(player_pos, 2.0, 2.0, 2.0, collision ? Fade(ruby_red, 0.25) : ruby_red)
119
121
  DrawCubeWires(player_pos, 2.0, 2.0, 2.0, MAROON)
120
122
  # Obstacle cube
121
- DrawCube(obstacle_cube_pos, obstacle_cube_size[:x], obstacle_cube_size[:y], obstacle_cube_size[:z], GRAY)
122
- DrawCubeWires(obstacle_cube_pos, obstacle_cube_size[:x], obstacle_cube_size[:y], obstacle_cube_size[:z], DARKGRAY)
123
+ DrawCube(obstacle_cube_pos, obstacle_cube_size.x, obstacle_cube_size.y, obstacle_cube_size.z, GRAY)
124
+ DrawCubeWires(obstacle_cube_pos, obstacle_cube_size.x, obstacle_cube_size.y, obstacle_cube_size.z, DARKGRAY)
123
125
  # Obstacle sphere
124
126
  DrawSphere(obstacle_sphere_pos, obstacle_sphere_size, GRAY)
125
127
  DrawSphereWires(obstacle_sphere_pos, obstacle_sphere_size, 16, 16, DARKGRAY)
@@ -129,7 +131,7 @@ if __FILE__ == $PROGRAM_NAME
129
131
 
130
132
  ## HUD
131
133
  # Text over the red cube
132
- DrawText("Player HP: 100 / 100", player_screen_pos[:x] - MeasureText("Player HP: 100/100", 20)/2, player_screen_pos[:y], 20, BLACK)
134
+ DrawText("Player HP: 100 / 100", player_screen_pos.x - MeasureText("Player HP: 100/100", 20)/2, player_screen_pos.y, 20, BLACK)
133
135
  # Help message
134
136
  DrawRectangle(10, screen_height - 100, 300, 80, Fade(MAROON, 0.25))
135
137
  DrawRectangleLines(10, screen_height - 100, 300, 80, ruby_red)
data/lib/config.rb ADDED
@@ -0,0 +1,98 @@
1
+ # Yet another raylib wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/raylib-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module Raylib
10
+ extend FFI::Library
11
+
12
+ # Define/Macro
13
+
14
+ SUPPORT_MODULE_RSHAPES = 1
15
+ SUPPORT_MODULE_RTEXTURES = 1
16
+ SUPPORT_MODULE_RTEXT = 1 # WARNING: It requires SUPPORT_MODULE_RTEXTURES to load sprite font textures
17
+ SUPPORT_MODULE_RMODELS = 1
18
+ SUPPORT_MODULE_RAUDIO = 1
19
+ SUPPORT_CAMERA_SYSTEM = 1
20
+ SUPPORT_GESTURES_SYSTEM = 1
21
+ SUPPORT_MOUSE_GESTURES = 1
22
+ SUPPORT_SSH_KEYBOARD_RPI = 1
23
+ SUPPORT_WINMM_HIGHRES_TIMER = 1
24
+ SUPPORT_PARTIALBUSY_WAIT_LOOP = 1
25
+ SUPPORT_SCREEN_CAPTURE = 1
26
+ SUPPORT_GIF_RECORDING = 1
27
+ SUPPORT_COMPRESSION_API = 1
28
+ MAX_FILEPATH_CAPACITY = 8192 # Maximum file paths capacity
29
+ MAX_FILEPATH_LENGTH = 4096 # Maximum length for filepaths (Linux PATH_MAX default value)
30
+ MAX_KEYBOARD_KEYS = 512 # Maximum number of keyboard keys supported
31
+ MAX_MOUSE_BUTTONS = 8 # Maximum number of mouse buttons supported
32
+ MAX_GAMEPADS = 4 # Maximum number of gamepads supported
33
+ MAX_GAMEPAD_AXIS = 8 # Maximum number of axis supported (per gamepad)
34
+ MAX_GAMEPAD_BUTTONS = 32 # Maximum number of buttons supported (per gamepad)
35
+ MAX_TOUCH_POINTS = 8 # Maximum number of touch points supported
36
+ MAX_KEY_PRESSED_QUEUE = 16 # Maximum number of keys in the key input queue
37
+ MAX_CHAR_PRESSED_QUEUE = 16 # Maximum number of characters in the char input queue
38
+ MAX_DECOMPRESSION_SIZE = 64 # Max size allocated for decompression in MB
39
+ RL_DEFAULT_BATCH_BUFFERS = 1 # Default number of batch buffers (multi-buffering)
40
+ RL_DEFAULT_BATCH_DRAWCALLS = 256 # Default number of batch draw calls (by state changes: mode, texture)
41
+ RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS = 4 # Maximum number of textures units that can be activated on batch drawing (SetShaderValueTexture())
42
+ RL_MAX_MATRIX_STACK_SIZE = 32 # Maximum size of internal Matrix stack
43
+ RL_MAX_SHADER_LOCATIONS = 32 # Maximum number of shader locations supported
44
+ RL_CULL_DISTANCE_NEAR = 0.01 # Default projection matrix near cull distance
45
+ RL_CULL_DISTANCE_FAR = 1000.0 # Default projection matrix far cull distance
46
+ RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION = "vertexPosition" # Binded by default to shader location: 0
47
+ RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD = "vertexTexCoord" # Binded by default to shader location: 1
48
+ RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL = "vertexNormal" # Binded by default to shader location: 2
49
+ RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR = "vertexColor" # Binded by default to shader location: 3
50
+ RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT = "vertexTangent" # Binded by default to shader location: 4
51
+ RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 = "vertexTexCoord2" # Binded by default to shader location: 5
52
+ RL_DEFAULT_SHADER_UNIFORM_NAME_MVP = "mvp" # model-view-projection matrix
53
+ RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW = "matView" # view matrix
54
+ RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION = "matProjection" # projection matrix
55
+ RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL = "matModel" # model matrix
56
+ RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL = "matNormal" # normal matrix (transpose(inverse(matModelView))
57
+ RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR = "colDiffuse" # color diffuse (base tint color, multiplied by texture color)
58
+ RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 = "texture0" # texture0 (texture slot active 0)
59
+ RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 = "texture1" # texture1 (texture slot active 1)
60
+ RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 = "texture2" # texture2 (texture slot active 2)
61
+ SUPPORT_QUADS_DRAW_MODE = 1
62
+ SUPPORT_FILEFORMAT_PNG = 1
63
+ SUPPORT_FILEFORMAT_GIF = 1
64
+ SUPPORT_FILEFORMAT_QOI = 1
65
+ SUPPORT_FILEFORMAT_DDS = 1
66
+ SUPPORT_FILEFORMAT_HDR = 1
67
+ SUPPORT_IMAGE_EXPORT = 1
68
+ SUPPORT_IMAGE_GENERATION = 1
69
+ SUPPORT_IMAGE_MANIPULATION = 1
70
+ SUPPORT_DEFAULT_FONT = 1
71
+ SUPPORT_FILEFORMAT_FNT = 1
72
+ SUPPORT_FILEFORMAT_TTF = 1
73
+ SUPPORT_TEXT_MANIPULATION = 1
74
+ MAX_TEXT_BUFFER_LENGTH = 1024 # Size of internal static buffers used on some functions:
75
+ MAX_TEXTSPLIT_COUNT = 128 # Maximum number of substrings to split: TextSplit()
76
+ SUPPORT_FILEFORMAT_OBJ = 1
77
+ SUPPORT_FILEFORMAT_MTL = 1
78
+ SUPPORT_FILEFORMAT_IQM = 1
79
+ SUPPORT_FILEFORMAT_GLTF = 1
80
+ SUPPORT_FILEFORMAT_VOX = 1
81
+ SUPPORT_FILEFORMAT_M3D = 1
82
+ SUPPORT_MESH_GENERATION = 1
83
+ MAX_MATERIAL_MAPS = 12 # Maximum number of shader maps supported
84
+ MAX_MESH_VERTEX_BUFFERS = 7 # Maximum vertex buffers (VBO) per mesh
85
+ SUPPORT_FILEFORMAT_WAV = 1
86
+ SUPPORT_FILEFORMAT_OGG = 1
87
+ SUPPORT_FILEFORMAT_XM = 1
88
+ SUPPORT_FILEFORMAT_MOD = 1
89
+ SUPPORT_FILEFORMAT_MP3 = 1
90
+ AUDIO_DEVICE_FORMAT = "ma_format_f32" # Device output format (miniaudio: float-32bit)
91
+ AUDIO_DEVICE_CHANNELS = 2 # Device output channels: stereo
92
+ AUDIO_DEVICE_SAMPLE_RATE = 0 # Device sample rate (device default)
93
+ MAX_AUDIO_BUFFER_POOL_CHANNELS = 16 # Maximum number of audio pool channels
94
+ SUPPORT_STANDARD_FILEIO = 1
95
+ SUPPORT_TRACELOG = 1
96
+ MAX_TRACELOG_MSG_LENGTH = 128 # Max length of one trace-log message
97
+
98
+ end
data/lib/physac.rb CHANGED
@@ -22,9 +22,11 @@ module Raylib
22
22
 
23
23
  # Enum
24
24
 
25
+ # enum PhysicsShapeType
25
26
  PHYSICS_CIRCLE = 0
26
27
  PHYSICS_POLYGON = 1
27
28
 
29
+
28
30
  # Typedef
29
31
 
30
32
  typedef :int, :PhysicsShapeType
@@ -103,7 +105,7 @@ module Raylib
103
105
 
104
106
  # Function
105
107
 
106
- def self.setup_physac_symbols(output_error = false)
108
+ def self.setup_physac_symbols
107
109
  entries = [
108
110
 
109
111
  # InitPhysics : Initializes physics system
@@ -212,13 +214,9 @@ module Raylib
212
214
  [:GetPhysicsShapeVertex, :GetPhysicsShapeVertex, [:pointer, :int], Vector2.by_value],
213
215
  ]
214
216
  entries.each do |entry|
215
- begin
216
- attach_function entry[0], entry[1], entry[2], entry[3]
217
- rescue FFI::NotFoundError => error
218
- $stderr.puts("[Warning] Failed to import #{entry[0]} (#{error}).") if output_error
219
- end
217
+ attach_function entry[0], entry[1], entry[2], entry[3]
218
+ rescue FFI::NotFoundError => e
219
+ warn "[Warning] Failed to import #{entry[0]} (#{e})."
220
220
  end
221
221
  end
222
-
223
222
  end
224
-
data/lib/raygui.rb CHANGED
@@ -17,13 +17,21 @@ module Raylib
17
17
 
18
18
  # Enum
19
19
 
20
+ # enum GuiState
21
+ # Gui control state
20
22
  STATE_NORMAL = 0
21
23
  STATE_FOCUSED = 1
22
24
  STATE_PRESSED = 2
23
25
  STATE_DISABLED = 3
26
+
27
+ # enum GuiTextAlignment
28
+ # Gui control text alignment
24
29
  TEXT_ALIGN_LEFT = 0
25
30
  TEXT_ALIGN_CENTER = 1
26
31
  TEXT_ALIGN_RIGHT = 2
32
+
33
+ # enum GuiControl
34
+ # Gui controls
27
35
  DEFAULT = 0
28
36
  LABEL = 1 # Used also for: LABELBUTTON
29
37
  BUTTON = 2
@@ -40,6 +48,9 @@ module Raylib
40
48
  COLORPICKER = 13
41
49
  SCROLLBAR = 14
42
50
  STATUSBAR = 15
51
+
52
+ # enum GuiControlProperty
53
+ # Gui base properties for every control
43
54
  BORDER_COLOR_NORMAL = 0
44
55
  BASE_COLOR_NORMAL = 1
45
56
  TEXT_COLOR_NORMAL = 2
@@ -56,38 +67,77 @@ module Raylib
56
67
  TEXT_PADDING = 13
57
68
  TEXT_ALIGNMENT = 14
58
69
  RESERVED = 15
70
+
71
+ # enum GuiDefaultProperty
72
+ # DEFAULT extended properties
59
73
  TEXT_SIZE = 16 # Text size (glyphs max height)
60
74
  TEXT_SPACING = 17 # Text spacing between glyphs
61
75
  LINE_COLOR = 18 # Line control color
62
76
  BACKGROUND_COLOR = 19 # Background color
77
+
78
+ # enum GuiToggleProperty
79
+ # Toggle/ToggleGroup
63
80
  GROUP_PADDING = 16 # ToggleGroup separation between toggles
81
+
82
+ # enum GuiSliderProperty
83
+ # Slider/SliderBar
64
84
  SLIDER_WIDTH = 16 # Slider size of internal bar
65
85
  SLIDER_PADDING = 17 # Slider/SliderBar internal bar padding
86
+
87
+ # enum GuiProgressBarProperty
88
+ # ProgressBar
66
89
  PROGRESS_PADDING = 16 # ProgressBar internal padding
90
+
91
+ # enum GuiScrollBarProperty
92
+ # ScrollBar
67
93
  ARROWS_SIZE = 16
68
94
  ARROWS_VISIBLE = 17
69
95
  SCROLL_SLIDER_PADDING = 18 # (SLIDERBAR, SLIDER_PADDING)
70
96
  SCROLL_SLIDER_SIZE = 19
71
97
  SCROLL_PADDING = 20
72
98
  SCROLL_SPEED = 21
99
+
100
+ # enum GuiCheckBoxProperty
101
+ # CheckBox
73
102
  CHECK_PADDING = 16 # CheckBox internal check padding
103
+
104
+ # enum GuiComboBoxProperty
105
+ # ComboBox
74
106
  COMBO_BUTTON_WIDTH = 16 # ComboBox right button width
75
107
  COMBO_BUTTON_SPACING = 17 # ComboBox button separation
108
+
109
+ # enum GuiDropdownBoxProperty
110
+ # DropdownBox
76
111
  ARROW_PADDING = 16 # DropdownBox arrow separation from border and items
77
112
  DROPDOWN_ITEMS_SPACING = 17 # DropdownBox items separation
113
+
114
+ # enum GuiTextBoxProperty
115
+ # TextBox/TextBoxMulti/ValueBox/Spinner
78
116
  TEXT_INNER_PADDING = 16 # TextBox/TextBoxMulti/ValueBox/Spinner inner text padding
79
117
  TEXT_LINES_SPACING = 17 # TextBoxMulti lines separation
118
+
119
+ # enum GuiSpinnerProperty
120
+ # Spinner
80
121
  SPIN_BUTTON_WIDTH = 16 # Spinner left/right buttons width
81
122
  SPIN_BUTTON_SPACING = 17 # Spinner buttons separation
123
+
124
+ # enum GuiListViewProperty
125
+ # ListView
82
126
  LIST_ITEMS_HEIGHT = 16 # ListView items height
83
127
  LIST_ITEMS_SPACING = 17 # ListView items separation
84
128
  SCROLLBAR_WIDTH = 18 # ListView scrollbar size (usually width)
85
129
  SCROLLBAR_SIDE = 19 # ListView scrollbar side (0-left, 1-right)
130
+
131
+ # enum GuiColorPickerProperty
132
+ # ColorPicker
86
133
  COLOR_SELECTOR_SIZE = 16
87
134
  HUEBAR_WIDTH = 17 # ColorPicker right hue bar width
88
135
  HUEBAR_PADDING = 18 # ColorPicker right hue bar separation from panel
89
136
  HUEBAR_SELECTOR_HEIGHT = 19 # ColorPicker right hue bar selector height
90
137
  HUEBAR_SELECTOR_OVERFLOW = 20 # ColorPicker right hue bar selector overflow
138
+
139
+ # enum GuiIconName
140
+ #
91
141
  ICON_NONE = 0
92
142
  ICON_FOLDER_FILE_OPEN = 1
93
143
  ICON_FILE_SAVE_CLASSIC = 2
@@ -345,6 +395,7 @@ module Raylib
345
395
  ICON_254 = 254
346
396
  ICON_255 = 255
347
397
 
398
+
348
399
  # Typedef
349
400
 
350
401
  typedef :int, :GuiState
@@ -379,7 +430,7 @@ module Raylib
379
430
 
380
431
  # Function
381
432
 
382
- def self.setup_raygui_symbols(output_error = false)
433
+ def self.setup_raygui_symbols
383
434
  entries = [
384
435
 
385
436
  # GuiEnable : Enable gui controls (global state)
@@ -721,7 +772,7 @@ module Raylib
721
772
  # @return [char **]
722
773
  [:GuiLoadIcons, :GuiLoadIcons, [:pointer, :bool], :pointer],
723
774
 
724
- # GuiDrawIcon :
775
+ # GuiDrawIcon
725
776
  # @param iconId [int]
726
777
  # @param posX [int]
727
778
  # @param posY [int]
@@ -731,13 +782,9 @@ module Raylib
731
782
  [:GuiDrawIcon, :GuiDrawIcon, [:int, :int, :int, :int, Color.by_value], :void],
732
783
  ]
733
784
  entries.each do |entry|
734
- begin
735
- attach_function entry[0], entry[1], entry[2], entry[3]
736
- rescue FFI::NotFoundError => error
737
- $stderr.puts("[Warning] Failed to import #{entry[0]} (#{error}).") if output_error
738
- end
785
+ attach_function entry[0], entry[1], entry[2], entry[3]
786
+ rescue FFI::NotFoundError => e
787
+ warn "[Warning] Failed to import #{entry[0]} (#{e})."
739
788
  end
740
789
  end
741
-
742
790
  end
743
-