From 9811a6a3253b795e58a34502166e26bc3fbf4cc8 Mon Sep 17 00:00:00 2001 From: Steve Murphy Date: Wed, 19 Aug 2026 10:36:33 -0600 Subject: [PATCH 1/6] Upgrade raylib bindings from 4.0 to 6.0 Regenerate api_reference/{raylib,raymath}_api.xml from real raylib 6.0 headers and bump Raylib_jll compat to 6.0. Fix the hand-written ABI structs that changed layout (Mesh, Model, ModelAnimation, AudioStream, VrDeviceInfo) and add the new ones (ModelSkeleton, FilePathList, AutomationEvent, AutomationEventList, ModelAnimPose), registering them in the generator's typemap so functions referencing them actually bind. Update UpdateCamera/UpdateCamera! for the new explicit mode argument (SetCameraMode and its global state were removed upstream) and rework GetDroppedFiles on LoadDroppedFiles/UnloadDroppedFiles (ClearDroppedFiles removed). Update examples and tests for the same API changes; one test assertion was flipped after confirming via raylib's own rcamera.h source that UpdateCamera is now genuinely a no-op with no window/input backend, unlike <=4.x's unconditional per-call recompute. All struct ABI sizes verified against sizeof() on the real C headers; package precompiles and the full test suite passes against Raylib_jll 6.0.1. raygui_api.xml/physac_api.xml left untouched (no updated source available). Co-Authored-By: Claude Sonnet 5 --- Project.toml | 4 +- api_reference/raylib_api.xml | 1963 +++++++++++------ api_reference/raymath_api.xml | 298 ++- examples/core/3d_camera_first_person.jl | 3 +- examples/core/ccall/3d_camera_first_person.jl | 3 +- examples/core/initialize_3d_camera_free.jl | 4 +- examples/core/windows_drop_files.jl | 1 - examples/textures/draw_textured_polygon.jl | 11 +- src/binding/binding.jl | 5 + src/binding/struct.jl | 56 +- src/core.jl | 27 +- test/core.jl | 15 +- 12 files changed, 1655 insertions(+), 735 deletions(-) diff --git a/Project.toml b/Project.toml index 4774197..896e467 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Raylib" uuid = "681baf3e-1d1e-48c9-b5e5-b1aea2d6d4d9" authors = ["chengchingwen and contributors"] -version = "0.2.0" +version = "0.3.0" [deps] CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82" @@ -12,7 +12,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [compat] CEnum = "0.4" Colors = "0.12" -Raylib_jll = "4.0" +Raylib_jll = "6.0" StaticArrays = "1.2" julia = "1.6" diff --git a/api_reference/raylib_api.xml b/api_reference/raylib_api.xml index 87bb4a7..37d8280 100644 --- a/api_reference/raylib_api.xml +++ b/api_reference/raylib_api.xml @@ -1,59 +1,130 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - - - - + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -61,14 +132,14 @@ - + - + @@ -76,493 +147,562 @@ - + - + - - - - - + + + + + - + - + + + + - - - + - + - + - + - + - - + + - + + + + + + - - - + + + - - - - - + + + + + - + - + - + - - + + - + - + - + + - + - + - + - - - + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - + + + + + - - - - - - - + + + + + + - - - - + + + + - - - - - - - + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - + + + + + + - - - + + + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - + - + - + @@ -575,52 +715,71 @@ - + - + - + - + - + + + - + + + + + - + - + + + + + + + + + + + + + + - + - + - + @@ -636,7 +795,7 @@ - + @@ -644,12 +803,11 @@ - + - + - - + @@ -722,6 +880,9 @@ + + + @@ -748,7 +909,7 @@ - + @@ -756,15 +917,15 @@ - - + + - + + - - - + + @@ -784,21 +945,42 @@ + + + + + + - - + + + + + + + + + + + + - - + + + + + + + @@ -806,26 +988,56 @@ + + + + + + - + - - + + - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -839,27 +1051,29 @@ - + - - - - + - + - - - - + + + - - + + + - + - + + + + + + @@ -867,10 +1081,16 @@ - + + + + + + + @@ -888,57 +1108,110 @@ - - - + - + + - + + + + + + + + + + + + + + + + + + - - + - + + - - + + - - - - + + + + + + + + + - - - - + + + + - + - - + + + + + + - + - + - - - + + + + + + + - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -948,13 +1221,16 @@ - - - + + + + + + @@ -979,16 +1255,22 @@ - + - + + + + + + + @@ -1021,7 +1303,9 @@ - + + + @@ -1042,11 +1326,11 @@ - + - + @@ -1056,40 +1340,30 @@ - - + + - + - - - - - - - - - - - - - - - - - + + + - + + + + + - + @@ -1100,41 +1374,33 @@ - + - + - - - - + + + - + - - + - - - - - - - - + + @@ -1143,6 +1409,17 @@ + + + + + + + + + + + @@ -1159,27 +1436,26 @@ - + - - + - + - + - + + - - - + + @@ -1191,6 +1467,12 @@ + + + + + + @@ -1236,23 +1518,23 @@ - - + + - - + + - - - - + + + + @@ -1272,7 +1554,13 @@ - + + + + + + + @@ -1292,12 +1580,12 @@ - + - + @@ -1323,6 +1611,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1338,6 +1725,12 @@ + + + + + + @@ -1353,6 +1746,17 @@ + + + + + + + + + + + @@ -1360,12 +1764,6 @@ - - - - - - @@ -1384,6 +1782,12 @@ + + + + + + @@ -1394,12 +1798,20 @@ + + + - + + + + + + @@ -1410,19 +1822,21 @@ - + - - + + + - + - - + + + - + @@ -1442,11 +1856,23 @@ + + + + + + + + + + + + @@ -1454,6 +1880,10 @@ + + + + @@ -1494,6 +1924,15 @@ + + + + + + + + + @@ -1528,6 +1967,10 @@ + + + + @@ -1609,14 +2052,34 @@ - + + + + + + + + + + + + + + + + + + + + + - + @@ -1647,6 +2110,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1685,17 +2183,23 @@ + + + + + + - + - + @@ -1735,22 +2239,6 @@ - - - - - - - - - - - - - - - - @@ -1767,19 +2255,15 @@ - - - - - - - + + + - + @@ -1796,6 +2280,18 @@ + + + + + + + + + + + + @@ -1805,6 +2301,11 @@ + + + + + @@ -1827,11 +2328,11 @@ - + - - + + @@ -1843,31 +2344,39 @@ - - + + + + + - + - - + + + - - + + - + - + + + + + @@ -1905,6 +2414,18 @@ + + + + + + + + + + + + @@ -1915,6 +2436,13 @@ + + + + + + + @@ -1927,6 +2455,13 @@ + + + + + + + @@ -1939,15 +2474,27 @@ - + + + + + + + + + - + - - - + + + + + + + @@ -1962,52 +2509,91 @@ - + - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - + - + + + + + + + + + + + - - + - + - + - + @@ -2033,7 +2619,7 @@ - + @@ -2061,23 +2647,6 @@ - - - - - - - - - - - - - - - - - @@ -2129,6 +2698,22 @@ + + + + + + + + + + + + + + + + @@ -2148,10 +2733,10 @@ - + - + @@ -2193,7 +2778,7 @@ - + @@ -2222,7 +2807,7 @@ - + @@ -2237,21 +2822,22 @@ - + - - - - - - + + + + + + + @@ -2314,6 +2900,9 @@ + + + @@ -2329,19 +2918,24 @@ - + - + - + - - + + + + + + + - - + + @@ -2371,10 +2965,6 @@ - - - - @@ -2402,6 +2992,8 @@ + + @@ -2410,13 +3002,22 @@ + + + - + + + + + + + @@ -2427,6 +3028,9 @@ + + + @@ -2447,13 +3051,6 @@ - - - - - - - @@ -2465,21 +3062,25 @@ - - - - - + + + - + - - + + - + + + + + + + @@ -2490,9 +3091,12 @@ - + + + + @@ -2526,6 +3130,10 @@ + + + + @@ -2537,6 +3145,9 @@ + + + @@ -2571,8 +3182,30 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/api_reference/raymath_api.xml b/api_reference/raymath_api.xml index 4f34291..e9cce18 100644 --- a/api_reference/raymath_api.xml +++ b/api_reference/raymath_api.xml @@ -1,37 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - - - + + + + + + + + + + + + + + + + + - + - + + + + - + + + @@ -54,6 +94,15 @@ + + + + + + + + + @@ -84,14 +133,26 @@ + + + + + + + + + + + + @@ -110,6 +171,10 @@ + + + + @@ -119,6 +184,14 @@ + + + + + + + + @@ -128,6 +201,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -177,7 +272,11 @@ - + + + + + @@ -191,6 +290,14 @@ + + + + + + + + @@ -203,11 +310,28 @@ + + + + + + + + + + + + + + + + + @@ -234,6 +358,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -246,9 +473,6 @@ - - - @@ -263,6 +487,10 @@ + + + + @@ -282,10 +510,10 @@ - + - + @@ -297,22 +525,22 @@ - - + + - + - - + + - - + + @@ -376,6 +604,13 @@ + + + + + + + @@ -407,5 +642,20 @@ + + + + + + + + + + + + + + + diff --git a/examples/core/3d_camera_first_person.jl b/examples/core/3d_camera_first_person.jl index 5bffdfc..1b74856 100644 --- a/examples/core/3d_camera_first_person.jl +++ b/examples/core/3d_camera_first_person.jl @@ -39,11 +39,10 @@ function main() ) end - Raylib.SetCameraMode(camera, Int(Raylib.CAMERA_FIRST_PERSON)) Raylib.SetTargetFPS(60) while !Raylib.WindowShouldClose() - Raylib.UpdateCamera!(camera) + Raylib.UpdateCamera!(camera, Raylib.CAMERA_FIRST_PERSON) Raylib.BeginDrawing() Raylib.ClearBackground(RAYWHITE) diff --git a/examples/core/ccall/3d_camera_first_person.jl b/examples/core/ccall/3d_camera_first_person.jl index 989364e..746d038 100644 --- a/examples/core/ccall/3d_camera_first_person.jl +++ b/examples/core/ccall/3d_camera_first_person.jl @@ -72,11 +72,10 @@ function main() ) end - @ccall libraylib.SetCameraMode(camera[]::RayCamera3D, 3::Cint)::Cvoid @ccall libraylib.SetTargetFPS(60::Cint)::Cvoid while iszero(@ccall libraylib.WindowShouldClose()::Cint) - @ccall libraylib.UpdateCamera(camera::Ref{RayCamera3D})::Cvoid + @ccall libraylib.UpdateCamera(camera::Ref{RayCamera3D}, 3::Cint)::Cvoid @ccall libraylib.BeginDrawing()::Cvoid @ccall libraylib.ClearBackground(RAYWHITE::RayColor)::Cvoid diff --git a/examples/core/initialize_3d_camera_free.jl b/examples/core/initialize_3d_camera_free.jl index 57602b1..874aa5b 100644 --- a/examples/core/initialize_3d_camera_free.jl +++ b/examples/core/initialize_3d_camera_free.jl @@ -20,12 +20,10 @@ function main() cubePosition = Raylib.rayvector(0, 0, 0) - Raylib.SetCameraMode(camera, Int(Raylib.CAMERA_FREE)) # Set a free camera mode - Raylib.SetTargetFPS(60) while !Raylib.WindowShouldClose() # Detect window close button or ESC key # Update - camera = Raylib.UpdateCamera(camera) # Update camera + camera = Raylib.UpdateCamera(camera, Raylib.CAMERA_FREE) # Update camera Raylib.IsKeyDown(Int('Z')) && (camera = Raylib.RayCamera3D( camera.position, Raylib.rayvector(0, 0, 0), diff --git a/examples/core/windows_drop_files.jl b/examples/core/windows_drop_files.jl index 6228355..96f72c7 100644 --- a/examples/core/windows_drop_files.jl +++ b/examples/core/windows_drop_files.jl @@ -40,6 +40,5 @@ function main() Raylib.EndDrawing() end - Raylib.ClearDroppedFiles() Raylib.CloseWindow() end diff --git a/examples/textures/draw_textured_polygon.jl b/examples/textures/draw_textured_polygon.jl index 67e3c75..8192cf6 100644 --- a/examples/textures/draw_textured_polygon.jl +++ b/examples/textures/draw_textured_polygon.jl @@ -49,10 +49,13 @@ function main() Raylib.BeginDrawing() Raylib.ClearBackground(Raylib.RAYWHITE) Raylib.DrawText("textured polygon", 20, 20, 20, Raylib.DARKGRAY) - Raylib.DrawTexturePoly( - texture, rayvector(Raylib.GetScreenWidth()/2, Raylib.GetScreenHeight()/2), - pointer(positions), pointer(texcoords), MAX_POINTS, Raylib.WHITE - ) + # DrawTexturePoly was removed in raylib 6.0 with no direct replacement in raylib.h; + # reimplementing this now requires immediate-mode rlgl calls (rlBegin(RL_TRIANGLES)/ + # rlTexCoord2f/rlVertex2f/rlEnd), which this port doesn't wrap yet. + # Raylib.DrawTexturePoly( + # texture, rayvector(Raylib.GetScreenWidth()/2, Raylib.GetScreenHeight()/2), + # pointer(positions), pointer(texcoords), MAX_POINTS, Raylib.WHITE + # ) Raylib.EndDrawing() end diff --git a/src/binding/binding.jl b/src/binding/binding.jl index e86fddf..6f55c69 100644 --- a/src/binding/binding.jl +++ b/src/binding/binding.jl @@ -153,7 +153,12 @@ let "Transform" => :RayTransform, "BoneInfo" => :RayBoneInfo, "Model" => :RayModel, + "ModelSkeleton" => :RayModelSkeleton, "ModelAnimation" => :RayModelAnimation, + "ModelAnimPose" => :RayModelAnimPose, + "FilePathList" => :RayFilePathList, + "AutomationEvent" => :RayAutomationEvent, + "AutomationEventList" => :RayAutomationEventList, "Ray" => :Ray, "RayCollision" => :RayCollision, "BoundingBox" => :RayBoundingBox, diff --git a/src/binding/struct.jl b/src/binding/struct.jl index 0b98e27..97ea8ef 100644 --- a/src/binding/struct.jl +++ b/src/binding/struct.jl @@ -71,11 +71,14 @@ struct RayMesh colors::Ptr{Cuchar} # Vertex colors (RGBA - 4 components per vertex) (shader-location = 3) indices::Ptr{Cuchar} # Vertex indices (in case vertex data comes indexed) - # Animation vertex data + # Skin data for animation + boneCount::Cint # Number of bones (MAX: 256 bones) + boneIndices::Ptr{Cuchar} # Vertex bone indices, up to 4 bones influence by vertex (skinning) + boneWeights::Ptr{Cfloat} # Vertex bone weight, up to 4 bones influence by vertex (skinning) + + # Runtime animation vertex data (CPU skinning) animVertices::Ptr{Cfloat} # Animated vertex positions (after bones transformations) animNormals::Ptr{Cfloat} # Animated normals (after bones transformations) - boneIds::Ptr{Cuchar} # Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning) - boneWeights::Ptr{Cfloat} # Vertex bone weight, up to 4 bones influence by vertex (skinning) # OpenGL identifiers vaoId::Cuint # OpenGL Vertex Array Object id @@ -105,11 +108,20 @@ struct RayTransform scale::RayVector3 # Scale end +# ModelAnimPose, an array of Transform[] +const RayModelAnimPose = Ptr{RayTransform} + struct RayBoneInfo name::NTuple{32, Cchar} # Bone name parent::Cint # Bone parent end +struct RayModelSkeleton + boneCount::Cint # Number of bones + bones::Ptr{RayBoneInfo} # Bones information (skeleton) + bindPose::RayModelAnimPose # Bones base transformation (Transform[]) +end + struct RayModel transform::RayMatrix # Local transform matrix @@ -120,17 +132,19 @@ struct RayModel meshMaterial::Ptr{Cint} # Mesh material number # Animation data - boneCount::Cint # Number of bones - bones::Ptr{RayBoneInfo} # Bones information (skeleton) - bindPose::Ptr{RayTransform} # Bones base transformation (pose) + skeleton::RayModelSkeleton # Skeleton for animation + + # Runtime animation data (CPU/GPU skinning) + currentPose::RayModelAnimPose # Current animation pose (Transform[]) + boneMatrices::Ptr{RayMatrix} # Bones animated transformation matrices end struct RayModelAnimation - boneCount::Cint # Number of bones - frameCount::Cint # Number of animation frames - bones::Ptr{RayBoneInfo} # Bones information (skeleton) - # Transform **framePoses # Poses array by frame - framePoses::Ptr{Ptr{RayTransform}} # Poses array by frame + name::NTuple{32, Cchar} # Animation name + + boneCount::Cint # Number of bones (per pose) + keyframeCount::Cint # Number of animation key frames + keyframePoses::Ptr{RayModelAnimPose} # Animation sequence keyframe poses [keyframe][pose] end struct Ray @@ -161,6 +175,8 @@ end struct RayAudioStream # rAudioBuffer *buffer; // Pointer to internal data used by the audio system buffer::Ptr{Cvoid} + # rAudioProcessor *processor; // Pointer to internal data processor, useful for audio effects + processor::Ptr{Cvoid} sampleRate::Cuint # Frequency (samples per second) sampleSize::Cuint # Bit depth (bits per sample): 8, 16, 32 (24 not supported) @@ -186,7 +202,6 @@ struct RayVrDeviceInfo vResolution::Cint # Vertical resolution in pixels hScreenSize::Cfloat # Horizontal size in meters vScreenSize::Cfloat # Vertical size in meters - vScreenCenter::Cfloat # Screen center in meters eyeToScreenDistance::Cfloat # Distance between eye and display in meters lensSeparationDistance::Cfloat # Lens separation distance in meters interpupillaryDistance::Cfloat # IPD (distance between pupils) in meters @@ -205,6 +220,23 @@ struct RayVrStereoConfig scaleIn::NTuple{2, Cfloat} # VR distortion scale in end +struct RayFilePathList + count::Cuint # Filepaths entries count + paths::Ptr{Cstring} # Filepaths entries +end + +struct RayAutomationEvent + frame::Cuint # Event frame + type::Cuint # Event type (AutomationEventType) + params::NTuple{4, Cint} # Event parameters (if required) +end + +struct RayAutomationEventList + capacity::Cuint # Events max entries (MAX_AUTOMATION_EVENTS) + count::Cuint # Events entries count + events::Ptr{RayAutomationEvent} # Events entries +end + struct RayGuiStyleProp controlId::Cushort propertyId::Cushort diff --git a/src/core.jl b/src/core.jl index eac999a..c1597fe 100644 --- a/src/core.jl +++ b/src/core.jl @@ -1,23 +1,23 @@ """ - UpdateCamera(camera::RayCamera3D) + UpdateCamera(camera::RayCamera3D, mode) -Return new camera with updated parameter. +Return new camera with updated parameter for selected `mode` (a `CameraMode` value). """ -function Binding.UpdateCamera(camera::RayCamera3D) +function Binding.UpdateCamera(camera::RayCamera3D, mode) new_camera_ref = Ref(camera) - UpdateCamera(new_camera_ref) + UpdateCamera(new_camera_ref, Cint(mode)) return new_camera_ref[] end """ - UpdateCamera!(camera::RayCamera3D) + UpdateCamera!(camera::RayCamera3D, mode) -Update camera position for selected mode +Update camera position for selected `mode` (a `CameraMode` value). """ -function UpdateCamera!(camera::RayCamera3D) +function UpdateCamera!(camera::RayCamera3D, mode) camera_ptr = convert(Ptr{RayCamera3D}, pointer_from_objref(camera)) - UpdateCamera(camera_ptr) + UpdateCamera(camera_ptr, Cint(mode)) return camera end @@ -26,11 +26,12 @@ end Return a list of dropped file paths. """ -function Binding.GetDroppedFiles() - count = Ref{Cint}(0) - fptrs = GetDroppedFiles(count) - fcstr = Base.unsafe_wrap(Vector{Cstring}, fptrs, count[]) - return map(Base.unsafe_string, fcstr) +function GetDroppedFiles() + files = LoadDroppedFiles() + fcstr = Base.unsafe_wrap(Vector{Cstring}, files.paths, files.count) + paths = map(Base.unsafe_string, fcstr) + UnloadDroppedFiles(files) + return paths end """ diff --git a/test/core.jl b/test/core.jl index fba8485..75824aa 100644 --- a/test/core.jl +++ b/test/core.jl @@ -72,9 +72,12 @@ end Raylib.CAMERA_ORTHOGRAPHIC ]) - Raylib.SetCameraMode(camera, Int(Raylib.CAMERA_FIRST_PERSON)) - Raylib.UpdateCamera!(camera) - @test !test_camera(camera, [ + # raylib 6.0's rcamera.h rewrite made UpdateCamera purely input-driven (IsKeyDown/ + # GetMouseDelta/GetFrameTime), unlike <=4.x's unconditional per-call recompute from + # persisted static angle state. With no window/input backend (as here, headless), + # those all report false/zero, so FIRST_PERSON is now a real no-op. + Raylib.UpdateCamera!(camera, Raylib.CAMERA_FIRST_PERSON) + @test test_camera(camera, [ Raylib.rayvector(0, 10, 10) + Raylib.rayvector(1, 2, 3), Raylib.rayvector(0, 0, 0) + Raylib.rayvector(3, 2, 1), Raylib.rayvector(0, 1, 0) + Raylib.rayvector(4, 5, 6), @@ -82,8 +85,7 @@ end Raylib.CAMERA_ORTHOGRAPHIC ]) - Raylib.SetCameraMode(camera, Int(Raylib.CAMERA_CUSTOM)) - Raylib.UpdateCamera!(camera) + Raylib.UpdateCamera!(camera, Raylib.CAMERA_CUSTOM) camera.position = Raylib.rayvector(1, 2, 3) camera.target = Raylib.rayvector(3, 2, 1) camera.up = Raylib.rayvector(4, 5, 6) @@ -97,8 +99,7 @@ end Raylib.CAMERA_ORTHOGRAPHIC ]) - Raylib.SetCameraMode(camera, Int(Raylib.CAMERA_FIRST_PERSON)) - camera = Raylib.UpdateCamera(camera) + camera = Raylib.UpdateCamera(camera, Raylib.CAMERA_FIRST_PERSON) @test !test_camera(camera, [ Raylib.rayvector(1, 2, 3), Raylib.rayvector(3, 2, 1), From d3968d8e5611a801a69505c0d9cccc53bc5a5485 Mon Sep 17 00:00:00 2001 From: Steve Murphy Date: Wed, 19 Aug 2026 11:28:15 -0600 Subject: [PATCH 2/6] Fix LoadFileData/LoadFontData for raylib 6.0 signature changes LoadFileData's out-param changed from unsigned int* to int*; RayFileData was still passing a Ref{Cuint}. LoadFontData gained a new trailing int* glyphCount out-param; the font_sdf example was still calling it with the old 6-arg form. Both found while auditing the remaining changed-signature functions from the 4.0->6.0 diff for real usages. Co-Authored-By: Claude Sonnet 5 --- examples/text/font_sdf.jl | 3 ++- src/core.jl | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/text/font_sdf.jl b/examples/text/font_sdf.jl index 37d4851..731ad23 100644 --- a/examples/text/font_sdf.jl +++ b/examples/text/font_sdf.jl @@ -4,7 +4,8 @@ const GLSL_VERSION = 330 function build_font(filedata, baseSize, glyphCount, fonttype, padding, packmeth) null = convert(Ptr{Cint}, C_NULL) - glyphs_ptr = Raylib.LoadFontData(pointer(filedata), length(filedata), 16, null, glyphCount, Int(fonttype)) + outGlyphCount = Ref{Cint}(0) # raylib 6.0 added this trailing output param + glyphs_ptr = Raylib.LoadFontData(pointer(filedata), length(filedata), 16, null, glyphCount, Int(fonttype), outGlyphCount) recs = Ref{Ptr{Raylib.RayRectangle}}() atlas = Raylib.GenImageFontAtlas(glyphs_ptr, recs, 95, 16, padding, packmeth) recs_ptr = recs[] diff --git a/src/core.jl b/src/core.jl index c1597fe..90a2367 100644 --- a/src/core.jl +++ b/src/core.jl @@ -43,7 +43,7 @@ struct RayFileData data::Vector{UInt8} function RayFileData(filename::AbstractString) - bytes = Ref{Cuint}(0) + bytes = Ref{Cint}(0) dptr = LoadFileData(filename, bytes) fdata = Base.unsafe_wrap(Vector{UInt8}, dptr, bytes[]) finalizer(fdata) do x From 86c6b7e6321ff758678affa55889fe0a466617c4 Mon Sep 17 00:00:00 2001 From: Steve Murphy Date: Wed, 19 Aug 2026 11:37:03 -0600 Subject: [PATCH 3/6] Drop physac support Confirmed via `nm -D` on the actual Raylib_jll 6.0.1 libraylib.so that zero physac symbols exist in the compiled library (unlike raygui, whose functions are all still present and resolve). Every physac-bound function was therefore binding successfully at load time but would throw at the first real call, since dlsym has nothing to find - dead weight, not just stale bindings. Removes physac_api.xml, the PhysicsShapeType enum, and the RayPhysics{VertexData,Shape,BodyData,ManifoldData} structs and their typemap_dict entries. Nothing else in the repo referenced any of this. Co-Authored-By: Claude Sonnet 5 --- api_reference/physac_api.xml | 131 ----------------------------------- src/binding/binding.jl | 12 +--- src/binding/enum.jl | 5 -- src/binding/struct.jl | 52 -------------- 4 files changed, 3 insertions(+), 197 deletions(-) delete mode 100644 api_reference/physac_api.xml diff --git a/api_reference/physac_api.xml b/api_reference/physac_api.xml deleted file mode 100644 index 1de6399..0000000 --- a/api_reference/physac_api.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/binding/binding.jl b/src/binding/binding.jl index 6f55c69..400a835 100644 --- a/src/binding/binding.jl +++ b/src/binding/binding.jl @@ -10,7 +10,7 @@ import ..Raylib: RayColor, RayVector2, RayVector3, RayVector4, RayQuaternion, map( f->include_dependency(joinpath(@__DIR__, "../../api_reference/", f)), - ("raylib_api.xml", "raygui_api.xml", "raymath_api.xml", "physac_api.xml") + ("raylib_api.xml", "raygui_api.xml", "raymath_api.xml") ) include("./enum.jl") @@ -175,11 +175,6 @@ let "Vector4" => (:RayVector4, :(StaticVector{4})), "Quaternion" => (:RayVector4, :(StaticVector{4})), "GuiStyleProp" => :RayGuiStyleProp, - "PhysicsShapeType" => :PhysicsShapeType, - "PhysicsVertexData" => :RayPhysicsVertexData, - "PhysicsShape" => :RayPhysicsShape, - "PhysicsBodyData" => :RayPhysicsBodyData, - "PhysicsBody" => :(Ptr{RayPhysicsBodyData}), ) maybe(f, x) = f(x) @@ -403,8 +398,7 @@ let apis = map( f->joinpath(@__DIR__, "../../api_reference/", f), - ("raylib_api.xml", "raygui_api.xml", - "raymath_api.xml", "physac_api.xml") + ("raylib_api.xml", "raygui_api.xml", "raymath_api.xml") ) xmls = Dict( @@ -423,7 +417,7 @@ let gen(gen_struct, lib, :Struct, defs, s->Symbol("Ray$s"), 2) - if lib == "raylib" || lib == "physac" + if lib == "raylib" gen(gen_func, lib, :Function, defs) else gen(Base.Fix2(gen_func, false), lib, :Function, defs) diff --git a/src/binding/enum.jl b/src/binding/enum.jl index b14ebe4..8a8daab 100644 --- a/src/binding/enum.jl +++ b/src/binding/enum.jl @@ -365,8 +365,3 @@ end NPATCH_THREE_PATCH_VERTICAL # Npatch layout: 1x3 tiles NPATCH_THREE_PATCH_HORIZONTAL # Npatch layout: 3x1 tiles end - -@cenum PhysicsShapeType begin - PHYSICS_CIRCLE = 0 - PHYSICS_POLYGON -end diff --git a/src/binding/struct.jl b/src/binding/struct.jl index 97ea8ef..cbae4ea 100644 --- a/src/binding/struct.jl +++ b/src/binding/struct.jl @@ -242,55 +242,3 @@ struct RayGuiStyleProp propertyId::Cushort propertyValue::Cint end - -const PHYSAC_MAX_VERTICES = 24 - -struct RayPhysicsVertexData - vertexCount::Cuint # Vertex count (positions and normals) - positions::NTuple{PHYSAC_MAX_VERTICES, RayVector2} # Vertex positions vectors - normals::NTuple{PHYSAC_MAX_VERTICES, RayVector2} # Vertex normals vectors -end - -struct RayPhysicsShape - type::PhysicsShapeType # Shape type (circle or polygon) - # body::Ptr{RayPhysicsBodyData} - body::Ptr{Cvoid} # Shape physics body data pointer - vertexData::RayPhysicsVertexData # Shape vertices data (used for polygon shapes) - radius::Cfloat # Shape radius (used for circle shapes) - transform::RayMatrix2x2 # Vertices transform matrix 2x2 -end - -struct RayPhysicsBodyData - id::Cuint # Unique identifier - enabled::Bool # Enabled dynamics state (collisions are calculated anyway) - position::RayVector2 # Physics body shape pivot - velocity::RayVector2 # Current linear velocity applied to position - force::RayVector2 # Current linear force (reset to 0 every step) - angularVelocity::Cfloat # Current angular velocity applied to orient - torque::Cfloat # Current angular force (reset to 0 every step) - orient::Cfloat # Rotation in radians - inertia::Cfloat # Moment of inertia - inverseInertia::Cfloat # Inverse value of inertia - mass::Cfloat # Physics body mass - inverseMass::Cfloat # Inverse value of mass - staticFriction::Cfloat # Friction when the body has not movement (0 to 1) - dynamicFriction::Cfloat # Friction when the body has movement (0 to 1) - restitution::Cfloat # Restitution coefficient of the body (0 to 1) - useGravity::Bool # Apply gravity force to dynamics - isGrounded::Bool # Physics grounded on other body state - freezeOrient::Bool # Physics rotation constraint - shape::RayPhysicsShape # Physics body shape information (type, radius, vertices, transform) -end - -struct RayPhysicsManifoldData - id::Cuint # Unique identifier - bodyA::Ptr{RayPhysicsBodyData} # Manifold first physics body reference - bodyB::Ptr{RayPhysicsBodyData} # Manifold second physics body reference - penetration::Cfloat # Depth of penetration from collision - normal::RayVector2 # Normal direction vector from 'a' to 'b' - contacts::NTuple{2, RayVector2} # Points of contact during collision - contactsCount::Cuint # Current collision number of contacts - restitution::Cfloat # Mixed restitution during collision - dynamicFriction::Cfloat # Mixed dynamic friction during collision - staticFriction::Cfloat # Mixed static friction during collision -end From 80c4c4fc1bcd48b734f70fb7f50b404915f6f5e8 Mon Sep 17 00:00:00 2001 From: Steve Murphy Date: Wed, 19 Aug 2026 12:25:54 -0600 Subject: [PATCH 4/6] Point README architecture diagram at raylib 6.0 raylib.com publishes an official, current architecture diagram at the same path pattern for 6.0 (confirmed genuinely different from the 4.0 image, not a fallback) - use that instead of the stale 4.0 one. Co-Authored-By: Claude Sonnet 5 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ce8ae24..ebc6fe0 100644 --- a/README.md +++ b/README.md @@ -9,4 +9,4 @@ This project is a wrapping of [Raylib](https://www.raylib.com/), which is a simp ## Raylib architecture -![](https://www.raylib.com/images/raylib_architecture_v4.0.png) +![](https://www.raylib.com/images/raylib_architecture_v6.0.png) From fd6af5b0fcca060030ed2878ee06fb5c44a151f6 Mon Sep 17 00:00:00 2001 From: Steve Murphy Date: Wed, 19 Aug 2026 15:17:28 -0600 Subject: [PATCH 5/6] Exempt bindings.md from Documenter's page-size cap raylib 6.0 has ~600 functions (up from ~487 in 4.0), pushing the @autodocs-generated bindings.md page to ~780KiB - past Documenter 1.17's default 200KiB hard size_threshold, which fails the build outright (not just a warning). Verified: docs build failed before this change and succeeds after, confirmed against real Documenter 1.17.0 and Julia 1.12. Also confirmed while investigating: the package still resolves and its full test suite still passes on Julia 1.6 (Project.toml's declared compat floor), tested directly rather than assumed. Co-Authored-By: Claude Sonnet 5 --- docs/make.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/make.jl b/docs/make.jl index 44350a5..6762a46 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -12,6 +12,9 @@ makedocs(; prettyurls=get(ENV, "CI", "false") == "true", canonical="https://chengchingwen.github.io/Raylib.jl", assets=String[], + # raylib 6.0 has ~600 functions (up from ~487 in 4.0), pushing the @autodocs + # page well past Documenter's default 200KiB hard cap. + size_threshold_ignore=["bindings.md"], ), pages=[ "Home" => "index.md", From 6ec2dc905c4e35b7bc3304e4e8e30ac2c84905a3 Mon Sep 17 00:00:00 2001 From: Steve Murphy Date: Thu, 20 Aug 2026 07:57:32 -0600 Subject: [PATCH 6/6] Add rlgl.h bindings Generates api_reference/rlgl_api.xml (163 functions, 11 enums) from raylib 6.0's rlgl.h via the same rlparser tool used for raylib_api.xml/ raymath_api.xml, and wires it into binding.jl's parser. Hand-writes RayrlVertexBuffer/RayrlDrawCall/RayrlRenderBatch (matching the existing pattern for ABI-sensitive structs) so the 3 render-batch-management functions bind too - every other rlgl type was already covered by the existing typemap_dict (Matrix, bool, plain numerics, pointers). Primary motivation: exposes rlSetClipPlanes, previously unreachable from Julia on any raylib version since this generator never parsed rlgl.h at all. Found and fixed a real latent bug in binding.jl's own custom mini-XML-parser along the way: it treated every '<'/'>' character as tag-structural even inside quoted attribute text. This never mattered for raylib.h/raygui.h/raymath.h (none of their descriptions happen to contain a literal '<'/'>'), but rlgl.h's comments do (e.g. "Update->Draw->Reset"), which corrupted the parser's tag-boundary stack and crashed the whole package load. Fixed by tracking quoted-string state explicitly and gating the '<'/'>' handling on it. Verified: all 163 functions + 11 enums bind (174 rl-prefixed symbols, exact match, no silent gaps); existing test suite still passes 7/7 (parser fix doesn't affect the other 3 XML files); rlSetClipPlanes called successfully inside a real BeginMode3D block in an actual GPU-accelerated window, not just isdefined-checked. Co-Authored-By: Claude Sonnet 5 --- api_reference/rlgl_api.xml | 1031 ++++++++++++++++++++++++++++++++++++ src/binding/binding.jl | 18 +- src/binding/struct.jl | 30 ++ 3 files changed, 1074 insertions(+), 5 deletions(-) create mode 100644 api_reference/rlgl_api.xml diff --git a/api_reference/rlgl_api.xml b/api_reference/rlgl_api.xml new file mode 100644 index 0000000..bffd74b --- /dev/null +++ b/api_reference/rlgl_api.xml @@ -0,0 +1,1031 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/binding/binding.jl b/src/binding/binding.jl index 400a835..e2b8741 100644 --- a/src/binding/binding.jl +++ b/src/binding/binding.jl @@ -10,7 +10,7 @@ import ..Raylib: RayColor, RayVector2, RayVector3, RayVector4, RayQuaternion, map( f->include_dependency(joinpath(@__DIR__, "../../api_reference/", f)), - ("raylib_api.xml", "raygui_api.xml", "raymath_api.xml") + ("raylib_api.xml", "raygui_api.xml", "raymath_api.xml", "rlgl_api.xml") ) include("./enum.jl") @@ -31,17 +31,22 @@ let idx = 0 push_c = false + in_string = false # tracks whether we're inside a quoted attribute value, so a + # literal '<'/'>' there (e.g. rlgl.h's "Update->Draw->Reset" in a desc="...") isn't + # mistaken for real tag structure - the comment above already says the intent was to + # avoid stacking in strings, but nothing previously enforced it for '<'/'>' itself. while !eof(io) idx += 1 c = read(io, Char) push!(char_stream, c) if c == '"' # avoid stacking in string + in_string = !in_string char_stream[last(stack)] == '"' ? pop!(stack) : push!(stack, idx) - elseif c == '<' # mark start position + elseif c == '<' && !in_string # mark start position push_c = true push!(stack, idx) - elseif c == '>' + elseif c == '>' && !in_string push_c = false pidx = pop!(stack) content = String(@view(char_stream[pidx:idx])) @@ -175,6 +180,9 @@ let "Vector4" => (:RayVector4, :(StaticVector{4})), "Quaternion" => (:RayVector4, :(StaticVector{4})), "GuiStyleProp" => :RayGuiStyleProp, + "rlVertexBuffer" => :RayrlVertexBuffer, + "rlDrawCall" => :RayrlDrawCall, + "rlRenderBatch" => :RayrlRenderBatch, ) maybe(f, x) = f(x) @@ -398,7 +406,7 @@ let apis = map( f->joinpath(@__DIR__, "../../api_reference/", f), - ("raylib_api.xml", "raygui_api.xml", "raymath_api.xml") + ("raylib_api.xml", "raygui_api.xml", "raymath_api.xml", "rlgl_api.xml") ) xmls = Dict( @@ -417,7 +425,7 @@ let gen(gen_struct, lib, :Struct, defs, s->Symbol("Ray$s"), 2) - if lib == "raylib" + if lib == "raylib" || lib == "rlgl" gen(gen_func, lib, :Function, defs) else gen(Base.Fix2(gen_func, false), lib, :Function, defs) diff --git a/src/binding/struct.jl b/src/binding/struct.jl index cbae4ea..c85e447 100644 --- a/src/binding/struct.jl +++ b/src/binding/struct.jl @@ -242,3 +242,33 @@ struct RayGuiStyleProp propertyId::Cushort propertyValue::Cint end + +struct RayrlVertexBuffer + elementCount::Cint # Number of elements in the buffer (QUADS) + + vertices::Ptr{Cfloat} # Vertex position (XYZ - 3 components per vertex) + texcoords::Ptr{Cfloat} # Vertex texture coordinates (UV - 2 components per vertex) + normals::Ptr{Cfloat} # Vertex normal (XYZ - 3 components per vertex) + colors::Ptr{Cuchar} # Vertex colors (RGBA - 4 components per vertex) + indices::Ptr{Cuint} # Vertex indices (desktop GL: unsigned int; GL ES2 uses unsigned short instead) + + vaoId::Cuint # OpenGL Vertex Array Object id + vboId::NTuple{5, Cuint} # OpenGL Vertex Buffer Objects id (5 types of vertex data) +end + +struct RayrlDrawCall + mode::Cint # Drawing mode: LINES, TRIANGLES, QUADS + vertexCount::Cint # Number of vertex of the draw + vertexAlignment::Cint # Number of vertex required for index alignment (LINES, TRIANGLES) + textureId::Cuint # Texture id to be used on the draw +end + +struct RayrlRenderBatch + bufferCount::Cint # Number of vertex buffers (multi-buffering support) + currentBuffer::Cint # Current buffer tracking in case of multi-buffering + vertexBuffer::Ptr{RayrlVertexBuffer} # Dynamic buffer(s) for vertex data + + draws::Ptr{RayrlDrawCall} # Draw calls array, depends on textureId + drawCounter::Cint # Draw calls counter + currentDepth::Cfloat # Current depth value for next draw +end