Skip to content

Commit

Permalink
Fix documentation generation (#40)
Browse files Browse the repository at this point in the history
* Fix docs generation

* Formatting
  • Loading branch information
nobodywasishere authored Oct 13, 2024
1 parent 79c5e17 commit 2c3e405
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 21 deletions.
3 changes: 0 additions & 3 deletions rsrc/build-examples/build.cr
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require "file_utils"



FileUtils.cd("examples") do
puts "BUILDING EXAMPLE FROM #{FileUtils.pwd}"
begin
Expand Down Expand Up @@ -38,7 +36,6 @@ FileUtils.cd("examples") do
exit(1)
end


begin
FileUtils.rm("../_build/#{name}.pdb")
rescue
Expand Down
2 changes: 2 additions & 0 deletions shard.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
version: 2.0
shards: {}
1 change: 0 additions & 1 deletion src/raylib-cr.cr
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
require "./raylib-cr/raylib"
require "./raylib-cr/raymath"

29 changes: 25 additions & 4 deletions src/raylib-cr/audio.cr
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
{% if flag?(:docs) %}
require "./miniaudio_fix/miniaudiohelpers"
{% end %}

@[Link("raylib")]
lib RAudio
alias AudioCallback = Proc(Void*, LibC::UInt)
{% begin %}

{% if !flag?(:docs) %}
{{ run "./miniaudio_fix/ma_sizes" }}
{% else %}
# Copy of `miniaudio_fix/ma_sizes.cr` for docs gen, StaticArray sizes are not correct
struct MADataConverter
data : StaticArray(UInt8, 255)
end

struct MAContext
data : StaticArray(UInt8, 255)
end

struct MADevice
data : StaticArray(UInt8, 255)
end

struct MAMutex
data : StaticArray(UInt8, 255)
end
{% end %}

struct Wave
Expand Down Expand Up @@ -93,7 +114,7 @@ lib RAudio
ctx_type : LibC::Int
ctx_data : Void*
end

enum MusicContextType
AudioNone = 0
AudioWav = 1
Expand All @@ -108,7 +129,7 @@ lib RAudio
fun close_audio_device = CloseAudioDevice
fun audio_device_ready? = IsAudioDeviceReady : Bool
fun set_master_volume = SetMasterVolume(volume : LibC::Float)
fun get_master_volume = GetMasterVolume() : LibC::Float
fun get_master_volume = GetMasterVolume : LibC::Float
fun load_wave = LoadWave(file_name : LibC::Char*) : Wave
fun wave_ready? = IsWaveReady(wave : Wave) : Bool
fun load_wave_from_memory = LoadWaveFromMemory(file_type : LibC::Char*, file_data : LibC::UChar*, data_size : LibC::Int) : Wave
Expand Down
3 changes: 1 addition & 2 deletions src/raylib-cr/raygui.cr
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ lib Raygui
end

enum ControlProperty
BorderColorNormal = 0
BorderColorNormal = 0

BaseColorNormal
TextColorNormal
Expand Down Expand Up @@ -470,5 +470,4 @@ lib Raygui
fun color_bar_hue = GuiColorBarHue(bounds : Raylib::Rectangle, text : LibC::Char*, value : LibC::Float*) : LibC::Int
fun color_picker_hsv = GuiColorPickerHSV(bounds : Raylib::Rectangle, text : LibC::Char*, color_hsv : Raylib::Vector3*) : LibC::Int
fun color_panel_hsv = GuiColorPanelHSV(bounds : Raylib::Rectangle, text : LibC::Char*, color_hsv : Raylib::Vector3*) : LibC::Int

end
17 changes: 6 additions & 11 deletions src/raylib-cr/raylib.cr
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,6 @@ lib Raylib
ThreePatchHorizontal = 2
end


LIGHTGRAY = Color.new r: 200, g: 200, b: 200, a: 255
GRAY = Color.new r: 130, g: 130, b: 130, a: 255
DARKGRAY = Color.new r: 80, g: 80, b: 80, a: 255
Expand Down Expand Up @@ -756,7 +755,7 @@ lib Raylib
fun set_random_seed = SetRandomSeed(seed : LibC::UInt)
fun load_random_sequence = LoadRandomSequence(count : LibC::UInt, min : LibC::Int, max : LibC::Int) : LibC::Int*
fun unload_random_sequence = UnloadRandomSequence(sequence : LibC::Int*)

fun take_screenshot = TakeScreenshot(file_name : LibC::Char*)
fun set_config_flags = SetConfigFlags(flags : LibC::UInt)
fun trace_log = TraceLog(log_level : LibC::Int, text : LibC::Char*, ...)
Expand Down Expand Up @@ -798,19 +797,16 @@ lib Raylib
fun decompress_data = DecompressData(comp_data : LibC::UChar*, comp_data_length : LibC::Int, data_length : LibC::Int*) : LibC::UChar*
fun encode_data_base64 = EncodeDataBase64(data : LibC::UChar*, data_length : LibC::Int, output_length : LibC::Int*) : LibC::Char*
fun decode_data_base64 = DecodeDataBase64(data : LibC::UChar*, output_length : LibC::Int*) : LibC::UChar*

fun load_automation_event_list = LoadAutomationEventList(filename : LibC::Char*) : AutomationEventList
fun unload_automation_event_list = UnloadAutomationEventList(list : AutomationEventList*)
fun export_automation_event_list = ExportAutomationEventList(list : AutomationEventList, filename : LibC::Char*) : Bool
fun set_automation_event_list = SetAutomationEventList(list : AutomationEventList*)
fun set_automation_event_base_frame = SetAutomationEventBaseFrame(frame : LibC::Int)
fun start_automation_event_recording = StartAutomationEventRecording()
fun stop_automation_event_recording = StopAutomationEventRecording()
fun start_automation_event_recording = StartAutomationEventRecording
fun stop_automation_event_recording = StopAutomationEventRecording
fun play_automation_event_recording = PlayAutomationEventRecording(event : AutomationEvent)




fun key_pressed? = IsKeyPressed(key : LibC::Int) : Bool
fun key_pressed_repeat? = IsKeyPressedRepeat(key : LibC::Int) : Bool
fun key_down? = IsKeyDown(key : LibC::Int) : Bool
Expand Down Expand Up @@ -886,7 +882,6 @@ lib Raylib
fun get_spline_point_bezier_quad = GetSplinePointBezierQuad(p1 : Vector2, c2 : Vector2, p3 : Vector2, t : LibC::Float) : Vector2
fun get_spline_point_bezier_cubic = GetSplinePointBezierCubic(p1 : Vector2, c2 : Vector2, c3 : Vector2, p4 : Vector2, t : LibC::Float) : Vector2


fun draw_circle = DrawCircle(center_x : LibC::Int, center_y : LibC::Int, radius : LibC::Float, color : Color)
fun draw_circle_sector = DrawCircleSector(center : Vector2, radius : LibC::Float, start_angle : LibC::Float, end_angle : LibC::Float, segments : LibC::Int, color : Color)
fun draw_circle_sector_lines = DrawCircleSectorLines(center : Vector2, radius : LibC::Float, start_angle : LibC::Float, end_angle : LibC::Float, segments : LibC::Int, color : Color)
Expand Down Expand Up @@ -1153,7 +1148,7 @@ lib Raylib
fun get_ray_collision_box = GetRayCollisionBox(ray : Ray, box : BoundingBox) : RayCollision
fun get_ray_collision_mesh = GetRayCollisionMesh(ray : Ray, mesh : Mesh, transform : Matrix) : RayCollision
fun get_ray_collision_triangle = GetRayCollisionTriangle(ray : Ray, p1 : Vector3, p2 : Vector3, p3 : Vector3) : RayCollision
fun get_ray_collision_quad = GetRayCollisionQuad(ray : Ray, p1 : Vector3, p2 : Vector3, p3 : Vector3, p4 : Vector3) : RayCollision
fun get_ray_collision_quad = GetRayCollisionQuad(ray : Ray, p1 : Vector3, p2 : Vector3, p3 : Vector3, p4 : Vector3) : RayCollision
fun get_camera_forward = GetCameraForward(camera : Raylib::Camera3D*) : Raylib::Vector3
fun get_camera_up = GetCameraUp(camera : Raylib::Camera3D*) : Raylib::Vector3
fun get_camera_right = GetCameraRight(camera : Raylib::Camera3D*) : Raylib::Vector3
Expand All @@ -1163,5 +1158,5 @@ lib Raylib
fun camera_move_target = CameraMoveToTarget(camera : Raylib::Camera3D*, delta : LibC::Float)
fun camera_yaw = CameraYaw(camera : Raylib::Camera3D*, angle : LibC::Float, rotateAroundTarget : Bool)
fun camera_pitch = CameraPitch(camera : Raylib::Camera3D*, angle : LibC::Float, lockView : Bool, rotateAroundTarget : Bool, rotateUp : Bool)
fun camera_roll = CameraRoll(camera : Raylib::Camera3D*, angle : LibC::Float)
fun camera_roll = CameraRoll(camera : Raylib::Camera3D*, angle : LibC::Float)
end

0 comments on commit 2c3e405

Please sign in to comment.