raylib-bindings 0.6.1-aarch64-linux → 0.7.1-aarch64-linux

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: 7101a474087f51870d31bfce08e6ac6ae05a81d399fe39d4af4fb37adf558112
4
- data.tar.gz: a5f508833352f6b52055b6f3f62323797426c0d618f39ae99587f98a3c0f7c15
3
+ metadata.gz: 0e77403cc33aab7e3fdf0c7f507aca23ac36b00c799f07568e1a1c858500ed70
4
+ data.tar.gz: d8e95e584fe122f8f32abace178838a691b936b7e2156f75eecf73385df9055f
5
5
  SHA512:
6
- metadata.gz: 3eb2aaca2709bf9ddf90cf0120eb73a09f04fb5f595b1d71b4bab4dcd539cce2f4a1198da06e7dec37d60cea7173986253a0a46b012073f999892ebe0e7994a7
7
- data.tar.gz: 62aa783503333fece6a5a62c7fb2abf4d6c3e6a08a58a237039f9a53b9057d19cc81e6915371e261564124b1325e4e61a876a6d83684e1e99b5e787f228d27e6
6
+ metadata.gz: 1e22db9b20025305d1203fdc0db74a893d4d9f5eb4d0ea4eaf5bb84cdeff6d5b65796888db341c7de5340d9260538e304291b396c1f210f00c103c2d1a458ecd
7
+ data.tar.gz: 0341012227ef3b8fe1fb25c36e8a8a024b511682352465726db4466c6bbd5bb5e4fc1a860d0e4e3df003dff02fefaf93c60e86938316db8abda048d7e1c4bc54
data/ChangeLog CHANGED
@@ -1,3 +1,28 @@
1
+ 2024-03-02 vaiorabbit <http://twitter.com/vaiorabbit>
2
+
3
+ * Updated with latest raylib ( https://github.com/raysan5/raylib/commit/25caf14be8d0284aceaa0de28753b3012e71b7bb )
4
+
5
+ 2024-02-25 vaiorabbit <http://twitter.com/vaiorabbit>
6
+
7
+ * Updated with latest raylib ( https://github.com/raysan5/raylib/commit/2a774a88f5532908e09b15602d1482be96470f7f ) and raygui ( https://github.com/raysan5/raygui/commit/bc67f42209cc32965c7d1c00028e3ed0c4158659 )
8
+
9
+ 2024-02-18 vaiorabbit <http://twitter.com/vaiorabbit>
10
+
11
+ * Updated with latest raylib ( https://github.com/raysan5/raylib/commit/c251e9309e066b9d2aa5ecbd15bcee45b9bef528 ) and raygui ( https://github.com/raysan5/raygui/commit/a9e5e900586cc264d5af5c88552b66bafe9970f5 )
12
+
13
+ 2024-02-03 vaiorabbit <http://twitter.com/vaiorabbit>
14
+
15
+ * Updated with latest raylib ( https://github.com/raysan5/raylib/commit/29ff658d9223068378269e4a705811f085fafdf4 ) and raygui ( https://github.com/raysan5/raygui/commit/58411f4cceb8ae82933f2001461db9940278fdeb )
16
+
17
+ 2024-01-27 vaiorabbit <http://twitter.com/vaiorabbit>
18
+
19
+ * examples/snake_case_rlgl : Added
20
+
21
+ 2024-01-20 vaiorabbit <http://twitter.com/vaiorabbit>
22
+
23
+ * Raylib.load_lib : Added 'method_naming' option to import APIs in snake case convention
24
+ * examples/snake_case_api.rb : Added
25
+
1
26
  2024-01-07 vaiorabbit <http://twitter.com/vaiorabbit>
2
27
 
3
28
  * Updated README
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 : 2024-01-07
6
+ * Last modified : 2024-03-02
7
7
 
8
8
  Provides Ruby bindings for raylib-related libraries including:
9
9
 
@@ -133,6 +133,8 @@ D:\> ruby template.rb
133
133
 
134
134
  ## Projects ##
135
135
 
136
+ ### Games ###
137
+
136
138
  See the projects below to learn how to use this library:
137
139
 
138
140
  * Whac-a-Mole! : Ruby raylib bindings demo
@@ -147,6 +149,12 @@ See the projects below to learn how to use this library:
147
149
  * <img src="https://raw.githubusercontent.com/vaiorabbit/raylib-bindings-flapper/main/doc/screenshot_01.png" width="150">
148
150
  * <https://github.com/vaiorabbit/raylib-bindings-flapper>
149
151
 
152
+ ### Libraries ###
153
+
154
+ * raylib-bindings-tileson : Provides Ruby bindings for raylib-tileson ( https://github.com/RobLoach/raylib-tileson )
155
+ * <img src="https://raw.githubusercontent.com/vaiorabbit/raylib-bindings-tileson/main/doc/screenshot_00.png" width="600">
156
+ * <https://github.com/vaiorabbit/raylib-bindings-tileson>
157
+
150
158
  ## Limitation ##
151
159
 
152
160
  * `SetTraceLogCallback` and `TraceLogCallback` are unusable since Ruby-FFI does not support `:varargs` parameter in callbacks (`Proc`, etc.)
data/lib/config.rb CHANGED
@@ -34,6 +34,7 @@ module Raylib
34
34
  MAX_GAMEPADS = 4 # Maximum number of gamepads supported
35
35
  MAX_GAMEPAD_AXIS = 8 # Maximum number of axis supported (per gamepad)
36
36
  MAX_GAMEPAD_BUTTONS = 32 # Maximum number of buttons supported (per gamepad)
37
+ MAX_GAMEPAD_VIBRATION_TIME = 2.0 # Maximum vibration time in seconds
37
38
  MAX_TOUCH_POINTS = 8 # Maximum number of touch points supported
38
39
  MAX_KEY_PRESSED_QUEUE = 16 # Maximum number of keys in the key input queue
39
40
  MAX_CHAR_PRESSED_QUEUE = 16 # Maximum number of characters in the char input queue
@@ -73,6 +74,7 @@ module Raylib
73
74
  SUPPORT_DEFAULT_FONT = 1
74
75
  SUPPORT_FILEFORMAT_FNT = 1
75
76
  SUPPORT_FILEFORMAT_TTF = 1
77
+ SUPPORT_FILEFORMAT_BDF = 1
76
78
  SUPPORT_TEXT_MANIPULATION = 1
77
79
  SUPPORT_FONT_ATLAS_WHITE_REC = 1
78
80
  MAX_TEXT_BUFFER_LENGTH = 1024 # Size of internal static buffers used on some functions:
Binary file
Binary file
data/lib/physac.rb CHANGED
@@ -186,7 +186,7 @@ module Raylib
186
186
 
187
187
  # Function
188
188
 
189
- def self.setup_physac_symbols
189
+ def self.setup_physac_symbols(method_naming: :original)
190
190
  entries = [
191
191
 
192
192
  # @!method InitPhysics()
@@ -314,7 +314,16 @@ module Raylib
314
314
  [:GetPhysicsShapeVertex, :GetPhysicsShapeVertex, [:pointer, :int], Vector2.by_value],
315
315
  ]
316
316
  entries.each do |entry|
317
- attach_function entry[0], entry[1], entry[2], entry[3]
317
+ api_name = if method_naming == :snake_case
318
+ snake_case_name = entry[0].to_s.gsub(/([A-Z]+)([A-Z0-9][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z0-9])/, '\1_\2').downcase
319
+ snake_case_name.gsub!('vector_3', 'vector3_') if snake_case_name.include?('vector_3')
320
+ snake_case_name.gsub!('vector_2', 'vector2_') if snake_case_name.include?('vector_2')
321
+ snake_case_name.chop! if snake_case_name.end_with?('_')
322
+ snake_case_name.to_sym
323
+ else
324
+ entry[0]
325
+ end
326
+ attach_function api_name, entry[1], entry[2], entry[3]
318
327
  rescue FFI::NotFoundError => e
319
328
  warn "[Warning] Failed to import #{entry[0]} (#{e})."
320
329
  end
Binary file
data/lib/raygui_main.rb CHANGED
@@ -454,7 +454,7 @@ module Raylib
454
454
 
455
455
  # Function
456
456
 
457
- def self.setup_raygui_symbols
457
+ def self.setup_raygui_symbols(method_naming: :original)
458
458
  entries = [
459
459
 
460
460
  # @!method GuiEnable()
@@ -635,7 +635,7 @@ module Raylib
635
635
  [:GuiScrollPanel, :GuiScrollPanel, [Rectangle.by_value, :pointer, Rectangle.by_value, :pointer, :pointer], :int],
636
636
 
637
637
  # @!method GuiLabel(bounds, text)
638
- # GuiLabel : Label control, shows text
638
+ # GuiLabel : Label control
639
639
  # @param bounds [Rectangle]
640
640
  # @param text [const char *]
641
641
  # @return [int]
@@ -649,14 +649,14 @@ module Raylib
649
649
  [:GuiButton, :GuiButton, [Rectangle.by_value, :pointer], :int],
650
650
 
651
651
  # @!method GuiLabelButton(bounds, text)
652
- # GuiLabelButton : Label button control, show true when clicked
652
+ # GuiLabelButton : Label button control, returns true when clicked
653
653
  # @param bounds [Rectangle]
654
654
  # @param text [const char *]
655
655
  # @return [int]
656
656
  [:GuiLabelButton, :GuiLabelButton, [Rectangle.by_value, :pointer], :int],
657
657
 
658
658
  # @!method GuiToggle(bounds, text, active)
659
- # GuiToggle : Toggle Button control, returns true when active
659
+ # GuiToggle : Toggle Button control
660
660
  # @param bounds [Rectangle]
661
661
  # @param text [const char *]
662
662
  # @param active [bool *]
@@ -664,7 +664,7 @@ module Raylib
664
664
  [:GuiToggle, :GuiToggle, [Rectangle.by_value, :pointer, :pointer], :int],
665
665
 
666
666
  # @!method GuiToggleGroup(bounds, text, active)
667
- # GuiToggleGroup : Toggle Group control, returns active toggle index
667
+ # GuiToggleGroup : Toggle Group control
668
668
  # @param bounds [Rectangle]
669
669
  # @param text [const char *]
670
670
  # @param active [int *]
@@ -672,7 +672,7 @@ module Raylib
672
672
  [:GuiToggleGroup, :GuiToggleGroup, [Rectangle.by_value, :pointer, :pointer], :int],
673
673
 
674
674
  # @!method GuiToggleSlider(bounds, text, active)
675
- # GuiToggleSlider : Toggle Slider control, returns true when clicked
675
+ # GuiToggleSlider : Toggle Slider control
676
676
  # @param bounds [Rectangle]
677
677
  # @param text [const char *]
678
678
  # @param active [int *]
@@ -688,7 +688,7 @@ module Raylib
688
688
  [:GuiCheckBox, :GuiCheckBox, [Rectangle.by_value, :pointer, :pointer], :int],
689
689
 
690
690
  # @!method GuiComboBox(bounds, text, active)
691
- # GuiComboBox : Combo Box control, returns selected item index
691
+ # GuiComboBox : Combo Box control
692
692
  # @param bounds [Rectangle]
693
693
  # @param text [const char *]
694
694
  # @param active [int *]
@@ -696,7 +696,7 @@ module Raylib
696
696
  [:GuiComboBox, :GuiComboBox, [Rectangle.by_value, :pointer, :pointer], :int],
697
697
 
698
698
  # @!method GuiDropdownBox(bounds, text, active, editMode)
699
- # GuiDropdownBox : Dropdown Box control, returns selected item
699
+ # GuiDropdownBox : Dropdown Box control
700
700
  # @param bounds [Rectangle]
701
701
  # @param text [const char *]
702
702
  # @param active [int *]
@@ -705,7 +705,7 @@ module Raylib
705
705
  [:GuiDropdownBox, :GuiDropdownBox, [Rectangle.by_value, :pointer, :pointer, :bool], :int],
706
706
 
707
707
  # @!method GuiSpinner(bounds, text, value, minValue, maxValue, editMode)
708
- # GuiSpinner : Spinner control, returns selected value
708
+ # GuiSpinner : Spinner control
709
709
  # @param bounds [Rectangle]
710
710
  # @param text [const char *]
711
711
  # @param value [int *]
@@ -736,7 +736,7 @@ module Raylib
736
736
  [:GuiTextBox, :GuiTextBox, [Rectangle.by_value, :pointer, :int, :bool], :int],
737
737
 
738
738
  # @!method GuiSlider(bounds, textLeft, textRight, value, minValue, maxValue)
739
- # GuiSlider : Slider control, returns selected value
739
+ # GuiSlider : Slider control
740
740
  # @param bounds [Rectangle]
741
741
  # @param textLeft [const char *]
742
742
  # @param textRight [const char *]
@@ -747,7 +747,7 @@ module Raylib
747
747
  [:GuiSlider, :GuiSlider, [Rectangle.by_value, :pointer, :pointer, :pointer, :float, :float], :int],
748
748
 
749
749
  # @!method GuiSliderBar(bounds, textLeft, textRight, value, minValue, maxValue)
750
- # GuiSliderBar : Slider Bar control, returns selected value
750
+ # GuiSliderBar : Slider Bar control
751
751
  # @param bounds [Rectangle]
752
752
  # @param textLeft [const char *]
753
753
  # @param textRight [const char *]
@@ -758,7 +758,7 @@ module Raylib
758
758
  [:GuiSliderBar, :GuiSliderBar, [Rectangle.by_value, :pointer, :pointer, :pointer, :float, :float], :int],
759
759
 
760
760
  # @!method GuiProgressBar(bounds, textLeft, textRight, value, minValue, maxValue)
761
- # GuiProgressBar : Progress Bar control, shows current progress value
761
+ # GuiProgressBar : Progress Bar control
762
762
  # @param bounds [Rectangle]
763
763
  # @param textLeft [const char *]
764
764
  # @param textRight [const char *]
@@ -783,7 +783,7 @@ module Raylib
783
783
  [:GuiDummyRec, :GuiDummyRec, [Rectangle.by_value, :pointer], :int],
784
784
 
785
785
  # @!method GuiGrid(bounds, text, spacing, subdivs, mouseCell)
786
- # GuiGrid : Grid control, returns mouse cell position
786
+ # GuiGrid : Grid control
787
787
  # @param bounds [Rectangle]
788
788
  # @param text [const char *]
789
789
  # @param spacing [float]
@@ -793,7 +793,7 @@ module Raylib
793
793
  [:GuiGrid, :GuiGrid, [Rectangle.by_value, :pointer, :float, :int, :pointer], :int],
794
794
 
795
795
  # @!method GuiListView(bounds, text, scrollIndex, active)
796
- # GuiListView : List View control, returns selected list item index
796
+ # GuiListView : List View control
797
797
  # @param bounds [Rectangle]
798
798
  # @param text [const char *]
799
799
  # @param scrollIndex [int *]
@@ -874,7 +874,7 @@ module Raylib
874
874
  [:GuiColorPickerHSV, :GuiColorPickerHSV, [Rectangle.by_value, :pointer, :pointer], :int],
875
875
 
876
876
  # @!method GuiColorPanelHSV(bounds, text, colorHsv)
877
- # GuiColorPanelHSV : Color Panel control that returns HSV color value, used by GuiColorPickerHSV()
877
+ # GuiColorPanelHSV : Color Panel control that updates Hue-Saturation-Value color value, used by GuiColorPickerHSV()
878
878
  # @param bounds [Rectangle]
879
879
  # @param text [const char *]
880
880
  # @param colorHsv [Vector3 *]
@@ -882,7 +882,16 @@ module Raylib
882
882
  [:GuiColorPanelHSV, :GuiColorPanelHSV, [Rectangle.by_value, :pointer, :pointer], :int],
883
883
  ]
884
884
  entries.each do |entry|
885
- attach_function entry[0], entry[1], entry[2], entry[3]
885
+ api_name = if method_naming == :snake_case
886
+ snake_case_name = entry[0].to_s.gsub(/([A-Z]+)([A-Z0-9][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z0-9])/, '\1_\2').downcase
887
+ snake_case_name.gsub!('vector_3', 'vector3_') if snake_case_name.include?('vector_3')
888
+ snake_case_name.gsub!('vector_2', 'vector2_') if snake_case_name.include?('vector_2')
889
+ snake_case_name.chop! if snake_case_name.end_with?('_')
890
+ snake_case_name.to_sym
891
+ else
892
+ entry[0]
893
+ end
894
+ attach_function api_name, entry[1], entry[2], entry[3]
886
895
  rescue FFI::NotFoundError => e
887
896
  warn "[Warning] Failed to import #{entry[0]} (#{e})."
888
897
  end
data/lib/raylib.rb CHANGED
@@ -17,24 +17,24 @@ require_relative 'raygui_helper'
17
17
  module Raylib
18
18
  extend FFI::Library
19
19
 
20
- def self.load_lib(libpath, raygui_libpath: nil, physac_libpath: nil)
20
+ def self.load_lib(libpath, raygui_libpath: nil, physac_libpath: nil, method_naming: :original)
21
21
  lib_paths = [libpath, raygui_libpath, physac_libpath].compact
22
22
 
23
23
  ffi_lib_flags :now, :global
24
24
  ffi_lib(*lib_paths)
25
- setup_symbols
25
+ setup_symbols(method_naming: method_naming)
26
26
 
27
- setup_raygui_symbols unless raygui_libpath.nil?
28
- setup_physac_symbols unless physac_libpath.nil?
27
+ setup_raygui_symbols(method_naming: method_naming) unless raygui_libpath.nil?
28
+ setup_physac_symbols(method_naming: method_naming) unless physac_libpath.nil?
29
29
  rescue LoadError => e
30
30
  warn e
31
31
  end
32
32
 
33
- def self.setup_symbols
34
- setup_raylib_symbols
35
- setup_raymath_symbols
36
- setup_rcamera_symbols
37
- setup_rlgl_symbols
33
+ def self.setup_symbols(method_naming: :original)
34
+ setup_raylib_symbols(method_naming: method_naming)
35
+ setup_raymath_symbols(method_naming: method_naming)
36
+ setup_rcamera_symbols(method_naming: method_naming)
37
+ setup_rlgl_symbols(method_naming: method_naming)
38
38
  end
39
39
 
40
40
  #
data/lib/raylib_helper.rb CHANGED
@@ -61,6 +61,9 @@ module Raylib
61
61
  # Math helper
62
62
  #
63
63
 
64
+ DEG2RAD = Math::PI / 180.0
65
+ RAD2DEG = 180.0 / Math::PI
66
+
64
67
  class Vector2
65
68
  def self.create(x = 0, y = 0)
66
69
  Vector2.new.set(x, y)
data/lib/raylib_main.rb CHANGED
@@ -157,7 +157,7 @@ module Raylib
157
157
  KEY_KP_ENTER = 335 # Key: Keypad Enter
158
158
  KEY_KP_EQUAL = 336 # Key: Keypad =
159
159
  KEY_BACK = 4 # Key: Android back button
160
- KEY_MENU = 82 # Key: Android menu button
160
+ KEY_MENU = 5 # Key: Android menu button
161
161
  KEY_VOLUME_UP = 24 # Key: Android volume up button
162
162
  KEY_VOLUME_DOWN = 25 # Key: Android volume down button
163
163
 
@@ -1123,7 +1123,7 @@ module Raylib
1123
1123
 
1124
1124
  # Function
1125
1125
 
1126
- def self.setup_raylib_symbols
1126
+ def self.setup_raylib_symbols(method_naming: :original)
1127
1127
  entries = [
1128
1128
 
1129
1129
  # @!method InitWindow(width, height, title)
@@ -1614,17 +1614,14 @@ module Raylib
1614
1614
  # @return [Ray]
1615
1615
  [:GetMouseRay, :GetMouseRay, [Vector2.by_value, Camera.by_value], Ray.by_value],
1616
1616
 
1617
- # @!method GetCameraMatrix(camera)
1618
- # GetCameraMatrix : Get camera transform matrix (view matrix)
1617
+ # @!method GetViewRay(mousePosition, camera, width, height)
1618
+ # GetViewRay : Get a ray trace from mouse position in a viewport
1619
+ # @param mousePosition [Vector2]
1619
1620
  # @param camera [Camera]
1620
- # @return [Matrix]
1621
- [:GetCameraMatrix, :GetCameraMatrix, [Camera.by_value], Matrix.by_value],
1622
-
1623
- # @!method GetCameraMatrix2D(camera)
1624
- # GetCameraMatrix2D : Get camera 2d transform matrix
1625
- # @param camera [Camera2D]
1626
- # @return [Matrix]
1627
- [:GetCameraMatrix2D, :GetCameraMatrix2D, [Camera2D.by_value], Matrix.by_value],
1621
+ # @param width [float]
1622
+ # @param height [float]
1623
+ # @return [Ray]
1624
+ [:GetViewRay, :GetViewRay, [Vector2.by_value, Camera.by_value, :float, :float], Ray.by_value],
1628
1625
 
1629
1626
  # @!method GetWorldToScreen(position, camera)
1630
1627
  # GetWorldToScreen : Get the screen space position for a 3d world space position
@@ -1633,13 +1630,6 @@ module Raylib
1633
1630
  # @return [Vector2]
1634
1631
  [:GetWorldToScreen, :GetWorldToScreen, [Vector3.by_value, Camera.by_value], Vector2.by_value],
1635
1632
 
1636
- # @!method GetScreenToWorld2D(position, camera)
1637
- # GetScreenToWorld2D : Get the world space position for a 2d camera screen space position
1638
- # @param position [Vector2]
1639
- # @param camera [Camera2D]
1640
- # @return [Vector2]
1641
- [:GetScreenToWorld2D, :GetScreenToWorld2D, [Vector2.by_value, Camera2D.by_value], Vector2.by_value],
1642
-
1643
1633
  # @!method GetWorldToScreenEx(position, camera, width, height)
1644
1634
  # GetWorldToScreenEx : Get size position for a 3d world space position
1645
1635
  # @param position [Vector3]
@@ -1656,6 +1646,25 @@ module Raylib
1656
1646
  # @return [Vector2]
1657
1647
  [:GetWorldToScreen2D, :GetWorldToScreen2D, [Vector2.by_value, Camera2D.by_value], Vector2.by_value],
1658
1648
 
1649
+ # @!method GetScreenToWorld2D(position, camera)
1650
+ # GetScreenToWorld2D : Get the world space position for a 2d camera screen space position
1651
+ # @param position [Vector2]
1652
+ # @param camera [Camera2D]
1653
+ # @return [Vector2]
1654
+ [:GetScreenToWorld2D, :GetScreenToWorld2D, [Vector2.by_value, Camera2D.by_value], Vector2.by_value],
1655
+
1656
+ # @!method GetCameraMatrix(camera)
1657
+ # GetCameraMatrix : Get camera transform matrix (view matrix)
1658
+ # @param camera [Camera]
1659
+ # @return [Matrix]
1660
+ [:GetCameraMatrix, :GetCameraMatrix, [Camera.by_value], Matrix.by_value],
1661
+
1662
+ # @!method GetCameraMatrix2D(camera)
1663
+ # GetCameraMatrix2D : Get camera 2d transform matrix
1664
+ # @param camera [Camera2D]
1665
+ # @return [Matrix]
1666
+ [:GetCameraMatrix2D, :GetCameraMatrix2D, [Camera2D.by_value], Matrix.by_value],
1667
+
1659
1668
  # @!method SetTargetFPS(fps)
1660
1669
  # SetTargetFPS : Set target FPS (maximum)
1661
1670
  # @param fps [int]
@@ -2156,6 +2165,14 @@ module Raylib
2156
2165
  # @return [int]
2157
2166
  [:SetGamepadMappings, :SetGamepadMappings, [:pointer], :int],
2158
2167
 
2168
+ # @!method SetGamepadVibration(gamepad, leftMotor, rightMotor)
2169
+ # SetGamepadVibration : Set gamepad vibration for both motors
2170
+ # @param gamepad [int]
2171
+ # @param leftMotor [float]
2172
+ # @param rightMotor [float]
2173
+ # @return [void]
2174
+ [:SetGamepadVibration, :SetGamepadVibration, [:int, :float, :float], :void],
2175
+
2159
2176
  # @!method IsMouseButtonPressed(button)
2160
2177
  # IsMouseButtonPressed : Check if a mouse button has been pressed once
2161
2178
  # @param button [int]
@@ -3624,6 +3641,13 @@ module Raylib
3624
3641
  # @return [void]
3625
3642
  [:DrawTextureNPatch, :DrawTextureNPatch, [Texture2D.by_value, NPatchInfo.by_value, Rectangle.by_value, Vector2.by_value, :float, Color.by_value], :void],
3626
3643
 
3644
+ # @!method ColorIsEqual(col1, col2)
3645
+ # ColorIsEqual : Check if two colors are equal
3646
+ # @param col1 [Color]
3647
+ # @param col2 [Color]
3648
+ # @return [bool]
3649
+ [:ColorIsEqual, :ColorIsEqual, [Color.by_value, Color.by_value], :bool],
3650
+
3627
3651
  # @!method Fade(color, alpha)
3628
3652
  # Fade : Get color with alpha applied, alpha goes from 0.0f to 1.0f
3629
3653
  # @param color [Color]
@@ -5117,7 +5141,16 @@ module Raylib
5117
5141
  [:DetachAudioMixedProcessor, :DetachAudioMixedProcessor, [:AudioCallback], :void],
5118
5142
  ]
5119
5143
  entries.each do |entry|
5120
- attach_function entry[0], entry[1], entry[2], entry[3]
5144
+ api_name = if method_naming == :snake_case
5145
+ snake_case_name = entry[0].to_s.gsub(/([A-Z]+)([A-Z0-9][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z0-9])/, '\1_\2').downcase
5146
+ snake_case_name.gsub!('vector_3', 'vector3_') if snake_case_name.include?('vector_3')
5147
+ snake_case_name.gsub!('vector_2', 'vector2_') if snake_case_name.include?('vector_2')
5148
+ snake_case_name.chop! if snake_case_name.end_with?('_')
5149
+ snake_case_name.to_sym
5150
+ else
5151
+ entry[0]
5152
+ end
5153
+ attach_function api_name, entry[1], entry[2], entry[3]
5121
5154
  rescue FFI::NotFoundError => e
5122
5155
  warn "[Warning] Failed to import #{entry[0]} (#{e})."
5123
5156
  end
data/lib/raymath.rb CHANGED
@@ -38,7 +38,7 @@ module Raylib
38
38
 
39
39
  # Function
40
40
 
41
- def self.setup_raymath_symbols
41
+ def self.setup_raymath_symbols(method_naming: :original)
42
42
  entries = [
43
43
 
44
44
  # @!method Clamp(value, min, max)
@@ -230,6 +230,20 @@ module Raylib
230
230
  # @return [Vector2]
231
231
  [:Vector2Reflect, :Vector2Reflect, [Vector2.by_value, Vector2.by_value], Vector2.by_value],
232
232
 
233
+ # @!method Vector2Min(v1, v2)
234
+ # Vector2Min
235
+ # @param v1 [Vector2]
236
+ # @param v2 [Vector2]
237
+ # @return [Vector2]
238
+ [:Vector2Min, :Vector2Min, [Vector2.by_value, Vector2.by_value], Vector2.by_value],
239
+
240
+ # @!method Vector2Max(v1, v2)
241
+ # Vector2Max
242
+ # @param v1 [Vector2]
243
+ # @param v2 [Vector2]
244
+ # @return [Vector2]
245
+ [:Vector2Max, :Vector2Max, [Vector2.by_value, Vector2.by_value], Vector2.by_value],
246
+
233
247
  # @!method Vector2Rotate(v, angle)
234
248
  # Vector2Rotate
235
249
  # @param v [Vector2]
@@ -274,6 +288,14 @@ module Raylib
274
288
  # @return [int]
275
289
  [:Vector2Equals, :Vector2Equals, [Vector2.by_value, Vector2.by_value], :int],
276
290
 
291
+ # @!method Vector2Refract(v, n, r)
292
+ # Vector2Refract
293
+ # @param v [Vector2]
294
+ # @param n [Vector2]
295
+ # @param r [float]
296
+ # @return [Vector2]
297
+ [:Vector2Refract, :Vector2Refract, [Vector2.by_value, Vector2.by_value, :float], Vector2.by_value],
298
+
277
299
  # @!method Vector3Zero()
278
300
  # Vector3Zero
279
301
  # @return [Vector3]
@@ -441,6 +463,14 @@ module Raylib
441
463
  # @return [Vector3]
442
464
  [:Vector3RotateByAxisAngle, :Vector3RotateByAxisAngle, [Vector3.by_value, Vector3.by_value, :float], Vector3.by_value],
443
465
 
466
+ # @!method Vector3MoveTowards(v, target, maxDistance)
467
+ # Vector3MoveTowards
468
+ # @param v [Vector3]
469
+ # @param target [Vector3]
470
+ # @param maxDistance [float]
471
+ # @return [Vector3]
472
+ [:Vector3MoveTowards, :Vector3MoveTowards, [Vector3.by_value, Vector3.by_value, :float], Vector3.by_value],
473
+
444
474
  # @!method Vector3Lerp(v1, v2, amount)
445
475
  # Vector3Lerp
446
476
  # @param v1 [Vector3]
@@ -530,6 +560,153 @@ module Raylib
530
560
  # @return [Vector3]
531
561
  [:Vector3Refract, :Vector3Refract, [Vector3.by_value, Vector3.by_value, :float], Vector3.by_value],
532
562
 
563
+ # @!method Vector4Zero()
564
+ # Vector4Zero
565
+ # @return [Vector4]
566
+ [:Vector4Zero, :Vector4Zero, [], Vector4.by_value],
567
+
568
+ # @!method Vector4One()
569
+ # Vector4One
570
+ # @return [Vector4]
571
+ [:Vector4One, :Vector4One, [], Vector4.by_value],
572
+
573
+ # @!method Vector4Add(v1, v2)
574
+ # Vector4Add
575
+ # @param v1 [Vector4]
576
+ # @param v2 [Vector4]
577
+ # @return [Vector4]
578
+ [:Vector4Add, :Vector4Add, [Vector4.by_value, Vector4.by_value], Vector4.by_value],
579
+
580
+ # @!method Vector4AddValue(v, add)
581
+ # Vector4AddValue
582
+ # @param v [Vector4]
583
+ # @param add [float]
584
+ # @return [Vector4]
585
+ [:Vector4AddValue, :Vector4AddValue, [Vector4.by_value, :float], Vector4.by_value],
586
+
587
+ # @!method Vector4Subtract(v1, v2)
588
+ # Vector4Subtract
589
+ # @param v1 [Vector4]
590
+ # @param v2 [Vector4]
591
+ # @return [Vector4]
592
+ [:Vector4Subtract, :Vector4Subtract, [Vector4.by_value, Vector4.by_value], Vector4.by_value],
593
+
594
+ # @!method Vector4SubtractValue(v, add)
595
+ # Vector4SubtractValue
596
+ # @param v [Vector4]
597
+ # @param add [float]
598
+ # @return [Vector4]
599
+ [:Vector4SubtractValue, :Vector4SubtractValue, [Vector4.by_value, :float], Vector4.by_value],
600
+
601
+ # @!method Vector4Length(v)
602
+ # Vector4Length
603
+ # @param v [Vector4]
604
+ # @return [float]
605
+ [:Vector4Length, :Vector4Length, [Vector4.by_value], :float],
606
+
607
+ # @!method Vector4LengthSqr(v)
608
+ # Vector4LengthSqr
609
+ # @param v [Vector4]
610
+ # @return [float]
611
+ [:Vector4LengthSqr, :Vector4LengthSqr, [Vector4.by_value], :float],
612
+
613
+ # @!method Vector4DotProduct(v1, v2)
614
+ # Vector4DotProduct
615
+ # @param v1 [Vector4]
616
+ # @param v2 [Vector4]
617
+ # @return [float]
618
+ [:Vector4DotProduct, :Vector4DotProduct, [Vector4.by_value, Vector4.by_value], :float],
619
+
620
+ # @!method Vector4Distance(v1, v2)
621
+ # Vector4Distance
622
+ # @param v1 [Vector4]
623
+ # @param v2 [Vector4]
624
+ # @return [float]
625
+ [:Vector4Distance, :Vector4Distance, [Vector4.by_value, Vector4.by_value], :float],
626
+
627
+ # @!method Vector4DistanceSqr(v1, v2)
628
+ # Vector4DistanceSqr
629
+ # @param v1 [Vector4]
630
+ # @param v2 [Vector4]
631
+ # @return [float]
632
+ [:Vector4DistanceSqr, :Vector4DistanceSqr, [Vector4.by_value, Vector4.by_value], :float],
633
+
634
+ # @!method Vector4Scale(v, scale)
635
+ # Vector4Scale
636
+ # @param v [Vector4]
637
+ # @param scale [float]
638
+ # @return [Vector4]
639
+ [:Vector4Scale, :Vector4Scale, [Vector4.by_value, :float], Vector4.by_value],
640
+
641
+ # @!method Vector4Multiply(v1, v2)
642
+ # Vector4Multiply
643
+ # @param v1 [Vector4]
644
+ # @param v2 [Vector4]
645
+ # @return [Vector4]
646
+ [:Vector4Multiply, :Vector4Multiply, [Vector4.by_value, Vector4.by_value], Vector4.by_value],
647
+
648
+ # @!method Vector4Negate(v)
649
+ # Vector4Negate
650
+ # @param v [Vector4]
651
+ # @return [Vector4]
652
+ [:Vector4Negate, :Vector4Negate, [Vector4.by_value], Vector4.by_value],
653
+
654
+ # @!method Vector4Divide(v1, v2)
655
+ # Vector4Divide
656
+ # @param v1 [Vector4]
657
+ # @param v2 [Vector4]
658
+ # @return [Vector4]
659
+ [:Vector4Divide, :Vector4Divide, [Vector4.by_value, Vector4.by_value], Vector4.by_value],
660
+
661
+ # @!method Vector4Normalize(v)
662
+ # Vector4Normalize
663
+ # @param v [Vector4]
664
+ # @return [Vector4]
665
+ [:Vector4Normalize, :Vector4Normalize, [Vector4.by_value], Vector4.by_value],
666
+
667
+ # @!method Vector4Min(v1, v2)
668
+ # Vector4Min
669
+ # @param v1 [Vector4]
670
+ # @param v2 [Vector4]
671
+ # @return [Vector4]
672
+ [:Vector4Min, :Vector4Min, [Vector4.by_value, Vector4.by_value], Vector4.by_value],
673
+
674
+ # @!method Vector4Max(v1, v2)
675
+ # Vector4Max
676
+ # @param v1 [Vector4]
677
+ # @param v2 [Vector4]
678
+ # @return [Vector4]
679
+ [:Vector4Max, :Vector4Max, [Vector4.by_value, Vector4.by_value], Vector4.by_value],
680
+
681
+ # @!method Vector4Lerp(v1, v2, amount)
682
+ # Vector4Lerp
683
+ # @param v1 [Vector4]
684
+ # @param v2 [Vector4]
685
+ # @param amount [float]
686
+ # @return [Vector4]
687
+ [:Vector4Lerp, :Vector4Lerp, [Vector4.by_value, Vector4.by_value, :float], Vector4.by_value],
688
+
689
+ # @!method Vector4MoveTowards(v, target, maxDistance)
690
+ # Vector4MoveTowards
691
+ # @param v [Vector4]
692
+ # @param target [Vector4]
693
+ # @param maxDistance [float]
694
+ # @return [Vector4]
695
+ [:Vector4MoveTowards, :Vector4MoveTowards, [Vector4.by_value, Vector4.by_value, :float], Vector4.by_value],
696
+
697
+ # @!method Vector4Invert(v)
698
+ # Vector4Invert
699
+ # @param v [Vector4]
700
+ # @return [Vector4]
701
+ [:Vector4Invert, :Vector4Invert, [Vector4.by_value], Vector4.by_value],
702
+
703
+ # @!method Vector4Equals(p, q)
704
+ # Vector4Equals
705
+ # @param p [Vector4]
706
+ # @param q [Vector4]
707
+ # @return [int]
708
+ [:Vector4Equals, :Vector4Equals, [Vector4.by_value, Vector4.by_value], :int],
709
+
533
710
  # @!method MatrixDeterminant(mat)
534
711
  # MatrixDeterminant
535
712
  # @param mat [Matrix]
@@ -837,7 +1014,16 @@ module Raylib
837
1014
  [:QuaternionEquals, :QuaternionEquals, [Quaternion.by_value, Quaternion.by_value], :int],
838
1015
  ]
839
1016
  entries.each do |entry|
840
- attach_function entry[0], entry[1], entry[2], entry[3]
1017
+ api_name = if method_naming == :snake_case
1018
+ snake_case_name = entry[0].to_s.gsub(/([A-Z]+)([A-Z0-9][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z0-9])/, '\1_\2').downcase
1019
+ snake_case_name.gsub!('vector_3', 'vector3_') if snake_case_name.include?('vector_3')
1020
+ snake_case_name.gsub!('vector_2', 'vector2_') if snake_case_name.include?('vector_2')
1021
+ snake_case_name.chop! if snake_case_name.end_with?('_')
1022
+ snake_case_name.to_sym
1023
+ else
1024
+ entry[0]
1025
+ end
1026
+ attach_function api_name, entry[1], entry[2], entry[3]
841
1027
  rescue FFI::NotFoundError => e
842
1028
  warn "[Warning] Failed to import #{entry[0]} (#{e})."
843
1029
  end
data/lib/rcamera.rb CHANGED
@@ -19,7 +19,7 @@ module Raylib
19
19
 
20
20
  # Function
21
21
 
22
- def self.setup_rcamera_symbols
22
+ def self.setup_rcamera_symbols(method_naming: :original)
23
23
  entries = [
24
24
 
25
25
  # @!method GetCameraForward(camera)
@@ -109,7 +109,16 @@ module Raylib
109
109
  [:GetCameraProjectionMatrix, :GetCameraProjectionMatrix, [:pointer, :float], Matrix.by_value],
110
110
  ]
111
111
  entries.each do |entry|
112
- attach_function entry[0], entry[1], entry[2], entry[3]
112
+ api_name = if method_naming == :snake_case
113
+ snake_case_name = entry[0].to_s.gsub(/([A-Z]+)([A-Z0-9][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z0-9])/, '\1_\2').downcase
114
+ snake_case_name.gsub!('vector_3', 'vector3_') if snake_case_name.include?('vector_3')
115
+ snake_case_name.gsub!('vector_2', 'vector2_') if snake_case_name.include?('vector_2')
116
+ snake_case_name.chop! if snake_case_name.end_with?('_')
117
+ snake_case_name.to_sym
118
+ else
119
+ entry[0]
120
+ end
121
+ attach_function api_name, entry[1], entry[2], entry[3]
113
122
  rescue FFI::NotFoundError => e
114
123
  warn "[Warning] Failed to import #{entry[0]} (#{e})."
115
124
  end
data/lib/rlgl.rb CHANGED
@@ -77,6 +77,8 @@ module Raylib
77
77
  RL_BLEND_DST_ALPHA = 0x80CA # GL_BLEND_DST_ALPHA
78
78
  RL_BLEND_SRC_ALPHA = 0x80CB # GL_BLEND_SRC_ALPHA
79
79
  RL_BLEND_COLOR = 0x8005 # GL_BLEND_COLOR
80
+ RL_READ_FRAMEBUFFER = 0x8CA8 # GL_READ_FRAMEBUFFER
81
+ RL_DRAW_FRAMEBUFFER = 0x8CA9 # GL_DRAW_FRAMEBUFFER
80
82
 
81
83
  # Enum
82
84
 
@@ -313,7 +315,7 @@ module Raylib
313
315
 
314
316
  # Function
315
317
 
316
- def self.setup_rlgl_symbols
318
+ def self.setup_rlgl_symbols(method_naming: :original)
317
319
  entries = [
318
320
 
319
321
  # @!method rlMatrixMode(mode)
@@ -584,6 +586,11 @@ module Raylib
584
586
  # @return [void]
585
587
  [:rlDisableFramebuffer, :rlDisableFramebuffer, [], :void],
586
588
 
589
+ # @!method rlGetActiveFramebuffer()
590
+ # rlGetActiveFramebuffer : Get the currently active render texture (fbo), 0 for default framebuffer
591
+ # @return [unsigned int]
592
+ [:rlGetActiveFramebuffer, :rlGetActiveFramebuffer, [], :uint],
593
+
587
594
  # @!method rlActiveDrawBuffers(count)
588
595
  # rlActiveDrawBuffers : Activate multiple draw color buffers
589
596
  # @param count [int]
@@ -1077,12 +1084,10 @@ module Raylib
1077
1084
  # @return [unsigned char *]
1078
1085
  [:rlReadScreenPixels, :rlReadScreenPixels, [:int, :int], :pointer],
1079
1086
 
1080
- # @!method rlLoadFramebuffer(width, height)
1087
+ # @!method rlLoadFramebuffer()
1081
1088
  # rlLoadFramebuffer : Load an empty framebuffer
1082
- # @param width [int]
1083
- # @param height [int]
1084
1089
  # @return [unsigned int]
1085
- [:rlLoadFramebuffer, :rlLoadFramebuffer, [:int, :int], :uint],
1090
+ [:rlLoadFramebuffer, :rlLoadFramebuffer, [], :uint],
1086
1091
 
1087
1092
  # @!method rlFramebufferAttach(fboId, texId, attachType, texType, mipLevel)
1088
1093
  # rlFramebufferAttach : Attach texture/renderbuffer to a framebuffer
@@ -1319,7 +1324,16 @@ module Raylib
1319
1324
  [:rlLoadDrawQuad, :rlLoadDrawQuad, [], :void],
1320
1325
  ]
1321
1326
  entries.each do |entry|
1322
- attach_function entry[0], entry[1], entry[2], entry[3]
1327
+ api_name = if method_naming == :snake_case
1328
+ snake_case_name = entry[0].to_s.gsub(/([A-Z]+)([A-Z0-9][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z0-9])/, '\1_\2').downcase
1329
+ snake_case_name.gsub!('vector_3', 'vector3_') if snake_case_name.include?('vector_3')
1330
+ snake_case_name.gsub!('vector_2', 'vector2_') if snake_case_name.include?('vector_2')
1331
+ snake_case_name.chop! if snake_case_name.end_with?('_')
1332
+ snake_case_name.to_sym
1333
+ else
1334
+ entry[0]
1335
+ end
1336
+ attach_function api_name, entry[1], entry[2], entry[3]
1323
1337
  rescue FFI::NotFoundError => e
1324
1338
  warn "[Warning] Failed to import #{entry[0]} (#{e})."
1325
1339
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raylib-bindings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.1
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - vaiorabbit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-07 00:00:00.000000000 Z
11
+ date: 2024-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  - !ruby/object:Gem::Version
72
72
  version: '0'
73
73
  requirements: []
74
- rubygems_version: 3.5.3
74
+ rubygems_version: 3.5.5
75
75
  signing_key:
76
76
  specification_version: 4
77
77
  summary: Ruby bindings for raylib, raygui and Physac