raylib-bindings 0.5.5 → 0.5.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7377be87c5c5efda168b264deaa7526f03bb948b47199a647fff36b93cf1571
4
- data.tar.gz: f3d9f8465b47291a7e61eb3c6cc168e213826a5dad17aa6ce2d48da333887748
3
+ metadata.gz: e3fbac3602a46b5d91f37bae57e044b14c00a5067d95f7b1175d2a80a0a3c300
4
+ data.tar.gz: 3cd2950960e81b4ca50c05754ccf7cfea42da671bb332ab611add263cf2bad07
5
5
  SHA512:
6
- metadata.gz: 1f2f44763ca651d69267875fd630ade2bafc23260e44e5cad004e068b0971da664b5fc8adc89bc203b1d16e945ca38a2a523526a1491ef3b45e701fd4783cd57
7
- data.tar.gz: 4d5020ee59e112531bc6c1706af275e3f3bfcb6947501b441e8a885d89f49469948b500fc939be4e09bedef118a620b7512ea5f996d289536bef7ae0622c9fcb
6
+ metadata.gz: c977faefd030c09b8be636947f760ce868f50e9507d48cd8692beb551a0a291a7c9a4d23b7ab79e2cd362d2323ee631b3de260bfb72dc98586193bfb2b8cf497
7
+ data.tar.gz: 444503a05977130ba0422fd7e55c984662305124c9a8c430abbfe45fde7e8f1eba15bb6e4679dd5592050b9952344df430e7aef4266484f19f8c6f57825364e4
data/ChangeLog CHANGED
@@ -1,3 +1,41 @@
1
+ 2023-10-08 vaiorabbit <http://twitter.com/vaiorabbit>
2
+
3
+ * Updated with latest raylib ( https://github.com/raysan5/raylib/commit/97c2744a16ad7e6cf6b546a7a6416ec6b21e3a6c ) and raygui ( https://github.com/raysan5/raygui/commit/85a5c104f509b183c8cc7db0d90c2ab7a2b198c8)
4
+
5
+ 2023-09-30 vaiorabbit <http://twitter.com/vaiorabbit>
6
+
7
+ * Use Ruby-FFI 1.16 ( https://github.com/ffi/ffi )
8
+
9
+ 2023-09-23 vaiorabbit <http://twitter.com/vaiorabbit>
10
+
11
+ * example/raylib_with_imgui.rb : Added
12
+
13
+ 2023-09-16 vaiorabbit <http://twitter.com/vaiorabbit>
14
+
15
+ * lib/raygui_helper.rb: Added more APIs
16
+ * example/gui_controls.rb: Added
17
+ * example/shaders_basic_lighting.rb: Added
18
+
19
+ 2023-09-12 vaiorabbit <http://twitter.com/vaiorabbit>
20
+
21
+ * Updated with latest raylib ( https://github.com/raysan5/raylib/commit/2e7a7877a51ca33487642bd7ed0367b017b54486 ) and raygui ( https://github.com/raysan5/raygui/commit/1c3305031d2dcab2fbd3c7d7ded8b7aee1738908)
22
+
23
+ 2023-09-09 vaiorabbit <http://twitter.com/vaiorabbit>
24
+
25
+ * Updated with latest raylib ( https://github.com/raysan5/raylib/commit/37f60e75e72eebd5ff687b8857bf9043d291b0df ) and raygui ( https://github.com/raysan5/raygui/commit/0fccdc61fbd787fdfa9e254fd99def2cdb34fb10 )
26
+ * example/template.rb: now calls UpdateCamera only when orbital model is on
27
+
28
+ 2023-09-02 vaiorabbit <http://twitter.com/vaiorabbit>
29
+
30
+ * Updated with latest raylib ( https://github.com/raysan5/raylib/commit/ec6d3bb688ae8c137152eca7cdef9885badd9bee ) and raygui ( https://github.com/raysan5/raygui/commit/12fc56e5e1fe0888a4c73b98890914ca3806a8b4 )
31
+ * Linux (Cross): changed host OS (Ubuntu 22.04 LTS) and cross compiler version
32
+
33
+ 2023-08-10 vaiorabbit <http://twitter.com/vaiorabbit>
34
+
35
+ * Updated with latest raylib ( https://github.com/raysan5/raylib/commit/0959f6ebf69f44d5bb0225cc94fd187ebedf8be5 ) and raygui ( https://github.com/raysan5/raygui/commit/41417db52d951bb08273c892d3e3db3723f1083a )
36
+ * lib/raylib_helper.rb: Added several initialization helper for Camera3D, Camera2D and BoundingBox
37
+ * examples: Fixed broken examples / Adoped new initialization helper APIs / Use accessor helpers for better readability
38
+
1
39
  2023-07-29 vaiorabbit <http://twitter.com/vaiorabbit>
2
40
 
3
41
  * Updated with latest raylib ( https://github.com/raysan5/raylib/commit/962030e70ad3dfcce5d4642ad65890fde93ad117 ) and raygui ( https://github.com/raysan5/raygui/commit/36365199b11dd967e7147e64c85ccfda8c5064d1 )
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 : 2023-07-29
6
+ * Last modified : 2023-10-08
7
7
 
8
8
  Provides Ruby bindings for raylib-related libraries including:
9
9
 
data/examples/template.rb CHANGED
@@ -47,7 +47,7 @@ if __FILE__ == $PROGRAM_NAME
47
47
  camera.projection = CAMERA_PERSPECTIVE
48
48
  }
49
49
  reset_camera.call
50
- camera_mode = CAMERA_FREE
50
+ camera_mode = CAMERA_CUSTOM
51
51
  auto_rotate = false
52
52
 
53
53
  # Player (red cube) settings
@@ -68,16 +68,16 @@ if __FILE__ == $PROGRAM_NAME
68
68
  if IsKeyPressed(KEY_F1)
69
69
  auto_rotate = !auto_rotate
70
70
  reset_camera.call
71
- camera_mode = auto_rotate ? CAMERA_ORBITAL : CAMERA_FREE
71
+ camera_mode = auto_rotate ? CAMERA_ORBITAL : CAMERA_CUSTOM
72
72
  end
73
- UpdateCamera(camera.pointer, camera_mode)
73
+ UpdateCamera(camera.pointer, camera_mode) if auto_rotate
74
74
 
75
75
  # Calculate move direction
76
76
  move = Vector3.create(0, 0, 0)
77
- move[:x] += speed if IsKeyDown(KEY_RIGHT)
78
- move[:x] -= speed if IsKeyDown(KEY_LEFT)
79
- move[:z] += speed if IsKeyDown(KEY_DOWN)
80
- move[:z] -= speed if IsKeyDown(KEY_UP)
77
+ move.x += speed if IsKeyDown(KEY_RIGHT)
78
+ move.x -= speed if IsKeyDown(KEY_LEFT)
79
+ move.z += speed if IsKeyDown(KEY_DOWN)
80
+ move.z -= speed if IsKeyDown(KEY_UP)
81
81
 
82
82
  to_camera = Vector3Normalize(Vector3.create(camera.position.x, 0, camera.position.z))
83
83
  rotate_y = QuaternionFromVector3ToVector3(Vector3.create(0, 0, 1), to_camera)
@@ -89,19 +89,13 @@ if __FILE__ == $PROGRAM_NAME
89
89
  # Check collision status
90
90
  collision = false
91
91
 
92
- player_bbox = BoundingBox.create(player_pos.x - player_size.x/2,
93
- player_pos.y - player_size.y/2,
94
- player_pos.z - player_size.z/2,
95
- player_pos.x + player_size.x/2,
96
- player_pos.y + player_size.y/2,
97
- player_pos.z + player_size.z/2)
98
-
99
- obstacle_cube_bbox = BoundingBox.create(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,
102
- obstacle_cube_pos.x + obstacle_cube_size.x/2,
103
- obstacle_cube_pos.y + obstacle_cube_size.y/2,
104
- obstacle_cube_pos.z + obstacle_cube_size.z/2)
92
+ player_bbox = BoundingBox.new
93
+ .with_min(player_pos.x - player_size.x/2, player_pos.y - player_size.y/2, player_pos.z - player_size.z/2)
94
+ .with_max(player_pos.x + player_size.x/2, player_pos.y + player_size.y/2, player_pos.z + player_size.z/2)
95
+
96
+ obstacle_cube_bbox = BoundingBox.new
97
+ .with_min(obstacle_cube_pos.x - obstacle_cube_size.x/2, obstacle_cube_pos.y - obstacle_cube_size.y/2, obstacle_cube_pos.z - obstacle_cube_size.z/2)
98
+ .with_max(obstacle_cube_pos.x + obstacle_cube_size.x/2, obstacle_cube_pos.y + obstacle_cube_size.y/2, obstacle_cube_pos.z + obstacle_cube_size.z/2)
105
99
 
106
100
  # Check collisions player vs obstacle_cube
107
101
  collision = true if CheckCollisionBoxes(player_bbox, obstacle_cube_bbox)
data/lib/config.rb CHANGED
@@ -62,7 +62,6 @@ module Raylib
62
62
  SUPPORT_FILEFORMAT_GIF = 1
63
63
  SUPPORT_FILEFORMAT_QOI = 1
64
64
  SUPPORT_FILEFORMAT_DDS = 1
65
- SUPPORT_FILEFORMAT_HDR = 1
66
65
  SUPPORT_IMAGE_EXPORT = 1
67
66
  SUPPORT_IMAGE_GENERATION = 1
68
67
  SUPPORT_IMAGE_MANIPULATION = 1
Binary file
data/lib/libraylib.dll CHANGED
Binary file
data/lib/libraylib.dylib CHANGED
Binary file
Binary file
Binary file
data/lib/physac.dll CHANGED
Binary file
data/lib/physac.x86_64.so CHANGED
Binary file
Binary file
data/lib/raygui.dll CHANGED
Binary file
data/lib/raygui.dylib CHANGED
Binary file
data/lib/raygui.x86_64.so CHANGED
Binary file
data/lib/raygui_helper.rb CHANGED
@@ -6,23 +6,122 @@ require 'ffi'
6
6
 
7
7
  module Raylib
8
8
 
9
- def RGuiButton(bounds, text)
10
- result = GuiButton(bounds, text)
11
- return result == 1
9
+ def RGuiTabBar(bounds, text, count, active)
10
+ active_buf = FFI::MemoryPointer.new(:int, 1)
11
+ active_buf.put(:int, 0, active)
12
+ result = GuiTabBar(bounds, text, count, active_buf)
13
+ return active_buf.get(:int, 0), result
12
14
  end
13
15
 
14
- def RGuiSliderBar(bounds, textLeft, textRight, value, minValue, maxValue)
15
- value_buf = FFI::MemoryPointer.new(:float, 1)
16
- value_buf.put_float(0, value)
17
- result = GuiSliderBar(bounds, textLeft, textRight, value_buf, minValue, maxValue)
18
- return value_buf.read_float
16
+ def RGuiToggle(bounds, text, active)
17
+ active_buf = FFI::MemoryPointer.new(:int, 1)
18
+ active_buf.put(:int, 0, active)
19
+ result = GuiToggle(bounds, text, active_buf)
20
+ return active_buf.get(:int, 0), result
21
+ end
22
+
23
+ def RGuiToggleGroup(bounds, text, active)
24
+ active_buf = FFI::MemoryPointer.new(:int, 1)
25
+ active_buf.put(:int, 0, active)
26
+ result = GuiToggleGroup(bounds, text, active_buf)
27
+ return active_buf.get(:int, 0), result
28
+ end
29
+
30
+ def RGuiToggleSlider(bounds, text, active)
31
+ active_buf = FFI::MemoryPointer.new(:int, 1)
32
+ active_buf.put(:int, 0, active)
33
+ result = GuiToggleSlider(bounds, text, active_buf)
34
+ return active_buf.get(:int, 0), result
19
35
  end
20
36
 
21
37
  def RGuiCheckBox(bounds, text, checked)
22
38
  checked_buf = FFI::MemoryPointer.new(:bool, 1)
23
39
  checked_buf.put(:bool, 0, checked)
24
40
  result = GuiCheckBox(bounds, text, checked_buf)
25
- return checked_buf.get(:bool, 0)
41
+ return checked_buf.get(:bool, 0), result
42
+ end
43
+
44
+ def RGuiComboBox(bounds, text, active)
45
+ active_buf = FFI::MemoryPointer.new(:int, 1)
46
+ active_buf.put(:int, 0, active)
47
+ result = GuiComboBox(bounds, text, active_buf)
48
+ return active_buf.get(:int, 0), result
49
+ end
50
+
51
+ def RGuiDropdownBox(bounds, text, active, editMode)
52
+ active_buf = FFI::MemoryPointer.new(:int, 1)
53
+ active_buf.put(:int, 0, active)
54
+ result = GuiDropdownBox(bounds, text, active_buf, editMode)
55
+ return active_buf.get(:int, 0), result
56
+ end
57
+
58
+ def RGuiSpinner(bounds, text, value, minValue, maxValue, editMode)
59
+ value_buf = FFI::MemoryPointer.new(:int, 1)
60
+ value_buf.put(:int, 0, value)
61
+ result = GuiSpinner(bounds, text, value_buf, minValue, maxValue, editMode)
62
+ return value_buf.get(:int, 0), result
63
+ end
64
+
65
+ def RGuiValueBox(bounds, text, value, minValue, maxValue, editMode)
66
+ value_buf = FFI::MemoryPointer.new(:int, 1)
67
+ value_buf.put(:int, 0, value)
68
+ result = GuiValueBox(bounds, text, value_buf, minValue, maxValue, editMode)
69
+ return value_buf.get(:int, 0), result
70
+ end
71
+
72
+ def RGuiSlider(bounds, textLeft, textRight, value, minValue, maxValue)
73
+ value_buf = FFI::MemoryPointer.new(:float, 1)
74
+ value_buf.put_float(0, value)
75
+ result = GuiSlider(bounds, textLeft, textRight, value_buf, minValue, maxValue)
76
+ return value_buf.read_float, result
77
+ end
78
+
79
+ def RGuiSliderBar(bounds, textLeft, textRight, value, minValue, maxValue)
80
+ value_buf = FFI::MemoryPointer.new(:float, 1)
81
+ value_buf.put_float(0, value)
82
+ result = GuiSliderBar(bounds, textLeft, textRight, value_buf, minValue, maxValue)
83
+ return value_buf.read_float, result
84
+ end
85
+
86
+ def RGuiProgressBar(bounds, textLeft, textRight, value, minValue, maxValue)
87
+ value_buf = FFI::MemoryPointer.new(:float, 1)
88
+ value_buf.put_float(0, value)
89
+ result = GuiProgressBar(bounds, textLeft, textRight, value_buf, minValue, maxValue)
90
+ return value_buf.read_float, result
91
+ end
92
+
93
+ def RGuiListView(bounds, text, scrollIndex, active)
94
+ scrollIndex_buf = FFI::MemoryPointer.new(:int, 1)
95
+ scrollIndex_buf.put(:int, 0, scrollIndex)
96
+ active_buf = FFI::MemoryPointer.new(:int, 1)
97
+ active_buf.put(:int, 0, active)
98
+ result = GuiListView(bounds, text, scrollIndex_buf, active_buf)
99
+ return scrollIndex_buf.get(:int, 0), active_buf.get(:int, 0), result
100
+ end
101
+
102
+ def RGuiListViewEx(bounds, text, count, scrollIndex, active, focus)
103
+ scrollIndex_buf = FFI::MemoryPointer.new(:int, 1)
104
+ scrollIndex_buf.put(:int, 0, scrollIndex)
105
+ active_buf = FFI::MemoryPointer.new(:int, 1)
106
+ active_buf.put(:int, 0, active)
107
+ focus_buf = FFI::MemoryPointer.new(:int, 1)
108
+ focus_buf.put(:int, 0, focus)
109
+ result = GuiListViewEx(bounds, text, count, scrollIndex_buf, active_buf, focus_buf)
110
+ return scrollIndex_buf.get(:int, 0), active_buf.get(:int, 0), focus_buf.get(:int, 0), result
111
+ end
112
+
113
+ def RGuiColorBarAlpha(bounds, text, alpha)
114
+ alpha_buf = FFI::MemoryPointer.new(:float, 1)
115
+ alpha_buf.put_float(0, alpha)
116
+ result = GuiColorBarAlpha(bounds, text, alpha_buf)
117
+ return alpha_buf.read_float, result
118
+ end
119
+
120
+ def RGuiColorBarHue(bounds, text, value)
121
+ value_buf = FFI::MemoryPointer.new(:float, 1)
122
+ value_buf.put_float(0, value)
123
+ result = GuiColorBarHue(bounds, text, value_buf)
124
+ return value_buf.read_float, result
26
125
  end
27
126
 
28
127
  end
data/lib/raygui_main.rb CHANGED
@@ -14,7 +14,7 @@ module Raylib
14
14
  RAYGUI_VERSION_MAJOR = 4
15
15
  RAYGUI_VERSION_MINOR = 0
16
16
  RAYGUI_VERSION_PATCH = 0
17
- RAYGUI_VERSION = "4.0-dev"
17
+ RAYGUI_VERSION = "4.0"
18
18
  SCROLLBAR_LEFT_SIDE = 0
19
19
  SCROLLBAR_RIGHT_SIDE = 1
20
20
 
@@ -33,13 +33,25 @@ module Raylib
33
33
  TEXT_ALIGN_CENTER = 1
34
34
  TEXT_ALIGN_RIGHT = 2
35
35
 
36
+ # enum GuiTextAlignmentVertical
37
+ # Gui control text alignment vertical
38
+ TEXT_ALIGN_TOP = 0
39
+ TEXT_ALIGN_MIDDLE = 1
40
+ TEXT_ALIGN_BOTTOM = 2
41
+
42
+ # enum GuiTextWrapMode
43
+ # Gui control text wrap mode
44
+ TEXT_WRAP_NONE = 0
45
+ TEXT_WRAP_CHAR = 1
46
+ TEXT_WRAP_WORD = 2
47
+
36
48
  # enum GuiControl
37
49
  # Gui controls
38
50
  DEFAULT = 0
39
51
  LABEL = 1 # Used also for: LABELBUTTON
40
52
  BUTTON = 2
41
53
  TOGGLE = 3 # Used also for: TOGGLEGROUP
42
- SLIDER = 4 # Used also for: SLIDERBAR
54
+ SLIDER = 4 # Used also for: SLIDERBAR, TOGGLESLIDER
43
55
  PROGRESSBAR = 5
44
56
  CHECKBOX = 6
45
57
  COMBOBOX = 7
@@ -54,30 +66,31 @@ module Raylib
54
66
 
55
67
  # enum GuiControlProperty
56
68
  # Gui base properties for every control
57
- BORDER_COLOR_NORMAL = 0
58
- BASE_COLOR_NORMAL = 1
59
- TEXT_COLOR_NORMAL = 2
60
- BORDER_COLOR_FOCUSED = 3
61
- BASE_COLOR_FOCUSED = 4
62
- TEXT_COLOR_FOCUSED = 5
63
- BORDER_COLOR_PRESSED = 6
64
- BASE_COLOR_PRESSED = 7
65
- TEXT_COLOR_PRESSED = 8
66
- BORDER_COLOR_DISABLED = 9
67
- BASE_COLOR_DISABLED = 10
68
- TEXT_COLOR_DISABLED = 11
69
- BORDER_WIDTH = 12
70
- TEXT_PADDING = 13
71
- TEXT_ALIGNMENT = 14
72
- RESERVED = 15
69
+ BORDER_COLOR_NORMAL = 0 # Control border color in STATE_NORMAL
70
+ BASE_COLOR_NORMAL = 1 # Control base color in STATE_NORMAL
71
+ TEXT_COLOR_NORMAL = 2 # Control text color in STATE_NORMAL
72
+ BORDER_COLOR_FOCUSED = 3 # Control border color in STATE_FOCUSED
73
+ BASE_COLOR_FOCUSED = 4 # Control base color in STATE_FOCUSED
74
+ TEXT_COLOR_FOCUSED = 5 # Control text color in STATE_FOCUSED
75
+ BORDER_COLOR_PRESSED = 6 # Control border color in STATE_PRESSED
76
+ BASE_COLOR_PRESSED = 7 # Control base color in STATE_PRESSED
77
+ TEXT_COLOR_PRESSED = 8 # Control text color in STATE_PRESSED
78
+ BORDER_COLOR_DISABLED = 9 # Control border color in STATE_DISABLED
79
+ BASE_COLOR_DISABLED = 10 # Control base color in STATE_DISABLED
80
+ TEXT_COLOR_DISABLED = 11 # Control text color in STATE_DISABLED
81
+ BORDER_WIDTH = 12 # Control border size, 0 for no border
82
+ TEXT_PADDING = 13 # Control text padding, not considering border
83
+ TEXT_ALIGNMENT = 14 # Control text horizontal alignment inside control text bound (after border and padding)
73
84
 
74
85
  # enum GuiDefaultProperty
75
86
  # DEFAULT extended properties
76
- TEXT_SIZE = 16 # Text size (glyphs max height)
77
- TEXT_SPACING = 17 # Text spacing between glyphs
78
- LINE_COLOR = 18 # Line control color
79
- BACKGROUND_COLOR = 19 # Background color
80
- TEXT_LINE_SPACING = 20 # Text spacing between lines
87
+ TEXT_SIZE = 16 # Text size (glyphs max height)
88
+ TEXT_SPACING = 17 # Text spacing between glyphs
89
+ LINE_COLOR = 18 # Line control color
90
+ BACKGROUND_COLOR = 19 # Background color
91
+ TEXT_LINE_SPACING = 20 # Text spacing between lines
92
+ TEXT_ALIGNMENT_VERTICAL = 21 # Text vertical alignment inside text bounds (after border and padding)
93
+ TEXT_WRAP_MODE = 22 # Text wrap-mode inside text bounds
81
94
 
82
95
  # enum GuiToggleProperty
83
96
  # Toggle/ToggleGroup
@@ -94,12 +107,12 @@ module Raylib
94
107
 
95
108
  # enum GuiScrollBarProperty
96
109
  # ScrollBar
97
- ARROWS_SIZE = 16
98
- ARROWS_VISIBLE = 17
99
- SCROLL_SLIDER_PADDING = 18 # (SLIDERBAR, SLIDER_PADDING)
100
- SCROLL_SLIDER_SIZE = 19
101
- SCROLL_PADDING = 20
102
- SCROLL_SPEED = 21
110
+ ARROWS_SIZE = 16 # ScrollBar arrows size
111
+ ARROWS_VISIBLE = 17 # ScrollBar arrows visible
112
+ SCROLL_SLIDER_PADDING = 18 # ScrollBar slider internal padding
113
+ SCROLL_SLIDER_SIZE = 19 # ScrollBar slider size
114
+ SCROLL_PADDING = 20 # ScrollBar scroll padding from arrows
115
+ SCROLL_SPEED = 21 # ScrollBar scrolling speed
103
116
 
104
117
  # enum GuiCheckBoxProperty
105
118
  # CheckBox
@@ -117,12 +130,7 @@ module Raylib
117
130
 
118
131
  # enum GuiTextBoxProperty
119
132
  # TextBox/TextBoxMulti/ValueBox/Spinner
120
- TEXT_INNER_PADDING = 16 # TextBox/TextBoxMulti/ValueBox/Spinner inner text padding
121
- TEXT_LINES_SPACING = 17 # TextBoxMulti lines separation
122
- TEXT_ALIGNMENT_VERTICAL = 18 # TextBoxMulti vertical alignment: 0-CENTERED, 1-UP, 2-DOWN
123
- TEXT_MULTILINE = 19 # TextBox supports multiple lines
124
- TEXT_WRAP_MODE = 20 # TextBox wrap mode for multiline: 0-NO_WRAP, 1-CHAR_WRAP, 2-WORD_WRAP
125
- TEXT_READONLY = 21 # TextBox is readonly, no editable
133
+ TEXT_READONLY = 16 # TextBox in read-only mode: 0-text editable, 1-text no-editable
126
134
 
127
135
  # enum GuiSpinnerProperty
128
136
  # Spinner
@@ -134,7 +142,7 @@ module Raylib
134
142
  LIST_ITEMS_HEIGHT = 16 # ListView items height
135
143
  LIST_ITEMS_SPACING = 17 # ListView items separation
136
144
  SCROLLBAR_WIDTH = 18 # ListView scrollbar size (usually width)
137
- SCROLLBAR_SIDE = 19 # ListView scrollbar side (0-left, 1-right)
145
+ SCROLLBAR_SIDE = 19 # ListView scrollbar side (0-SCROLLBAR_LEFT_SIDE, 1-SCROLLBAR_RIGHT_SIDE)
138
146
 
139
147
  # enum GuiColorPickerProperty
140
148
  # ColorPicker
@@ -408,6 +416,8 @@ module Raylib
408
416
 
409
417
  typedef :int, :GuiState
410
418
  typedef :int, :GuiTextAlignment
419
+ typedef :int, :GuiTextAlignmentVertical
420
+ typedef :int, :GuiTextWrapMode
411
421
  typedef :int, :GuiControl
412
422
  typedef :int, :GuiControlProperty
413
423
  typedef :int, :GuiDefaultProperty
@@ -426,12 +436,12 @@ module Raylib
426
436
 
427
437
  # Struct
428
438
 
429
- # Style property
439
+ # NOTE: Used when exporting style as code for convenience
430
440
  class GuiStyleProp < FFI::Struct
431
441
  layout(
432
- :controlId, :ushort,
433
- :propertyId, :ushort,
434
- :propertyValue, :uint,
442
+ :controlId, :ushort, # Control identifier
443
+ :propertyId, :ushort, # Property identifier
444
+ :propertyValue, :int, # Property value
435
445
  )
436
446
  def controlId = self[:controlId]
437
447
  def controlId=(v) self[:controlId] = v end
@@ -661,6 +671,14 @@ module Raylib
661
671
  # @return [int]
662
672
  [:GuiToggleGroup, :GuiToggleGroup, [Rectangle.by_value, :pointer, :pointer], :int],
663
673
 
674
+ # @!method GuiToggleSlider(bounds, text, active)
675
+ # GuiToggleSlider : Toggle Slider control, returns true when clicked
676
+ # @param bounds [Rectangle]
677
+ # @param text [const char *]
678
+ # @param active [int *]
679
+ # @return [int]
680
+ [:GuiToggleSlider, :GuiToggleSlider, [Rectangle.by_value, :pointer, :pointer], :int],
681
+
664
682
  # @!method GuiCheckBox(bounds, text, checked)
665
683
  # GuiCheckBox : Check Box control, returns true when active
666
684
  # @param bounds [Rectangle]
data/lib/raylib_helper.rb CHANGED
@@ -19,6 +19,14 @@ module Raylib
19
19
  self[:a] = a
20
20
  self
21
21
  end
22
+
23
+ def copy(other)
24
+ self[:r] = other.r
25
+ self[:g] = other.g
26
+ self[:b] = other.b
27
+ self[:a] = other.a
28
+ self
29
+ end
22
30
  end
23
31
 
24
32
  LIGHTGRAY = Color.from_u8(200, 200, 200, 255)
@@ -136,20 +144,32 @@ module Raylib
136
144
  end
137
145
  end
138
146
 
139
- def BoundingBox.create(*args)
140
- case args.size
141
- when 2
142
- instance = BoundingBox.new
143
- instance[:min] = args[0] # min
144
- instance[:max] = args[1] # max
145
- instance
146
- when 6
147
- instance = BoundingBox.new
148
- instance[:min] = Vector3.create(args[0], args[1], args[2]) # min_x, min_y, min_z
149
- instance[:max] = Vector3.create(args[3], args[4], args[5]) # max_x, max_y, max_z
150
- instance
151
- else
152
- raise ArgumentError.new 'BoundingBox.create : Number of arguments must be 2 or 6'
147
+ class BoundingBox
148
+ def self.create(*args)
149
+ case args.size
150
+ when 2
151
+ instance = BoundingBox.new
152
+ instance[:min] = args[0] # min
153
+ instance[:max] = args[1] # max
154
+ instance
155
+ when 6
156
+ instance = BoundingBox.new
157
+ instance[:min] = Vector3.create(args[0], args[1], args[2]) # min_x, min_y, min_z
158
+ instance[:max] = Vector3.create(args[3], args[4], args[5]) # max_x, max_y, max_z
159
+ instance
160
+ else
161
+ raise ArgumentError.new 'BoundingBox.create : Number of arguments must be 2 or 6'
162
+ end
163
+ end
164
+
165
+ def with_min(x, y, z)
166
+ self[:min].set(x, y, z)
167
+ self
168
+ end
169
+
170
+ def with_max(x, y, z)
171
+ self[:max].set(x, y, z)
172
+ self
153
173
  end
154
174
  end
155
175
 
@@ -161,6 +181,59 @@ module Raylib
161
181
  MatrixToFloatV(mat)[:v].to_a
162
182
  end
163
183
 
184
+ #
185
+ # Camera helper
186
+ #
187
+
188
+ class Camera3D
189
+ def with_position(x, y, z)
190
+ self[:position].set(x, y, z)
191
+ self
192
+ end
193
+
194
+ def with_target(x, y, z)
195
+ self[:target].set(x, y, z)
196
+ self
197
+ end
198
+
199
+ def with_up(x, y, z)
200
+ self[:up].set(x, y, z)
201
+ self
202
+ end
203
+
204
+ def with_fovy(fovy)
205
+ self[:fovy] = fovy
206
+ self
207
+ end
208
+
209
+ def with_projection(projection)
210
+ self[:projection] = projection
211
+ self
212
+ end
213
+ end
214
+
215
+ class Camera2D
216
+ def with_offset(x, y)
217
+ self[:offset].set(x, y)
218
+ self
219
+ end
220
+
221
+ def with_target(x, y)
222
+ self[:target].set(x, y)
223
+ self
224
+ end
225
+
226
+ def with_rotation(rotation)
227
+ self[:rotation] = rotation
228
+ self
229
+ end
230
+
231
+ def with_zoom(zoom)
232
+ self[:zoom] = zoom
233
+ self
234
+ end
235
+ end
236
+
164
237
  #
165
238
  # Transform helper
166
239
  #