From 2c3e40588ee6cc43d96aaca21ac566a36e7e71b6 Mon Sep 17 00:00:00 2001 From: Margret Riegert Date: Sun, 13 Oct 2024 13:49:15 -0400 Subject: [PATCH] Fix documentation generation (#40) * Fix docs generation * Formatting --- rsrc/build-examples/build.cr | 3 --- shard.lock | 2 ++ src/raylib-cr.cr | 1 - src/raylib-cr/audio.cr | 29 +++++++++++++++++++++++++---- src/raylib-cr/raygui.cr | 3 +-- src/raylib-cr/raylib.cr | 17 ++++++----------- 6 files changed, 34 insertions(+), 21 deletions(-) create mode 100644 shard.lock diff --git a/rsrc/build-examples/build.cr b/rsrc/build-examples/build.cr index 9d011b2..fb3cc73 100644 --- a/rsrc/build-examples/build.cr +++ b/rsrc/build-examples/build.cr @@ -1,7 +1,5 @@ require "file_utils" - - FileUtils.cd("examples") do puts "BUILDING EXAMPLE FROM #{FileUtils.pwd}" begin @@ -38,7 +36,6 @@ FileUtils.cd("examples") do exit(1) end - begin FileUtils.rm("../_build/#{name}.pdb") rescue diff --git a/shard.lock b/shard.lock new file mode 100644 index 0000000..4f3e149 --- /dev/null +++ b/shard.lock @@ -0,0 +1,2 @@ +version: 2.0 +shards: {} diff --git a/src/raylib-cr.cr b/src/raylib-cr.cr index d208508..26e4295 100644 --- a/src/raylib-cr.cr +++ b/src/raylib-cr.cr @@ -1,3 +1,2 @@ require "./raylib-cr/raylib" require "./raylib-cr/raymath" - diff --git a/src/raylib-cr/audio.cr b/src/raylib-cr/audio.cr index 3c6a07e..f65a53e 100644 --- a/src/raylib-cr/audio.cr +++ b/src/raylib-cr/audio.cr @@ -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 @@ -93,7 +114,7 @@ lib RAudio ctx_type : LibC::Int ctx_data : Void* end - + enum MusicContextType AudioNone = 0 AudioWav = 1 @@ -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 diff --git a/src/raylib-cr/raygui.cr b/src/raylib-cr/raygui.cr index 9be2ead..4332eb1 100644 --- a/src/raylib-cr/raygui.cr +++ b/src/raylib-cr/raygui.cr @@ -51,7 +51,7 @@ lib Raygui end enum ControlProperty - BorderColorNormal = 0 + BorderColorNormal = 0 BaseColorNormal TextColorNormal @@ -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 diff --git a/src/raylib-cr/raylib.cr b/src/raylib-cr/raylib.cr index 8fd1a6a..2545f70 100644 --- a/src/raylib-cr/raylib.cr +++ b/src/raylib-cr/raylib.cr @@ -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 @@ -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*, ...) @@ -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 @@ -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) @@ -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 @@ -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