apply review suggestions

This commit is contained in:
iacore 2024-01-29 08:25:02 +00:00
parent 99b1119adb
commit 1ca51fe8aa
No known key found for this signature in database
GPG Key ID: F8C16E5157A63006
6 changed files with 52 additions and 78 deletions

View File

@ -1,10 +1,10 @@
.{ .{
.name = "raylib-zig", .name = "raylib-zig",
.version = "0.1.0", .version = "0.1.1",
.dependencies = .{ .dependencies = .{
.raylib = .{ .raylib = .{
.url = "https://github.com/raysan5/raylib/archive/36df9c5bd6999d5a047cf94097f258a27aaafc52.tar.gz", .url = "https://github.com/raysan5/raylib/archive/5.0.tar.gz",
.hash = "122077f81f0c905e41bd46a4e2487dfeeaf9419e857e86329ad71e2a58e65ec6d93e", .hash = "1220c28847ca8e8756734ae84355802b764c9d9cf4de057dbc6fc2b15c56e726f27b",
}, },
}, },
.paths = .{""}, .paths = .{""},

View File

@ -1,7 +1,6 @@
// raylib-zig (c) Nikolas Wipper 2023 // raylib-zig (c) Nikolas Wipper 2023
const rl = @This(); const rl = @This();
const rlm = @import("raylib-zig-math.zig");
const std = @import("std"); const std = @import("std");
pub const RaylibError = error{GenericError}; pub const RaylibError = error{GenericError};

View File

@ -147,7 +147,7 @@ pub extern "c" fn DecompressData(compData: [*c]const u8, compDataSize: c_int, da
pub extern "c" fn EncodeDataBase64(data: [*c]const u8, dataSize: c_int, outputSize: [*c]c_int) [*c]u8; pub extern "c" fn EncodeDataBase64(data: [*c]const u8, dataSize: c_int, outputSize: [*c]c_int) [*c]u8;
pub extern "c" fn DecodeDataBase64(data: [*c]const u8, outputSize: [*c]c_int) [*c]u8; pub extern "c" fn DecodeDataBase64(data: [*c]const u8, outputSize: [*c]c_int) [*c]u8;
pub extern "c" fn LoadAutomationEventList(fileName: [*c]const u8) rl.AutomationEventList; pub extern "c" fn LoadAutomationEventList(fileName: [*c]const u8) rl.AutomationEventList;
pub extern "c" fn UnloadAutomationEventList(list: rl.AutomationEventList) void; pub extern "c" fn UnloadAutomationEventList(list: [*c]rl.AutomationEventList) void;
pub extern "c" fn ExportAutomationEventList(list: rl.AutomationEventList, fileName: [*c]const u8) bool; pub extern "c" fn ExportAutomationEventList(list: rl.AutomationEventList, fileName: [*c]const u8) bool;
pub extern "c" fn SetAutomationEventList(list: [*c]rl.AutomationEventList) void; pub extern "c" fn SetAutomationEventList(list: [*c]rl.AutomationEventList) void;
pub extern "c" fn SetAutomationEventBaseFrame(frame: c_int) void; pub extern "c" fn SetAutomationEventBaseFrame(frame: c_int) void;
@ -207,7 +207,7 @@ pub extern "c" fn DrawPixelV(position: rl.Vector2, color: rl.Color) void;
pub extern "c" fn DrawLine(startPosX: c_int, startPosY: c_int, endPosX: c_int, endPosY: c_int, color: rl.Color) void; pub extern "c" fn DrawLine(startPosX: c_int, startPosY: c_int, endPosX: c_int, endPosY: c_int, color: rl.Color) void;
pub extern "c" fn DrawLineV(startPos: rl.Vector2, endPos: rl.Vector2, color: rl.Color) void; pub extern "c" fn DrawLineV(startPos: rl.Vector2, endPos: rl.Vector2, color: rl.Color) void;
pub extern "c" fn DrawLineEx(startPos: rl.Vector2, endPos: rl.Vector2, thick: f32, color: rl.Color) void; pub extern "c" fn DrawLineEx(startPos: rl.Vector2, endPos: rl.Vector2, thick: f32, color: rl.Color) void;
pub extern "c" fn DrawLineStrip(points: [*c]const rl.Vector2, pointCount: c_int, color: rl.Color) void; pub extern "c" fn DrawLineStrip(points: [*c]rl.Vector2, pointCount: c_int, color: rl.Color) void;
pub extern "c" fn DrawLineBezier(startPos: rl.Vector2, endPos: rl.Vector2, thick: f32, color: rl.Color) void; pub extern "c" fn DrawLineBezier(startPos: rl.Vector2, endPos: rl.Vector2, thick: f32, color: rl.Color) void;
pub extern "c" fn DrawCircle(centerX: c_int, centerY: c_int, radius: f32, color: rl.Color) void; pub extern "c" fn DrawCircle(centerX: c_int, centerY: c_int, radius: f32, color: rl.Color) void;
pub extern "c" fn DrawCircleSector(center: rl.Vector2, radius: f32, startAngle: f32, endAngle: f32, segments: c_int, color: rl.Color) void; pub extern "c" fn DrawCircleSector(center: rl.Vector2, radius: f32, startAngle: f32, endAngle: f32, segments: c_int, color: rl.Color) void;
@ -233,16 +233,16 @@ pub extern "c" fn DrawRectangleRounded(rec: rl.Rectangle, roundness: f32, segmen
pub extern "c" fn DrawRectangleRoundedLines(rec: rl.Rectangle, roundness: f32, segments: c_int, lineThick: f32, color: rl.Color) void; pub extern "c" fn DrawRectangleRoundedLines(rec: rl.Rectangle, roundness: f32, segments: c_int, lineThick: f32, color: rl.Color) void;
pub extern "c" fn DrawTriangle(v1: rl.Vector2, v2: rl.Vector2, v3: rl.Vector2, color: rl.Color) void; pub extern "c" fn DrawTriangle(v1: rl.Vector2, v2: rl.Vector2, v3: rl.Vector2, color: rl.Color) void;
pub extern "c" fn DrawTriangleLines(v1: rl.Vector2, v2: rl.Vector2, v3: rl.Vector2, color: rl.Color) void; pub extern "c" fn DrawTriangleLines(v1: rl.Vector2, v2: rl.Vector2, v3: rl.Vector2, color: rl.Color) void;
pub extern "c" fn DrawTriangleFan(points: [*c]const rl.Vector2, pointCount: c_int, color: rl.Color) void; pub extern "c" fn DrawTriangleFan(points: [*c]rl.Vector2, pointCount: c_int, color: rl.Color) void;
pub extern "c" fn DrawTriangleStrip(points: [*c]const rl.Vector2, pointCount: c_int, color: rl.Color) void; pub extern "c" fn DrawTriangleStrip(points: [*c]rl.Vector2, pointCount: c_int, color: rl.Color) void;
pub extern "c" fn DrawPoly(center: rl.Vector2, sides: c_int, radius: f32, rotation: f32, color: rl.Color) void; pub extern "c" fn DrawPoly(center: rl.Vector2, sides: c_int, radius: f32, rotation: f32, color: rl.Color) void;
pub extern "c" fn DrawPolyLines(center: rl.Vector2, sides: c_int, radius: f32, rotation: f32, color: rl.Color) void; pub extern "c" fn DrawPolyLines(center: rl.Vector2, sides: c_int, radius: f32, rotation: f32, color: rl.Color) void;
pub extern "c" fn DrawPolyLinesEx(center: rl.Vector2, sides: c_int, radius: f32, rotation: f32, lineThick: f32, color: rl.Color) void; pub extern "c" fn DrawPolyLinesEx(center: rl.Vector2, sides: c_int, radius: f32, rotation: f32, lineThick: f32, color: rl.Color) void;
pub extern "c" fn DrawSplineLinear(points: [*c]const rl.Vector2, pointCount: c_int, thick: f32, color: rl.Color) void; pub extern "c" fn DrawSplineLinear(points: [*c]rl.Vector2, pointCount: c_int, thick: f32, color: rl.Color) void;
pub extern "c" fn DrawSplineBasis(points: [*c]const rl.Vector2, pointCount: c_int, thick: f32, color: rl.Color) void; pub extern "c" fn DrawSplineBasis(points: [*c]rl.Vector2, pointCount: c_int, thick: f32, color: rl.Color) void;
pub extern "c" fn DrawSplineCatmullRom(points: [*c]const rl.Vector2, pointCount: c_int, thick: f32, color: rl.Color) void; pub extern "c" fn DrawSplineCatmullRom(points: [*c]rl.Vector2, pointCount: c_int, thick: f32, color: rl.Color) void;
pub extern "c" fn DrawSplineBezierQuadratic(points: [*c]const rl.Vector2, pointCount: c_int, thick: f32, color: rl.Color) void; pub extern "c" fn DrawSplineBezierQuadratic(points: [*c]rl.Vector2, pointCount: c_int, thick: f32, color: rl.Color) void;
pub extern "c" fn DrawSplineBezierCubic(points: [*c]const rl.Vector2, pointCount: c_int, thick: f32, color: rl.Color) void; pub extern "c" fn DrawSplineBezierCubic(points: [*c]rl.Vector2, pointCount: c_int, thick: f32, color: rl.Color) void;
pub extern "c" fn DrawSplineSegmentLinear(p1: rl.Vector2, p2: rl.Vector2, thick: f32, color: rl.Color) void; pub extern "c" fn DrawSplineSegmentLinear(p1: rl.Vector2, p2: rl.Vector2, thick: f32, color: rl.Color) void;
pub extern "c" fn DrawSplineSegmentBasis(p1: rl.Vector2, p2: rl.Vector2, p3: rl.Vector2, p4: rl.Vector2, thick: f32, color: rl.Color) void; pub extern "c" fn DrawSplineSegmentBasis(p1: rl.Vector2, p2: rl.Vector2, p3: rl.Vector2, p4: rl.Vector2, thick: f32, color: rl.Color) void;
pub extern "c" fn DrawSplineSegmentCatmullRom(p1: rl.Vector2, p2: rl.Vector2, p3: rl.Vector2, p4: rl.Vector2, thick: f32, color: rl.Color) void; pub extern "c" fn DrawSplineSegmentCatmullRom(p1: rl.Vector2, p2: rl.Vector2, p3: rl.Vector2, p4: rl.Vector2, thick: f32, color: rl.Color) void;
@ -259,7 +259,7 @@ pub extern "c" fn CheckCollisionCircleRec(center: rl.Vector2, radius: f32, rec:
pub extern "c" fn CheckCollisionPointRec(point: rl.Vector2, rec: rl.Rectangle) bool; pub extern "c" fn CheckCollisionPointRec(point: rl.Vector2, rec: rl.Rectangle) bool;
pub extern "c" fn CheckCollisionPointCircle(point: rl.Vector2, center: rl.Vector2, radius: f32) bool; pub extern "c" fn CheckCollisionPointCircle(point: rl.Vector2, center: rl.Vector2, radius: f32) bool;
pub extern "c" fn CheckCollisionPointTriangle(point: rl.Vector2, p1: rl.Vector2, p2: rl.Vector2, p3: rl.Vector2) bool; pub extern "c" fn CheckCollisionPointTriangle(point: rl.Vector2, p1: rl.Vector2, p2: rl.Vector2, p3: rl.Vector2) bool;
pub extern "c" fn CheckCollisionPointPoly(point: rl.Vector2, points: [*c]const rl.Vector2, pointCount: c_int) bool; pub extern "c" fn CheckCollisionPointPoly(point: rl.Vector2, points: [*c]rl.Vector2, pointCount: c_int) bool;
pub extern "c" fn CheckCollisionLines(startPos1: rl.Vector2, endPos1: rl.Vector2, startPos2: rl.Vector2, endPos2: rl.Vector2, collisionPoint: [*c]rl.Vector2) bool; pub extern "c" fn CheckCollisionLines(startPos1: rl.Vector2, endPos1: rl.Vector2, startPos2: rl.Vector2, endPos2: rl.Vector2, collisionPoint: [*c]rl.Vector2) bool;
pub extern "c" fn CheckCollisionPointLine(point: rl.Vector2, p1: rl.Vector2, p2: rl.Vector2, threshold: c_int) bool; pub extern "c" fn CheckCollisionPointLine(point: rl.Vector2, p1: rl.Vector2, p2: rl.Vector2, threshold: c_int) bool;
pub extern "c" fn GetCollisionRec(rec1: rl.Rectangle, rec2: rl.Rectangle) rl.Rectangle; pub extern "c" fn GetCollisionRec(rec1: rl.Rectangle, rec2: rl.Rectangle) rl.Rectangle;
@ -296,7 +296,6 @@ pub extern "c" fn ImageAlphaClear(image: [*c]rl.Image, color: rl.Color, threshol
pub extern "c" fn ImageAlphaMask(image: [*c]rl.Image, alphaMask: rl.Image) void; pub extern "c" fn ImageAlphaMask(image: [*c]rl.Image, alphaMask: rl.Image) void;
pub extern "c" fn ImageAlphaPremultiply(image: [*c]rl.Image) void; pub extern "c" fn ImageAlphaPremultiply(image: [*c]rl.Image) void;
pub extern "c" fn ImageBlurGaussian(image: [*c]rl.Image, blurSize: c_int) void; pub extern "c" fn ImageBlurGaussian(image: [*c]rl.Image, blurSize: c_int) void;
pub extern "c" fn ImageKernelConvolution(image: [*c]rl.Image, kernel: [*c]f32, kernelSize: c_int) void;
pub extern "c" fn ImageResize(image: [*c]rl.Image, newWidth: c_int, newHeight: c_int) void; pub extern "c" fn ImageResize(image: [*c]rl.Image, newWidth: c_int, newHeight: c_int) void;
pub extern "c" fn ImageResizeNN(image: [*c]rl.Image, newWidth: c_int, newHeight: c_int) void; pub extern "c" fn ImageResizeNN(image: [*c]rl.Image, newWidth: c_int, newHeight: c_int) void;
pub extern "c" fn ImageResizeCanvas(image: [*c]rl.Image, newWidth: c_int, newHeight: c_int, offsetX: c_int, offsetY: c_int, fill: rl.Color) void; pub extern "c" fn ImageResizeCanvas(image: [*c]rl.Image, newWidth: c_int, newHeight: c_int, offsetX: c_int, offsetY: c_int, fill: rl.Color) void;
@ -416,12 +415,11 @@ pub extern "c" fn TextToUpper(text: [*c]const u8) [*c]const u8;
pub extern "c" fn TextToLower(text: [*c]const u8) [*c]const u8; pub extern "c" fn TextToLower(text: [*c]const u8) [*c]const u8;
pub extern "c" fn TextToPascal(text: [*c]const u8) [*c]const u8; pub extern "c" fn TextToPascal(text: [*c]const u8) [*c]const u8;
pub extern "c" fn TextToInteger(text: [*c]const u8) c_int; pub extern "c" fn TextToInteger(text: [*c]const u8) c_int;
pub extern "c" fn TextToFloat(text: [*c]const u8) f32;
pub extern "c" fn DrawLine3D(startPos: rl.Vector3, endPos: rl.Vector3, color: rl.Color) void; pub extern "c" fn DrawLine3D(startPos: rl.Vector3, endPos: rl.Vector3, color: rl.Color) void;
pub extern "c" fn DrawPoint3D(position: rl.Vector3, color: rl.Color) void; pub extern "c" fn DrawPoint3D(position: rl.Vector3, color: rl.Color) void;
pub extern "c" fn DrawCircle3D(center: rl.Vector3, radius: f32, rotationAxis: rl.Vector3, rotationAngle: f32, color: rl.Color) void; pub extern "c" fn DrawCircle3D(center: rl.Vector3, radius: f32, rotationAxis: rl.Vector3, rotationAngle: f32, color: rl.Color) void;
pub extern "c" fn DrawTriangle3D(v1: rl.Vector3, v2: rl.Vector3, v3: rl.Vector3, color: rl.Color) void; pub extern "c" fn DrawTriangle3D(v1: rl.Vector3, v2: rl.Vector3, v3: rl.Vector3, color: rl.Color) void;
pub extern "c" fn DrawTriangleStrip3D(points: [*c]const rl.Vector3, pointCount: c_int, color: rl.Color) void; pub extern "c" fn DrawTriangleStrip3D(points: [*c]rl.Vector3, pointCount: c_int, color: rl.Color) void;
pub extern "c" fn DrawCube(position: rl.Vector3, width: f32, height: f32, length: f32, color: rl.Color) void; pub extern "c" fn DrawCube(position: rl.Vector3, width: f32, height: f32, length: f32, color: rl.Color) void;
pub extern "c" fn DrawCubeV(position: rl.Vector3, size: rl.Vector3, color: rl.Color) void; pub extern "c" fn DrawCubeV(position: rl.Vector3, size: rl.Vector3, color: rl.Color) void;
pub extern "c" fn DrawCubeWires(position: rl.Vector3, width: f32, height: f32, length: f32, color: rl.Color) void; pub extern "c" fn DrawCubeWires(position: rl.Vector3, width: f32, height: f32, length: f32, color: rl.Color) void;
@ -456,10 +454,9 @@ pub extern "c" fn UpdateMeshBuffer(mesh: rl.Mesh, index: c_int, data: *const any
pub extern "c" fn UnloadMesh(mesh: rl.Mesh) void; pub extern "c" fn UnloadMesh(mesh: rl.Mesh) void;
pub extern "c" fn DrawMesh(mesh: rl.Mesh, material: rl.Material, transform: rl.Matrix) void; pub extern "c" fn DrawMesh(mesh: rl.Mesh, material: rl.Material, transform: rl.Matrix) void;
pub extern "c" fn DrawMeshInstanced(mesh: rl.Mesh, material: rl.Material, transforms: [*c]const rl.Matrix, instances: c_int) void; pub extern "c" fn DrawMeshInstanced(mesh: rl.Mesh, material: rl.Material, transforms: [*c]const rl.Matrix, instances: c_int) void;
pub extern "c" fn ExportMesh(mesh: rl.Mesh, fileName: [*c]const u8) bool;
pub extern "c" fn GetMeshBoundingBox(mesh: rl.Mesh) rl.BoundingBox; pub extern "c" fn GetMeshBoundingBox(mesh: rl.Mesh) rl.BoundingBox;
pub extern "c" fn GenMeshTangents(mesh: [*c]rl.Mesh) void; pub extern "c" fn GenMeshTangents(mesh: [*c]rl.Mesh) void;
pub extern "c" fn ExportMesh(mesh: rl.Mesh, fileName: [*c]const u8) bool;
pub extern "c" fn ExportMeshAsCode(mesh: rl.Mesh, fileName: [*c]const u8) bool;
pub extern "c" fn GenMeshPoly(sides: c_int, radius: f32) rl.Mesh; pub extern "c" fn GenMeshPoly(sides: c_int, radius: f32) rl.Mesh;
pub extern "c" fn GenMeshPlane(width: f32, length: f32, resX: c_int, resZ: c_int) rl.Mesh; pub extern "c" fn GenMeshPlane(width: f32, length: f32, resX: c_int, resZ: c_int) rl.Mesh;
pub extern "c" fn GenMeshCube(width: f32, height: f32, length: f32) rl.Mesh; pub extern "c" fn GenMeshCube(width: f32, height: f32, length: f32) rl.Mesh;

View File

@ -1,7 +1,6 @@
// raylib-zig (c) Nikolas Wipper 2023 // raylib-zig (c) Nikolas Wipper 2023
const rl = @This(); const rl = @This();
const rlm = @import("raylib-zig-math.zig");
const std = @import("std"); const std = @import("std");
pub const RaylibError = error{GenericError}; pub const RaylibError = error{GenericError};
@ -1964,8 +1963,8 @@ pub fn loadAutomationEventList(fileName: [:0]const u8) AutomationEventList {
return cdef.LoadAutomationEventList(@as([*c]const u8, @ptrCast(fileName))); return cdef.LoadAutomationEventList(@as([*c]const u8, @ptrCast(fileName)));
} }
pub fn unloadAutomationEventList(list: AutomationEventList) void { pub fn unloadAutomationEventList(list: *AutomationEventList) void {
cdef.UnloadAutomationEventList(list); cdef.UnloadAutomationEventList(@as([*c]AutomationEventList, @ptrCast(list)));
} }
pub fn exportAutomationEventList(list: AutomationEventList, fileName: [:0]const u8) bool { pub fn exportAutomationEventList(list: AutomationEventList, fileName: [:0]const u8) bool {
@ -2316,24 +2315,24 @@ pub fn drawPolyLinesEx(center: Vector2, sides: i32, radius: f32, rotation: f32,
cdef.DrawPolyLinesEx(center, @as(c_int, sides), radius, rotation, lineThick, color); cdef.DrawPolyLinesEx(center, @as(c_int, sides), radius, rotation, lineThick, color);
} }
pub fn drawSplineLinear(points: []const Vector2, pointCount: i32, thick: f32, color: Color) void { pub fn drawSplineLinear(points: []Vector2, pointCount: i32, thick: f32, color: Color) void {
cdef.DrawSplineLinear(@as([*c]const Vector2, @ptrCast(points)), @as(c_int, pointCount), thick, color); cdef.DrawSplineLinear(@as([*c]Vector2, @ptrCast(points)), @as(c_int, pointCount), thick, color);
} }
pub fn drawSplineBasis(points: []const Vector2, pointCount: i32, thick: f32, color: Color) void { pub fn drawSplineBasis(points: []Vector2, pointCount: i32, thick: f32, color: Color) void {
cdef.DrawSplineBasis(@as([*c]const Vector2, @ptrCast(points)), @as(c_int, pointCount), thick, color); cdef.DrawSplineBasis(@as([*c]Vector2, @ptrCast(points)), @as(c_int, pointCount), thick, color);
} }
pub fn drawSplineCatmullRom(points: []const Vector2, pointCount: i32, thick: f32, color: Color) void { pub fn drawSplineCatmullRom(points: []Vector2, pointCount: i32, thick: f32, color: Color) void {
cdef.DrawSplineCatmullRom(@as([*c]const Vector2, @ptrCast(points)), @as(c_int, pointCount), thick, color); cdef.DrawSplineCatmullRom(@as([*c]Vector2, @ptrCast(points)), @as(c_int, pointCount), thick, color);
} }
pub fn drawSplineBezierQuadratic(points: []const Vector2, pointCount: i32, thick: f32, color: Color) void { pub fn drawSplineBezierQuadratic(points: []Vector2, pointCount: i32, thick: f32, color: Color) void {
cdef.DrawSplineBezierQuadratic(@as([*c]const Vector2, @ptrCast(points)), @as(c_int, pointCount), thick, color); cdef.DrawSplineBezierQuadratic(@as([*c]Vector2, @ptrCast(points)), @as(c_int, pointCount), thick, color);
} }
pub fn drawSplineBezierCubic(points: []const Vector2, pointCount: i32, thick: f32, color: Color) void { pub fn drawSplineBezierCubic(points: []Vector2, pointCount: i32, thick: f32, color: Color) void {
cdef.DrawSplineBezierCubic(@as([*c]const Vector2, @ptrCast(points)), @as(c_int, pointCount), thick, color); cdef.DrawSplineBezierCubic(@as([*c]Vector2, @ptrCast(points)), @as(c_int, pointCount), thick, color);
} }
pub fn drawSplineSegmentLinear(p1: Vector2, p2: Vector2, thick: f32, color: Color) void { pub fn drawSplineSegmentLinear(p1: Vector2, p2: Vector2, thick: f32, color: Color) void {
@ -2540,10 +2539,6 @@ pub fn imageBlurGaussian(image: *Image, blurSize: i32) void {
cdef.ImageBlurGaussian(@as([*c]Image, @ptrCast(image)), @as(c_int, blurSize)); cdef.ImageBlurGaussian(@as([*c]Image, @ptrCast(image)), @as(c_int, blurSize));
} }
pub fn imageKernelConvolution(image: *Image, kernel: []f32, kernelSize: i32) void {
cdef.ImageKernelConvolution(@as([*c]Image, @ptrCast(image)), @as([*c]f32, @ptrCast(kernel)), @as(c_int, kernelSize));
}
pub fn imageResize(image: *Image, newWidth: i32, newHeight: i32) void { pub fn imageResize(image: *Image, newWidth: i32, newHeight: i32) void {
cdef.ImageResize(@as([*c]Image, @ptrCast(image)), @as(c_int, newWidth), @as(c_int, newHeight)); cdef.ImageResize(@as([*c]Image, @ptrCast(image)), @as(c_int, newWidth), @as(c_int, newHeight));
} }
@ -2968,10 +2963,6 @@ pub fn textToInteger(text: [:0]const u8) i32 {
return @as(i32, cdef.TextToInteger(@as([*c]const u8, @ptrCast(text)))); return @as(i32, cdef.TextToInteger(@as([*c]const u8, @ptrCast(text))));
} }
pub fn textToFloat(text: [:0]const u8) f32 {
return cdef.TextToFloat(@as([*c]const u8, @ptrCast(text)));
}
pub fn drawLine3D(startPos: Vector3, endPos: Vector3, color: Color) void { pub fn drawLine3D(startPos: Vector3, endPos: Vector3, color: Color) void {
cdef.DrawLine3D(startPos, endPos, color); cdef.DrawLine3D(startPos, endPos, color);
} }
@ -3120,6 +3111,10 @@ pub fn drawMesh(mesh: Mesh, material: Material, transform: Matrix) void {
cdef.DrawMesh(mesh, material, transform); cdef.DrawMesh(mesh, material, transform);
} }
pub fn exportMesh(mesh: Mesh, fileName: [:0]const u8) bool {
return cdef.ExportMesh(mesh, @as([*c]const u8, @ptrCast(fileName)));
}
pub fn getMeshBoundingBox(mesh: Mesh) BoundingBox { pub fn getMeshBoundingBox(mesh: Mesh) BoundingBox {
return cdef.GetMeshBoundingBox(mesh); return cdef.GetMeshBoundingBox(mesh);
} }
@ -3128,14 +3123,6 @@ pub fn genMeshTangents(mesh: *Mesh) void {
cdef.GenMeshTangents(@as([*c]Mesh, @ptrCast(mesh))); cdef.GenMeshTangents(@as([*c]Mesh, @ptrCast(mesh)));
} }
pub fn exportMesh(mesh: Mesh, fileName: [:0]const u8) bool {
return cdef.ExportMesh(mesh, @as([*c]const u8, @ptrCast(fileName)));
}
pub fn exportMeshAsCode(mesh: Mesh, fileName: [:0]const u8) bool {
return cdef.ExportMeshAsCode(mesh, @as([*c]const u8, @ptrCast(fileName)));
}
pub fn genMeshPoly(sides: i32, radius: f32) Mesh { pub fn genMeshPoly(sides: i32, radius: f32) Mesh {
return cdef.GenMeshPoly(@as(c_int, sides), radius); return cdef.GenMeshPoly(@as(c_int, sides), radius);
} }

View File

@ -1,6 +1,6 @@
/********************************************************************************************** /**********************************************************************************************
* *
* raylib v5.1-dev - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com) * raylib v5.0 - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)
* *
* FEATURES: * FEATURES:
* - NO external dependencies, all required libraries included with raylib * - NO external dependencies, all required libraries included with raylib
@ -82,26 +82,21 @@
#include <stdarg.h> // Required for: va_list - Only used by TraceLogCallback #include <stdarg.h> // Required for: va_list - Only used by TraceLogCallback
#define RAYLIB_VERSION_MAJOR 5 #define RAYLIB_VERSION_MAJOR 5
#define RAYLIB_VERSION_MINOR 1 #define RAYLIB_VERSION_MINOR 0
#define RAYLIB_VERSION_PATCH 0 #define RAYLIB_VERSION_PATCH 0
#define RAYLIB_VERSION "5.1-dev" #define RAYLIB_VERSION "5.0"
// Function specifiers in case library is build/used as a shared library // Function specifiers in case library is build/used as a shared library (Windows)
// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll // NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll
// NOTE: visibility("default") attribute makes symbols "visible" when compiled with -fvisibility=hidden
#if defined(_WIN32) #if defined(_WIN32)
#if defined(__TINYC__)
#define __declspec(x) __attribute__((x))
#endif
#if defined(BUILD_LIBTYPE_SHARED) #if defined(BUILD_LIBTYPE_SHARED)
#if defined(__TINYC__)
#define __declspec(x) __attribute__((x))
#endif
#define RLAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll) #define RLAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll)
#elif defined(USE_LIBTYPE_SHARED) #elif defined(USE_LIBTYPE_SHARED)
#define RLAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll) #define RLAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll)
#endif #endif
#else
#if defined(BUILD_LIBTYPE_SHARED)
#define RLAPI __attribute__((visibility("default"))) // We are building as a Unix shared library (.so/.dylib)
#endif
#endif #endif
#ifndef RLAPI #ifndef RLAPI
@ -484,6 +479,7 @@ typedef struct VrDeviceInfo {
int vResolution; // Vertical resolution in pixels int vResolution; // Vertical resolution in pixels
float hScreenSize; // Horizontal size in meters float hScreenSize; // Horizontal size in meters
float vScreenSize; // Vertical size in meters float vScreenSize; // Vertical size in meters
float vScreenCenter; // Screen center in meters
float eyeToScreenDistance; // Distance between eye and display in meters float eyeToScreenDistance; // Distance between eye and display in meters
float lensSeparationDistance; // Lens separation distance in meters float lensSeparationDistance; // Lens separation distance in meters
float interpupillaryDistance; // IPD (distance between pupils) in meters float interpupillaryDistance; // IPD (distance between pupils) in meters
@ -1138,7 +1134,7 @@ RLAPI unsigned char *DecodeDataBase64(const unsigned char *data, int *outputSize
// Automation events functionality // Automation events functionality
RLAPI AutomationEventList LoadAutomationEventList(const char *fileName); // Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS RLAPI AutomationEventList LoadAutomationEventList(const char *fileName); // Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS
RLAPI void UnloadAutomationEventList(AutomationEventList list); // Unload automation events list from file RLAPI void UnloadAutomationEventList(AutomationEventList *list); // Unload automation events list from file
RLAPI bool ExportAutomationEventList(AutomationEventList list, const char *fileName); // Export automation events list as text file RLAPI bool ExportAutomationEventList(AutomationEventList list, const char *fileName); // Export automation events list as text file
RLAPI void SetAutomationEventList(AutomationEventList *list); // Set automation event list to record to RLAPI void SetAutomationEventList(AutomationEventList *list); // Set automation event list to record to
RLAPI void SetAutomationEventBaseFrame(int frame); // Set automation event internal base frame to start recording RLAPI void SetAutomationEventBaseFrame(int frame); // Set automation event internal base frame to start recording
@ -1227,7 +1223,7 @@ RLAPI void DrawPixelV(Vector2 position, Color color);
RLAPI void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line RLAPI void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line
RLAPI void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (using gl lines) RLAPI void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (using gl lines)
RLAPI void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line (using triangles/quads) RLAPI void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line (using triangles/quads)
RLAPI void DrawLineStrip(const Vector2 *points, int pointCount, Color color); // Draw lines sequence (using gl lines) RLAPI void DrawLineStrip(Vector2 *points, int pointCount, Color color); // Draw lines sequence (using gl lines)
RLAPI void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw line segment cubic-bezier in-out interpolation RLAPI void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw line segment cubic-bezier in-out interpolation
RLAPI void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle RLAPI void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle
RLAPI void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw a piece of a circle RLAPI void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw a piece of a circle
@ -1253,18 +1249,18 @@ RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Co
RLAPI void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, float lineThick, Color color); // Draw rectangle with rounded edges outline RLAPI void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, float lineThick, Color color); // Draw rectangle with rounded edges outline
RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!) RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline (vertex in counter-clockwise order!) RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline (vertex in counter-clockwise order!)
RLAPI void DrawTriangleFan(const Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points (first vertex is the center) RLAPI void DrawTriangleFan(Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points (first vertex is the center)
RLAPI void DrawTriangleStrip(const Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points RLAPI void DrawTriangleStrip(Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points
RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version) RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version)
RLAPI void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon outline of n sides RLAPI void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon outline of n sides
RLAPI void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, float lineThick, Color color); // Draw a polygon outline of n sides with extended parameters RLAPI void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, float lineThick, Color color); // Draw a polygon outline of n sides with extended parameters
// Splines drawing functions // Splines drawing functions
RLAPI void DrawSplineLinear(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Linear, minimum 2 points RLAPI void DrawSplineLinear(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Linear, minimum 2 points
RLAPI void DrawSplineBasis(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: B-Spline, minimum 4 points RLAPI void DrawSplineBasis(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: B-Spline, minimum 4 points
RLAPI void DrawSplineCatmullRom(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Catmull-Rom, minimum 4 points RLAPI void DrawSplineCatmullRom(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Catmull-Rom, minimum 4 points
RLAPI void DrawSplineBezierQuadratic(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...] RLAPI void DrawSplineBezierQuadratic(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]
RLAPI void DrawSplineBezierCubic(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...] RLAPI void DrawSplineBezierCubic(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]
RLAPI void DrawSplineSegmentLinear(Vector2 p1, Vector2 p2, float thick, Color color); // Draw spline segment: Linear, 2 points RLAPI void DrawSplineSegmentLinear(Vector2 p1, Vector2 p2, float thick, Color color); // Draw spline segment: Linear, 2 points
RLAPI void DrawSplineSegmentBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: B-Spline, 4 points RLAPI void DrawSplineSegmentBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: B-Spline, 4 points
RLAPI void DrawSplineSegmentCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: Catmull-Rom, 4 points RLAPI void DrawSplineSegmentCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: Catmull-Rom, 4 points
@ -1285,7 +1281,7 @@ RLAPI bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec);
RLAPI bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle RLAPI bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle
RLAPI bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); // Check if point is inside circle RLAPI bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); // Check if point is inside circle
RLAPI bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); // Check if point is inside a triangle RLAPI bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); // Check if point is inside a triangle
RLAPI bool CheckCollisionPointPoly(Vector2 point, const Vector2 *points, int pointCount); // Check if point is within a polygon described by array of vertices RLAPI bool CheckCollisionPointPoly(Vector2 point, Vector2 *points, int pointCount); // Check if point is within a polygon described by array of vertices
RLAPI bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint); // Check the collision between two lines defined by two points each, returns collision point by reference RLAPI bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint); // Check the collision between two lines defined by two points each, returns collision point by reference
RLAPI bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); // Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold] RLAPI bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); // Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
RLAPI Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); // Get collision rectangle for two rectangles collision RLAPI Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); // Get collision rectangle for two rectangles collision
@ -1333,7 +1329,6 @@ RLAPI void ImageAlphaClear(Image *image, Color color, float threshold);
RLAPI void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image RLAPI void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image
RLAPI void ImageAlphaPremultiply(Image *image); // Premultiply alpha channel RLAPI void ImageAlphaPremultiply(Image *image); // Premultiply alpha channel
RLAPI void ImageBlurGaussian(Image *image, int blurSize); // Apply Gaussian blur using a box blur approximation RLAPI void ImageBlurGaussian(Image *image, int blurSize); // Apply Gaussian blur using a box blur approximation
RLAPI void ImageKernelConvolution(Image *image, float* kernel, int kernelSize); // Apply Custom Square image convolution kernel
RLAPI void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (Bicubic scaling algorithm) RLAPI void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (Bicubic scaling algorithm)
RLAPI void ImageResizeNN(Image *image, int newWidth,int newHeight); // Resize image (Nearest-Neighbor scaling algorithm) RLAPI void ImageResizeNN(Image *image, int newWidth,int newHeight); // Resize image (Nearest-Neighbor scaling algorithm)
RLAPI void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); // Resize canvas and fill with color RLAPI void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); // Resize canvas and fill with color
@ -1480,7 +1475,6 @@ RLAPI const char *TextToUpper(const char *text); // Get upp
RLAPI const char *TextToLower(const char *text); // Get lower case version of provided string RLAPI const char *TextToLower(const char *text); // Get lower case version of provided string
RLAPI const char *TextToPascal(const char *text); // Get Pascal case notation version of provided string RLAPI const char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
RLAPI int TextToInteger(const char *text); // Get integer value from text (negative values not supported) RLAPI int TextToInteger(const char *text); // Get integer value from text (negative values not supported)
RLAPI float TextToFloat(const char *text); // Get float value from text (negative values not supported)
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Basic 3d Shapes Drawing Functions (Module: models) // Basic 3d Shapes Drawing Functions (Module: models)
@ -1491,7 +1485,7 @@ RLAPI void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color);
RLAPI void DrawPoint3D(Vector3 position, Color color); // Draw a point in 3D space, actually a small line RLAPI void DrawPoint3D(Vector3 position, Color color); // Draw a point in 3D space, actually a small line
RLAPI void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); // Draw a circle in 3D world space RLAPI void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); // Draw a circle in 3D world space
RLAPI void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!) RLAPI void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
RLAPI void DrawTriangleStrip3D(const Vector3 *points, int pointCount, Color color); // Draw a triangle strip defined by points RLAPI void DrawTriangleStrip3D(Vector3 *points, int pointCount, Color color); // Draw a triangle strip defined by points
RLAPI void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube RLAPI void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube
RLAPI void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version) RLAPI void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
RLAPI void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); // Draw cube wires RLAPI void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); // Draw cube wires
@ -1536,10 +1530,9 @@ RLAPI void UpdateMeshBuffer(Mesh mesh, int index, const void *data, int dataSize
RLAPI void UnloadMesh(Mesh mesh); // Unload mesh data from CPU and GPU RLAPI void UnloadMesh(Mesh mesh); // Unload mesh data from CPU and GPU
RLAPI void DrawMesh(Mesh mesh, Material material, Matrix transform); // Draw a 3d mesh with material and transform RLAPI void DrawMesh(Mesh mesh, Material material, Matrix transform); // Draw a 3d mesh with material and transform
RLAPI void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, int instances); // Draw multiple mesh instances with material and different transforms RLAPI void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, int instances); // Draw multiple mesh instances with material and different transforms
RLAPI bool ExportMesh(Mesh mesh, const char *fileName); // Export mesh data to file, returns true on success
RLAPI BoundingBox GetMeshBoundingBox(Mesh mesh); // Compute mesh bounding box limits RLAPI BoundingBox GetMeshBoundingBox(Mesh mesh); // Compute mesh bounding box limits
RLAPI void GenMeshTangents(Mesh *mesh); // Compute mesh tangents RLAPI void GenMeshTangents(Mesh *mesh); // Compute mesh tangents
RLAPI bool ExportMesh(Mesh mesh, const char *fileName); // Export mesh data to file, returns true on success
RLAPI bool ExportMeshAsCode(Mesh mesh, const char *fileName); // Export mesh as code file (.h) defining multiple arrays of vertex attributes
// Mesh generation functions // Mesh generation functions
RLAPI Mesh GenMeshPoly(int sides, float radius); // Generate polygonal mesh RLAPI Mesh GenMeshPoly(int sides, float radius); // Generate polygonal mesh

View File

@ -59,9 +59,7 @@
// Function specifiers definition // Function specifiers definition
#if defined(RAYMATH_IMPLEMENTATION) #if defined(RAYMATH_IMPLEMENTATION)
#if defined(_WIN32) && defined(BUILD_LIBTYPE_SHARED) #if defined(_WIN32) && defined(BUILD_LIBTYPE_SHARED)
#define RMAPI __declspec(dllexport) extern inline // We are building raylib as a Win32 shared library (.dll) #define RMAPI __declspec(dllexport) extern inline // We are building raylib as a Win32 shared library (.dll).
#elif defined(BUILD_LIBTYPE_SHARED)
#define RMAPI __attribute__((visibility("default"))) // We are building raylib as a Unix shared library (.so/.dylib)
#elif defined(_WIN32) && defined(USE_LIBTYPE_SHARED) #elif defined(_WIN32) && defined(USE_LIBTYPE_SHARED)
#define RMAPI __declspec(dllimport) // We are using raylib as a Win32 shared library (.dll) #define RMAPI __declspec(dllimport) // We are using raylib as a Win32 shared library (.dll)
#else #else