Skip to content

Commit

Permalink
Add initial Ruby YARD documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan-MV committed Jul 20, 2024
1 parent 9844fff commit 287eabd
Show file tree
Hide file tree
Showing 9 changed files with 1,025 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ext/rubyraylib/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ extern "C" void initializeWindow() {
rb_define_module_function(rb_mWindow, "min_size", rb_set_window_min_size, 2);
rb_define_module_function(rb_mWindow, "max_size", rb_set_window_max_size, 2);
rb_define_module_function(rb_mWindow, "size", rb_set_window_size, 2);
rb_define_module_function(rb_mWindow, "opacity", rb_set_window_opacity, 1);
rb_define_module_function(rb_mWindow, "opacity=", rb_set_window_opacity, 1);
rb_define_module_function(rb_mWindow, "focused", rb_set_window_focused, 0);
rb_define_module_function(rb_mWindow, "handle", rb_get_window_handle, 0);
rb_define_module_function(rb_mWindow, "screen_width", rb_get_screen_width, 0);
Expand Down
14 changes: 14 additions & 0 deletions lib/rubyraylib/rl/draw.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module Rl
module Draw
# @!method clear
# Set background color (framebuffer clear color)
# @param color [Color]
# @return [void]
# @!method begin
# Setup canvas (framebuffer) to start drawing
# This method must be used with a block. The drawing commands should be placed inside the block.
# The block ensures that drawing is correctly finalized with EndDrawing.
# @yield The drawing commands to be executed.
# @return [void]
end
end
76 changes: 76 additions & 0 deletions lib/rubyraylib/rl/ease.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
module Rl
module Ease
# @!method linear
# Linear easing types :in, :out, :inout
# @param ease_type [Symbol]
# @param time [Float]
# @param start_value [Float]
# @param change_value [Float]
# @param duration [Float]
# @return [Float]
# @!method sine
# Sine easing types :in, :out, :inout
# @param ease_type [Symbol]
# @param time [Float]
# @param start_value [Float]
# @param change_value [Float]
# @param duration [Float]
# @return [Float]
# @!method circ
# Circular easing types :in, :out, :inout
# @param ease_type [Symbol]
# @param time [Float]
# @param start_value [Float]
# @param change_value [Float]
# @param duration [Float]
# @return [Float]
# @!method cubic
# Cubic easing types :in, :out, :inout
# @param ease_type [Symbol]
# @param time [Float]
# @param start_value [Float]
# @param change_value [Float]
# @param duration [Float]
# @return [Float]
# @!method quad
# Quadratic easing types :in, :out, :inout
# @param ease_type [Symbol]
# @param time [Float]
# @param start_value [Float]
# @param change_value [Float]
# @param duration [Float]
# @return [Float]
# @!method expo
# Exponential easing types :in, :out, :inout
# @param ease_type [Symbol]
# @param time [Float]
# @param start_value [Float]
# @param change_value [Float]
# @param duration [Float]
# @return [Float]
# @!method back
# Back easing types :in, :out, :inout
# @param ease_type [Symbol]
# @param time [Float]
# @param start_value [Float]
# @param change_value [Float]
# @param duration [Float]
# @return [Float]
# @!method bounce
# Bounce easing types :in, :out, :inout
# @param ease_type [Symbol]
# @param time [Float]
# @param start_value [Float]
# @param change_value [Float]
# @param duration [Float]
# @return [Float]
# @!method elastic
# Elastic easing types :in, :out, :inout
# @param ease_type [Symbol]
# @param time [Float]
# @param start_value [Float]
# @param change_value [Float]
# @param duration [Float]
# @return [Float]
end
end
130 changes: 130 additions & 0 deletions lib/rubyraylib/rl/gamepad.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
module Rl
# Input-related functions: gamepads
module Gamepad
# @!attribute BUTTON_UNKNOWN
# Gamepad buttons
# return [Integer]
# @!attribute BUTTON_LEFT_FACE_UP
# Gamepad buttons
# return [Integer]
# @!attribute BUTTON_LEFT_FACE_RIGHT
# Gamepad buttons
# return [Integer]
# @!attribute BUTTON_LEFT_FACE_DOWN
# Gamepad buttons
# return [Integer]
# @!attribute BUTTON_LEFT_FACE_LEFT
# Gamepad buttons
# return [Integer]
# @!attribute BUTTON_RIGHT_FACE_UP
# Gamepad buttons
# return [Integer]
# @!attribute BUTTON_RIGHT_FACE_RIGHT
# Gamepad buttons
# return [Integer]
# @!attribute BUTTON_RIGHT_FACE_DOWN
# Gamepad buttons
# return [Integer]
# @!attribute BUTTON_RIGHT_FACE_LEFT
# Gamepad buttons
# return [Integer]
# @!attribute BUTTON_LEFT_TRIGGER_1
# Gamepad buttons
# return [Integer]
# @!attribute BUTTON_LEFT_TRIGGER_2
# Gamepad buttons
# return [Integer]
# @!attribute BUTTON_RIGHT_TRIGGER_1
# Gamepad buttons
# return [Integer]
# @!attribute BUTTON_RIGHT_TRIGGER_2
# Gamepad buttons
# return [Integer]
# @!attribute BUTTON_MIDDLE_LEFT
# Gamepad buttons
# return [Integer]
# @!attribute BUTTON_MIDDLE
# Gamepad buttons
# return [Integer]
# @!attribute BUTTON_MIDDLE_RIGHT
# Gamepad buttons
# return [Integer]
# @!attribute BUTTON_LEFT_THUMB
# Gamepad buttons
# return [Integer]
# @!attribute BUTTON_RIGHT_THUMB
# Gamepad buttons
# return [Integer]

# @!attribute AXIS_LEFT_X
# Gamepad axis
# return [Integer]
# @!attribute AXIS_LEFT_Y
# Gamepad axis
# return [Integer]
# @!attribute AXIS_RIGHT_X
# Gamepad axis
# return [Integer]
# @!attribute AXIS_RIGHT_Y
# Gamepad axis
# return [Integer]
# @!attribute AXIS_LEFT_TRIGGER
# Gamepad axis
# return [Integer]
# @!attribute AXIS_RIGHT_TRIGGER
# Gamepad axis
# return [Integer]

# @!method available?
# Check if a gamepad is available
# @param gamepad [Integer]
# @return [Boolean]
# @!method name
# Get gamepad internal name id
# @param gamepad [Integer]
# @return [String]
# @!method button_pressed?
# Check if a gamepad button has been pressed once
# @param gamepad [Integer]
# @param button [Integer]
# @return [Boolean]
# @!method button_down?
# Check if a gamepad button is being pressed
# @param gamepad [Integer]
# @param button [Integer]
# @return [Boolean]
# @!method button_released?
# Check if a gamepad button has been released once
# @param gamepad [Integer]
# @param button [Integer]
# @return [Boolean]
# @!method button_up?
# Check if a gamepad button is NOT being pressed
# @param gamepad [Integer]
# @param button [Integer]
# @return [Boolean]
# @!method button_pressed
# Get the last gamepad button pressed
# @return [Integer]
# @!method axis_count
# Get gamepad axis count for a gamepad
# @param gamepad [Integer]
# @return [Integer]
# @!method axis_movement
# Get axis movement value for a gamepad axis
# @param gamepad [Integer]
# @param axis [Integer]
# @return [Float]
# @!method mappings=
# Set internal gamepad mappings (SDL_GameControllerDB)
# @param mappings [String]
# @return [Integer]
# @!method vibration=
# Set gamepad vibration for both motors
# @param gamepad [Integer]
# @param left_motor [Float]
# @param right_motor [Float]
# @return [void]
end
end

32 changes: 32 additions & 0 deletions lib/rubyraylib/rl/gestures.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module Rl
# Gestures and Touch Handling Functions (Module: rgestures)
module Gestures
# @!method enabled=
# Enable a set of gestures using flags
# @param flags [Integer]
# @return [void]
# @!method detected?
# Check if a gesture have been detected
# @param gesture [Integer]
# @return [Boolean]
# @!method detected
# Get latest detected gesture
# @return [Integer]
# @!method hold_duration
# Get gesture hold time in milliseconds
# @return [Float]
# @!method drag_vector
# Get gesture drag vector
# @return [Vec2]
# @!method drag_angle
# Get gesture drag angle
# @return [Float]
# @!method pinch_vector
# Get gesture pinch delta
# @return [Vec2]
# @!method pinch_angle
# Get gesture pinch angle
# @return [Float]
end
end

Loading

0 comments on commit 287eabd

Please sign in to comment.