diff --git a/.gitignore b/.gitignore index 0776e83..49620d6 100755 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ Project/* **/.DS_Store **/CMakeLists.txt **/cmake-build-debug -examples/**/**.c \ No newline at end of file +examples/**/**.c +libraylib.a diff --git a/lib.zig b/lib.zig index 9bc32ff..20d84a5 100644 --- a/lib.zig +++ b/lib.zig @@ -1,6 +1,7 @@ const std = @import("std"); const Builder = std.build.Builder; const LibExeObjStep = std.build.LibExeObjStep; +const rl = @import("raylib/src/build.zig").Pkg("raylib/src"); pub fn Pkg(pkgdir: []const u8) type { return struct { @@ -9,24 +10,16 @@ pub fn Pkg(pkgdir: []const u8) type { if (system_lib) { exe.linkSystemLibrary("raylib"); return; + } else { + exe.linkLibrary(rl.addRaylib(exe.builder, exe.target)); } - const raylibFlags = &[_][]const u8{ - "-std=c99", - "-DPLATFORM_DESKTOP", - "-D_POSIX_C_SOURCE=199309L", - "-DGL_SILENCE_DEPRECATION", - }; - - exe.linkSystemLibrary("c"); - const target_os = exe.target.toTarget().os.tag; switch (target_os) { .windows => { exe.linkSystemLibrary("winmm"); exe.linkSystemLibrary("gdi32"); exe.linkSystemLibrary("opengl32"); - exe.addIncludeDir(pkgdir ++ "/raylib/src/external/glfw/deps/mingw"); }, .macos => { exe.linkFramework("OpenGL"); @@ -34,10 +27,8 @@ pub fn Pkg(pkgdir: []const u8) type { exe.linkFramework("IOKit"); exe.linkFramework("CoreAudio"); exe.linkFramework("CoreVideo"); - exe.addIncludeDir(pkgdir ++ "/raylib/src/external/glfw/include"); }, .freebsd, .openbsd, .netbsd, .dragonfly => { - exe.linkSystemLibrary("glfw"); exe.linkSystemLibrary("GL"); exe.linkSystemLibrary("rt"); exe.linkSystemLibrary("dl"); @@ -50,7 +41,6 @@ pub fn Pkg(pkgdir: []const u8) type { exe.linkSystemLibrary("Xcursor"); }, else => { // linux and possibly others - exe.linkSystemLibrary("glfw"); exe.linkSystemLibrary("GL"); exe.linkSystemLibrary("rt"); exe.linkSystemLibrary("dl"); @@ -58,54 +48,6 @@ pub fn Pkg(pkgdir: []const u8) type { exe.linkSystemLibrary("X11"); }, } - exe.linkLibC(); - - fetchSubmodules(exe.builder) catch - std.debug.print( - \\Warning: - \\Unable to fetch git submodule(s) Assuming package folder is not under - \\version control. If build fails, this is probably why. - , .{}); - - exe.addIncludeDir(pkgdir ++ "/raylib/src"); - exe.addIncludeDir(pkgdir ++ "/raylib/src/external/glfw/include"); - - exe.addCSourceFile(pkgdir ++ "/raylib/src/core.c", raylibFlags); - exe.addCSourceFile(pkgdir ++ "/raylib/src/models.c", raylibFlags); - exe.addCSourceFile(pkgdir ++ "/raylib/src/raudio.c", raylibFlags); - exe.addCSourceFile(pkgdir ++ "/raylib/src/shapes.c", raylibFlags); - exe.addCSourceFile(pkgdir ++ "/raylib/src/text.c", raylibFlags); - exe.addCSourceFile(pkgdir ++ "/raylib/src/textures.c", raylibFlags); - exe.addCSourceFile(pkgdir ++ "/raylib/src/utils.c", raylibFlags); - exe.addCSourceFile(pkgdir ++ "/raylib/src/rglfw.c", raylibFlags); - } - - fn fetchSubmodules(b: *Builder) !void { - if (ran_git) return; - ran_git = true; - - std.debug.print("attempting to fetch submodule(s)...\n", .{}); - - const git_proc = std.ChildProcess.init( - &[_][]const u8{ "git", "submodule", "update", "--init" }, - b.allocator, - ) catch { - std.debug.print("unable to create child process for git. build interrupted\n", .{}); - std.os.exit(1); - }; - git_proc.cwd = pkgdir; - const term = git_proc.spawnAndWait() catch { - std.debug.print("unable to spawn child process for git. build interrupted\n", .{}); - std.os.exit(1); - }; - - switch (term) { - .Exited => |code| if (code != 0) return error.GitFail, - else => { - std.debug.print("git terminated unexpectedly. build interrupted\n", .{}); - std.os.exit(1); - }, - } } pub fn addAsPackage(name: []const u8, to: *LibExeObjStep) void { diff --git a/lib/raylib-wa.zig b/lib/raylib-wa.zig index 83e4a8e..41bb845 100644 --- a/lib/raylib-wa.zig +++ b/lib/raylib-wa.zig @@ -7,10 +7,10 @@ const Camera = rl.Camera; const Camera2D = rl.Camera2D; const Camera3D = rl.Camera3D; const CameraMode = rl.CameraMode; -const CharInfo = rl.CharInfo; const Color = rl.Color; const Font = rl.Font; const Gestures = rl.Gestures; +const GlyphInfo = rl.GlyphInfo; const Image = rl.Image; const KeyboardKey = rl.KeyboardKey; const LoadFileDataCallback = rl.LoadFileDataCallback; @@ -26,7 +26,7 @@ const Music = rl.Music; const NPatchInfo = rl.NPatchInfo; const Quaternion = rl.Quaternion; const Ray = rl.Ray; -const RayHitInfo = rl.RayHitInfo; +const RayCollision = rl.RayCollision; const Rectangle = rl.Rectangle; const RenderTexture = rl.RenderTexture; const RenderTexture2D = rl.RenderTexture2D; @@ -70,9 +70,12 @@ pub extern fn SetWindowPosition(x: c_int, y: c_int) void; pub extern fn SetWindowMonitor(monitor: c_int) void; pub extern fn SetWindowMinSize(width: c_int, height: c_int) void; pub extern fn SetWindowSize(width: c_int, height: c_int) void; +pub extern fn SetWindowOpacity(opacity: f32) void; pub extern fn GetWindowHandle() *const anyopaque; pub extern fn GetScreenWidth() c_int; pub extern fn GetScreenHeight() c_int; +pub extern fn GetRenderWidth() c_int; +pub extern fn GetRenderHeight() c_int; pub extern fn GetMonitorCount() c_int; pub extern fn GetCurrentMonitor() c_int; pub extern fn GetMonitorPosition(monitor: c_int) Vector2; @@ -86,6 +89,9 @@ pub extern fn GetWindowScaleDPI() Vector2; pub extern fn GetMonitorName(monitor: c_int) [*c]const u8; pub extern fn SetClipboardText(text: [*c]const u8) void; pub extern fn GetClipboardText() [*c]const u8; +pub extern fn SwapScreenBuffer() void; +pub extern fn PollInputEvents() void; +pub extern fn WaitTime(ms: f32) void; pub extern fn ShowCursor() void; pub extern fn HideCursor() void; pub extern fn IsCursorHidden() bool; @@ -132,6 +138,7 @@ pub extern fn GetFPS() c_int; pub extern fn GetFrameTime() f32; pub extern fn GetTime() f64; pub extern fn GetRandomValue(min: c_int, max: c_int) c_int; +pub extern fn SetRandomSeed(seed: c_uint) void; pub extern fn TakeScreenshot(fileName: [*c]const u8) void; pub extern fn SetConfigFlags(flags: c_uint) void; pub extern fn TraceLog(logLevel: c_int, text: [*c]const u8, ...) void; @@ -159,6 +166,7 @@ pub extern fn GetFileNameWithoutExt(filePath: [*c]const u8) [*c]const u8; pub extern fn GetDirectoryPath(filePath: [*c]const u8) [*c]const u8; pub extern fn GetPrevDirectoryPath(dirPath: [*c]const u8) [*c]const u8; pub extern fn GetWorkingDirectory() [*c]const u8; +pub extern fn GetApplicationDirectory() [*c]const u8; pub extern fn GetDirectoryFiles(dirPath: [*c]const u8, count: [*c]const c_int) [*c][*c]const u8; pub extern fn ClearDirectoryFiles() void; pub extern fn ChangeDirectory(dir: [*c]const u8) bool; @@ -168,6 +176,8 @@ pub extern fn ClearDroppedFiles() void; pub extern fn GetFileModTime(fileName: [*c]const u8) c_long; pub extern fn CompressData(data: [*c]const u8, dataLength: c_int, compDataLength: [*c]const c_int) [*c]const u8; pub extern fn DecompressData(compData: [*c]const u8, compDataLength: c_int, dataLength: [*c]const c_int) [*c]const u8; +pub extern fn EncodeDataBase64(data: [*c]const u8, dataLength: c_int, outputLength: [*c]const c_int) [*c]const u8; +pub extern fn DecodeDataBase64(data: [*c]const u8, outputLength: [*c]const c_int) [*c]const u8; pub extern fn SaveStorageValue(position: c_uint, value: c_int) bool; pub extern fn LoadStorageValue(position: c_uint) c_int; pub extern fn OpenURL(url: [*c]const u8) void; @@ -179,7 +189,6 @@ pub extern fn SetExitKey(key: KeyboardKey) void; pub extern fn GetKeyPressed() c_int; pub extern fn GetCharPressed() c_int; pub extern fn IsGamepadAvailable(gamepad: c_int) bool; -pub extern fn IsGamepadName(gamepad: c_int, name: [*c]const u8) bool; pub extern fn GetGamepadName(gamepad: c_int) [*c]const u8; pub extern fn IsGamepadButtonPressed(gamepad: c_int, button: MouseButton) bool; pub extern fn IsGamepadButtonDown(gamepad: c_int, button: MouseButton) bool; @@ -196,6 +205,7 @@ pub extern fn IsMouseButtonUp(button: MouseButton) bool; pub extern fn GetMouseX() c_int; pub extern fn GetMouseY() c_int; pub extern fn GetMousePosition() Vector2; +pub extern fn GetMouseDelta() Vector2; pub extern fn SetMousePosition(x: c_int, y: c_int) void; pub extern fn SetMouseOffset(offsetX: c_int, offsetY: c_int) void; pub extern fn SetMouseScale(scaleX: f32, scaleY: f32) void; @@ -204,10 +214,11 @@ pub extern fn SetMouseCursor(cursor: c_int) void; pub extern fn GetTouchX() c_int; pub extern fn GetTouchY() c_int; pub extern fn GetTouchPosition(index: c_int) Vector2; +pub extern fn GetTouchPointId(index: c_int) c_int; +pub extern fn GetTouchPointCount() c_int; pub extern fn SetGesturesEnabled(flags: c_uint) void; pub extern fn IsGestureDetected(gesture: Gestures) bool; pub extern fn GetGestureDetected() c_int; -pub extern fn GetTouchPointsCount() c_int; pub extern fn GetGestureHoldDuration() f32; pub extern fn GetGestureDragVector() Vector2; pub extern fn GetGestureDragAngle() f32; @@ -227,7 +238,8 @@ pub extern fn DrawLineV(startPos: Vector2, endPos: Vector2, color: Color) void; pub extern fn DrawLineEx(startPos: Vector2, endPos: Vector2, thick: f32, color: Color) void; pub extern fn DrawLineBezier(startPos: Vector2, endPos: Vector2, thick: f32, color: Color) void; pub extern fn DrawLineBezierQuad(startPos: Vector2, endPos: Vector2, controlPos: Vector2, thick: f32, color: Color) void; -pub extern fn DrawLineStrip(points: [*c]const Vector2, pointsCount: c_int, color: Color) void; +pub extern fn DrawLineBezierCubic(startPos: Vector2, endPos: Vector2, startControlPos: Vector2, endControlPos: Vector2, thick: f32, color: Color) void; +pub extern fn DrawLineStrip(points: [*c]const Vector2, pointCount: c_int, color: Color) void; pub extern fn DrawCircle(centerX: c_int, centerY: c_int, radius: f32, color: Color) void; pub extern fn DrawCircleSector(center: Vector2, radius: f32, startAngle: f32, endAngle: f32, segments: c_int, color: Color) void; pub extern fn DrawCircleSectorLines(center: Vector2, radius: f32, startAngle: f32, endAngle: f32, segments: c_int, color: Color) void; @@ -246,15 +258,16 @@ pub extern fn DrawRectangleGradientV(posX: c_int, posY: c_int, width: c_int, hei pub extern fn DrawRectangleGradientH(posX: c_int, posY: c_int, width: c_int, height: c_int, color1: Color, color2: Color) void; pub extern fn DrawRectangleGradientEx(rec: Rectangle, col1: Color, col2: Color, col3: Color, col4: Color) void; pub extern fn DrawRectangleLines(posX: c_int, posY: c_int, width: c_int, height: c_int, color: Color) void; -pub extern fn DrawRectangleLinesEx(rec: Rectangle, lineThick: c_int, color: Color) void; +pub extern fn DrawRectangleLinesEx(rec: Rectangle, lineThick: f32, color: Color) void; pub extern fn DrawRectangleRounded(rec: Rectangle, roundness: f32, segments: c_int, color: Color) void; -pub extern fn DrawRectangleRoundedLines(rec: Rectangle, roundness: f32, segments: c_int, lineThick: c_int, color: Color) void; +pub extern fn DrawRectangleRoundedLines(rec: Rectangle, roundness: f32, segments: c_int, lineThick: f32, color: Color) void; pub extern fn DrawTriangle(v1: Vector2, v2: Vector2, v3: Vector2, color: Color) void; pub extern fn DrawTriangleLines(v1: Vector2, v2: Vector2, v3: Vector2, color: Color) void; -pub extern fn DrawTriangleFan(points: [*c]const Vector2, pointsCount: c_int, color: Color) void; -pub extern fn DrawTriangleStrip(points: [*c]const Vector2, pointsCount: c_int, color: Color) void; +pub extern fn DrawTriangleFan(points: [*c]const Vector2, pointCount: c_int, color: Color) void; +pub extern fn DrawTriangleStrip(points: [*c]const Vector2, pointCount: c_int, color: Color) void; pub extern fn DrawPoly(center: Vector2, sides: c_int, radius: f32, rotation: f32, color: Color) void; pub extern fn DrawPolyLines(center: Vector2, sides: c_int, radius: f32, rotation: f32, color: Color) void; +pub extern fn DrawPolyLinesEx(center: Vector2, sides: c_int, radius: f32, rotation: f32, lineThick: f32, color: Color) void; pub extern fn CheckCollisionRecs(rec1: Rectangle, rec2: Rectangle) bool; pub extern fn CheckCollisionCircles(center1: Vector2, radius1: f32, center2: Vector2, radius2: f32) bool; pub extern fn CheckCollisionCircleRec(center: Vector2, radius: f32, rec: Rectangle) bool; @@ -262,11 +275,14 @@ pub extern fn CheckCollisionPointRec(point: Vector2, rec: Rectangle) bool; pub extern fn CheckCollisionPointCircle(point: Vector2, center: Vector2, radius: f32) bool; pub extern fn CheckCollisionPointTriangle(point: Vector2, p1: Vector2, p2: Vector2, p3: Vector2) bool; pub extern fn CheckCollisionLines(startPos1: Vector2, endPos1: Vector2, startPos2: Vector2, endPos2: Vector2, collisionPoint: [*c]const Vector2) bool; +pub extern fn CheckCollisionPointLine(point: Vector2, p1: Vector2, p2: Vector2, threshold: c_int) bool; pub extern fn GetCollisionRec(rec1: Rectangle, rec2: Rectangle) Rectangle; pub extern fn LoadImage(fileName: [*c]const u8) Image; pub extern fn LoadImageRaw(fileName: [*c]const u8, width: c_int, height: c_int, format: c_int, headerSize: c_int) Image; pub extern fn LoadImageAnim(fileName: [*c]const u8, frames: [*c]const c_int) Image; pub extern fn LoadImageFromMemory(fileType: [*c]const u8, fileData: [*c]const u8, dataSize: c_int) Image; +pub extern fn LoadImageFromTexture(texture: Texture2D) Image; +pub extern fn LoadImageFromScreen() Image; pub extern fn UnloadImage(image: Image) void; pub extern fn ExportImage(image: Image, fileName: [*c]const u8) bool; pub extern fn ExportImageAsCode(image: Image, fileName: [*c]const u8) bool; @@ -276,7 +292,6 @@ pub extern fn GenImageGradientH(width: c_int, height: c_int, left: Color, right: pub extern fn GenImageGradientRadial(width: c_int, height: c_int, density: f32, inner: Color, outer: Color) Image; pub extern fn GenImageChecked(width: c_int, height: c_int, checksX: c_int, checksY: c_int, col1: Color, col2: Color) Image; pub extern fn GenImageWhiteNoise(width: c_int, height: c_int, factor: f32) Image; -pub extern fn GenImagePerlinNoise(width: c_int, height: c_int, offsetX: c_int, offsetY: c_int, scale: f32) Image; pub extern fn GenImageCellular(width: c_int, height: c_int, tileSize: c_int) Image; pub extern fn ImageCopy(image: Image) Image; pub extern fn ImageFromImage(image: Image, rec: Rectangle) Image; @@ -305,10 +320,11 @@ pub extern fn ImageColorContrast(image: [*c]const Image, contrast: f32) void; pub extern fn ImageColorBrightness(image: [*c]const Image, brightness: c_int) void; pub extern fn ImageColorReplace(image: [*c]const Image, color: Color, replace: Color) void; pub extern fn LoadImageColors(image: Image) [*c]const Color; -pub extern fn LoadImagePalette(image: Image, maxPaletteSize: c_int, colorsCount: [*c]const c_int) [*c]const Color; +pub extern fn LoadImagePalette(image: Image, maxPaletteSize: c_int, colorCount: [*c]const c_int) [*c]const Color; pub extern fn UnloadImageColors(colors: [*c]const Color) void; pub extern fn UnloadImagePalette(colors: [*c]const Color) void; pub extern fn GetImageAlphaBorder(image: Image, threshold: f32) Rectangle; +pub extern fn GetImageColor(image: Image, x: c_int, y: c_int) Color; pub extern fn ImageClearBackground(dst: [*c]const Image, color: Color) void; pub extern fn ImageDrawPixel(dst: [*c]const Image, posX: c_int, posY: c_int, color: Color) void; pub extern fn ImageDrawPixelV(dst: [*c]const Image, position: Vector2, color: Color) void; @@ -331,8 +347,6 @@ pub extern fn UnloadTexture(texture: Texture2D) void; pub extern fn UnloadRenderTexture(target: RenderTexture2D) void; pub extern fn UpdateTexture(texture: Texture2D, pixels: *const anyopaque) void; pub extern fn UpdateTextureRec(texture: Texture2D, rec: Rectangle, pixels: *const anyopaque) void; -pub extern fn GetTextureData(texture: Texture2D) Image; -pub extern fn GetScreenData() Image; pub extern fn GenTextureMipmaps(texture: [*c]const Texture2D) void; pub extern fn SetTextureFilter(texture: Texture2D, filter: c_int) void; pub extern fn SetTextureWrap(texture: Texture2D, wrap: c_int) void; @@ -344,7 +358,7 @@ pub extern fn DrawTextureQuad(texture: Texture2D, tiling: Vector2, offset: Vecto pub extern fn DrawTextureTiled(texture: Texture2D, source: Rectangle, dest: Rectangle, origin: Vector2, rotation: f32, scale: f32, tint: Color) void; pub extern fn DrawTexturePro(texture: Texture2D, source: Rectangle, dest: Rectangle, origin: Vector2, rotation: f32, tint: Color) void; pub extern fn DrawTextureNPatch(texture: Texture2D, nPatchInfo: NPatchInfo, dest: Rectangle, origin: Vector2, rotation: f32, tint: Color) void; -pub extern fn DrawTexturePoly(texture: Texture2D, center: Vector2, points: [*c]const Vector2, texcoords: [*c]const Vector2, pointsCount: c_int, tint: Color) void; +pub extern fn DrawTexturePoly(texture: Texture2D, center: Vector2, points: [*c]const Vector2, texcoords: [*c]const Vector2, pointCount: c_int, tint: Color) void; pub extern fn Fade(color: Color, alpha: f32) Color; pub extern fn ColorToInt(color: Color) c_int; pub extern fn ColorNormalize(color: Color) Vector4; @@ -353,27 +367,36 @@ pub extern fn ColorToHSV(color: Color) Vector3; pub extern fn ColorFromHSV(hue: f32, saturation: f32, value: f32) Color; pub extern fn ColorAlpha(color: Color, alpha: f32) Color; pub extern fn ColorAlphaBlend(dst: Color, src: Color, tint: Color) Color; -pub extern fn GetColor(hexValue: c_int) Color; +pub extern fn GetColor(hexValue: c_uint) Color; pub extern fn GetPixelColor(srcPtr: *const anyopaque, format: c_int) Color; pub extern fn SetPixelColor(dstPtr: *const anyopaque, color: Color, format: c_int) void; pub extern fn GetPixelDataSize(width: c_int, height: c_int, format: c_int) c_int; pub extern fn GetFontDefault() Font; pub extern fn LoadFont(fileName: [*c]const u8) Font; -pub extern fn LoadFontEx(fileName: [*c]const u8, fontSize: c_int, fontChars: [*c]const c_int, charsCount: c_int) Font; +pub extern fn LoadFontEx(fileName: [*c]const u8, fontSize: c_int, fontChars: [*c]const c_int, glyphCount: c_int) Font; pub extern fn LoadFontFromImage(image: Image, key: Color, firstChar: c_int) Font; -pub extern fn LoadFontFromMemory(fileType: [*c]const u8, fileData: [*c]const u8, dataSize: c_int, fontSize: c_int, fontChars: [*c]const c_int, charsCount: c_int) Font; -pub extern fn LoadFontData(fileData: [*c]const u8, dataSize: c_int, fontSize: c_int, fontChars: [*c]const c_int, charsCount: c_int, type: c_int) [*c]const CharInfo; -pub extern fn GenImageFontAtlas(chars: [*c]const CharInfo, recs: [*c][*c]const Rectangle, charsCount: c_int, fontSize: c_int, padding: c_int, packMethod: c_int) Image; -pub extern fn UnloadFontData(chars: [*c]const CharInfo, charsCount: c_int) void; +pub extern fn LoadFontFromMemory(fileType: [*c]const u8, fileData: [*c]const u8, dataSize: c_int, fontSize: c_int, fontChars: [*c]const c_int, glyphCount: c_int) Font; +pub extern fn LoadFontData(fileData: [*c]const u8, dataSize: c_int, fontSize: c_int, fontChars: [*c]const c_int, glyphCount: c_int, type: c_int) [*c]const GlyphInfo; +pub extern fn GenImageFontAtlas(chars: [*c]const GlyphInfo, recs: [*c][*c]const Rectangle, glyphCount: c_int, fontSize: c_int, padding: c_int, packMethod: c_int) Image; +pub extern fn UnloadFontData(chars: [*c]const GlyphInfo, glyphCount: c_int) void; pub extern fn UnloadFont(font: Font) void; +pub extern fn ExportFontAsCode(font: Font, fileName: [*c]const u8) bool; pub extern fn DrawFPS(posX: c_int, posY: c_int) void; pub extern fn DrawText(text: [*c]const u8, posX: c_int, posY: c_int, fontSize: c_int, color: Color) void; pub extern fn DrawTextEx(font: Font, text: [*c]const u8, position: Vector2, fontSize: f32, spacing: f32, tint: Color) void; -pub extern fn DrawTextRec(font: Font, text: [*c]const u8, rec: Rectangle, fontSize: f32, spacing: f32, wordWrap: bool, tint: Color) void; +pub extern fn DrawTextPro(font: Font, text: [*c]const u8, position: Vector2, origin: Vector2, rotation: f32, fontSize: f32, spacing: f32, tint: Color) void; pub extern fn DrawTextCodepoint(font: Font, codepoint: c_int, position: Vector2, fontSize: f32, tint: Color) void; pub extern fn MeasureText(text: [*c]const u8, fontSize: c_int) c_int; pub extern fn MeasureTextEx(font: Font, text: [*c]const u8, fontSize: f32, spacing: f32) Vector2; pub extern fn GetGlyphIndex(font: Font, codepoint: c_int) c_int; +pub extern fn GetGlyphInfo(font: Font, codepoint: c_int) GlyphInfo; +pub extern fn GetGlyphAtlasRec(font: Font, codepoint: c_int) Rectangle; +pub extern fn LoadCodepoints(text: [*c]const u8, count: [*c]const c_int) [*c]const c_int; +pub extern fn UnloadCodepoints(codepoints: [*c]const c_int) void; +pub extern fn GetCodepointCount(text: [*c]const u8) c_int; +pub extern fn GetCodepoint(text: [*c]const u8, bytesProcessed: [*c]const c_int) c_int; +pub extern fn CodepointToUTF8(codepoint: c_int, byteSize: [*c]const c_int) [*c]const u8; +pub extern fn TextCodepointsToUTF8(codepoints: [*c]const c_int, length: c_int) [*c]const u8; pub extern fn TextCopy(dst: [*c]const u8, src: [*c]const u8) c_int; pub extern fn TextIsEqual(text1: [*c]const u8, text2: [*c]const u8) bool; pub extern fn TextLength(text: [*c]const u8) c_uint; @@ -389,26 +412,24 @@ pub extern fn TextToUpper(text: [*c]const u8) [*c]const u8; pub extern fn TextToLower(text: [*c]const u8) [*c]const u8; pub extern fn TextToPascal(text: [*c]const u8) [*c]const u8; pub extern fn TextToInteger(text: [*c]const u8) c_int; -pub extern fn TextToUtf8(codepoints: [*c]const c_int, length: c_int) [*c]const u8; -pub extern fn GetCodepoints(text: [*c]const u8, count: [*c]const c_int) [*c]const c_int; -pub extern fn GetCodepointsCount(text: [*c]const u8) c_int; -pub extern fn GetNextCodepoint(text: [*c]const u8, bytesProcessed: [*c]const c_int) c_int; -pub extern fn CodepointToUtf8(codepoint: c_int, byteLength: [*c]const c_int) [*c]const u8; pub extern fn DrawLine3D(startPos: Vector3, endPos: Vector3, color: Color) void; pub extern fn DrawPoint3D(position: Vector3, color: Color) void; pub extern fn DrawCircle3D(center: Vector3, radius: f32, rotationAxis: Vector3, rotationAngle: f32, color: Color) void; pub extern fn DrawTriangle3D(v1: Vector3, v2: Vector3, v3: Vector3, color: Color) void; -pub extern fn DrawTriangleStrip3D(points: [*c]const Vector3, pointsCount: c_int, color: Color) void; +pub extern fn DrawTriangleStrip3D(points: [*c]const Vector3, pointCount: c_int, color: Color) void; pub extern fn DrawCube(position: Vector3, width: f32, height: f32, length: f32, color: Color) void; pub extern fn DrawCubeV(position: Vector3, size: Vector3, color: Color) void; pub extern fn DrawCubeWires(position: Vector3, width: f32, height: f32, length: f32, color: Color) void; pub extern fn DrawCubeWiresV(position: Vector3, size: Vector3, color: Color) void; pub extern fn DrawCubeTexture(texture: Texture2D, position: Vector3, width: f32, height: f32, length: f32, color: Color) void; +pub extern fn DrawCubeTextureRec(texture: Texture2D, source: Rectangle, position: Vector3, width: f32, height: f32, length: f32, color: Color) void; pub extern fn DrawSphere(centerPos: Vector3, radius: f32, color: Color) void; pub extern fn DrawSphereEx(centerPos: Vector3, radius: f32, rings: c_int, slices: c_int, color: Color) void; pub extern fn DrawSphereWires(centerPos: Vector3, radius: f32, rings: c_int, slices: c_int, color: Color) void; pub extern fn DrawCylinder(position: Vector3, radiusTop: f32, radiusBottom: f32, height: f32, slices: c_int, color: Color) void; +pub extern fn DrawCylinderEx(startPos: Vector3, endPos: Vector3, startRadius: f32, endRadius: f32, sides: c_int, color: Color) void; pub extern fn DrawCylinderWires(position: Vector3, radiusTop: f32, radiusBottom: f32, height: f32, slices: c_int, color: Color) void; +pub extern fn DrawCylinderWiresEx(startPos: Vector3, endPos: Vector3, startRadius: f32, endRadius: f32, sides: c_int, color: Color) void; pub extern fn DrawPlane(centerPos: Vector3, size: Vector2, color: Color) void; pub extern fn DrawRay(ray: Ray, color: Color) void; pub extern fn DrawGrid(slices: c_int, spacing: f32) void; @@ -416,52 +437,54 @@ pub extern fn LoadModel(fileName: [*c]const u8) Model; pub extern fn LoadModelFromMesh(mesh: Mesh) Model; pub extern fn UnloadModel(model: Model) void; pub extern fn UnloadModelKeepMeshes(model: Model) void; +pub extern fn GetModelBoundingBox(model: Model) BoundingBox; +pub extern fn DrawModel(model: Model, position: Vector3, scale: f32, tint: Color) void; +pub extern fn DrawModelEx(model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: f32, scale: Vector3, tint: Color) void; +pub extern fn DrawModelWires(model: Model, position: Vector3, scale: f32, tint: Color) void; +pub extern fn DrawModelWiresEx(model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: f32, scale: Vector3, tint: Color) void; +pub extern fn DrawBoundingBox(box: BoundingBox, color: Color) void; +pub extern fn DrawBillboard(camera: Camera, texture: Texture2D, position: Vector3, size: f32, tint: Color) void; +pub extern fn DrawBillboardRec(camera: Camera, texture: Texture2D, source: Rectangle, position: Vector3, size: Vector2, tint: Color) void; +pub extern fn DrawBillboardPro(camera: Camera, texture: Texture2D, source: Rectangle, position: Vector3, up: Vector3, size: Vector2, origin: Vector2, rotation: f32, tint: Color) void; pub extern fn UploadMesh(mesh: [*c]const Mesh, dynamic: bool) void; pub extern fn UpdateMeshBuffer(mesh: Mesh, index: c_int, data: *const anyopaque, dataSize: c_int, offset: c_int) void; +pub extern fn UnloadMesh(mesh: Mesh) void; pub extern fn DrawMesh(mesh: Mesh, material: Material, transform: Matrix) void; pub extern fn DrawMeshInstanced(mesh: Mesh, material: Material, transforms: [*c]const Matrix, instances: c_int) void; -pub extern fn UnloadMesh(mesh: Mesh) void; pub extern fn ExportMesh(mesh: Mesh, fileName: [*c]const u8) bool; -pub extern fn LoadMaterials(fileName: [*c]const u8, materialCount: [*c]const c_int) [*c]const Material; -pub extern fn LoadMaterialDefault() Material; -pub extern fn UnloadMaterial(material: Material) void; -pub extern fn SetMaterialTexture(material: [*c]const Material, mapType: c_int, texture: Texture2D) void; -pub extern fn SetModelMeshMaterial(model: [*c]const Model, meshId: c_int, materialId: c_int) void; -pub extern fn LoadModelAnimations(fileName: [*c]const u8, animsCount: [*c]const c_int) [*c]const ModelAnimation; -pub extern fn UpdateModelAnimation(model: Model, anim: ModelAnimation, frame: c_int) void; -pub extern fn UnloadModelAnimation(anim: ModelAnimation) void; -pub extern fn UnloadModelAnimations(animations: [*c]const ModelAnimation, count: c_uint) void; -pub extern fn IsModelAnimationValid(model: Model, anim: ModelAnimation) bool; +pub extern fn GetMeshBoundingBox(mesh: Mesh) BoundingBox; +pub extern fn GenMeshTangents(mesh: [*c]const Mesh) void; +pub extern fn GenMeshBinormals(mesh: [*c]const Mesh) void; pub extern fn GenMeshPoly(sides: c_int, radius: f32) Mesh; pub extern fn GenMeshPlane(width: f32, length: f32, resX: c_int, resZ: c_int) Mesh; pub extern fn GenMeshCube(width: f32, height: f32, length: f32) Mesh; pub extern fn GenMeshSphere(radius: f32, rings: c_int, slices: c_int) Mesh; pub extern fn GenMeshHemiSphere(radius: f32, rings: c_int, slices: c_int) Mesh; pub extern fn GenMeshCylinder(radius: f32, height: f32, slices: c_int) Mesh; +pub extern fn GenMeshCone(radius: f32, height: f32, slices: c_int) Mesh; pub extern fn GenMeshTorus(radius: f32, size: f32, radSeg: c_int, sides: c_int) Mesh; pub extern fn GenMeshKnot(radius: f32, size: f32, radSeg: c_int, sides: c_int) Mesh; pub extern fn GenMeshHeightmap(heightmap: Image, size: Vector3) Mesh; pub extern fn GenMeshCubicmap(cubicmap: Image, cubeSize: Vector3) Mesh; -pub extern fn MeshBoundingBox(mesh: Mesh) BoundingBox; -pub extern fn MeshTangents(mesh: [*c]const Mesh) void; -pub extern fn MeshBinormals(mesh: [*c]const Mesh) void; -pub extern fn DrawModel(model: Model, position: Vector3, scale: f32, tint: Color) void; -pub extern fn DrawModelEx(model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: f32, scale: Vector3, tint: Color) void; -pub extern fn DrawModelWires(model: Model, position: Vector3, scale: f32, tint: Color) void; -pub extern fn DrawModelWiresEx(model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: f32, scale: Vector3, tint: Color) void; -pub extern fn DrawBoundingBox(box: BoundingBox, color: Color) void; -pub extern fn DrawBillboard(camera: Camera, texture: Texture2D, center: Vector3, size: f32, tint: Color) void; -pub extern fn DrawBillboardRec(camera: Camera, texture: Texture2D, source: Rectangle, center: Vector3, size: f32, tint: Color) void; +pub extern fn LoadMaterials(fileName: [*c]const u8, materialCount: [*c]const c_int) [*c]const Material; +pub extern fn LoadMaterialDefault() Material; +pub extern fn UnloadMaterial(material: Material) void; +pub extern fn SetMaterialTexture(material: [*c]const Material, mapType: c_int, texture: Texture2D) void; +pub extern fn SetModelMeshMaterial(model: [*c]const Model, meshId: c_int, materialId: c_int) void; +pub extern fn LoadModelAnimations(fileName: [*c]const u8, animCount: [*c]const c_uint) [*c]const ModelAnimation; +pub extern fn UpdateModelAnimation(model: Model, anim: ModelAnimation, frame: c_int) void; +pub extern fn UnloadModelAnimation(anim: ModelAnimation) void; +pub extern fn UnloadModelAnimations(animations: [*c]const ModelAnimation, count: c_uint) void; +pub extern fn IsModelAnimationValid(model: Model, anim: ModelAnimation) bool; pub extern fn CheckCollisionSpheres(center1: Vector3, radius1: f32, center2: Vector3, radius2: f32) bool; pub extern fn CheckCollisionBoxes(box1: BoundingBox, box2: BoundingBox) bool; pub extern fn CheckCollisionBoxSphere(box: BoundingBox, center: Vector3, radius: f32) bool; -pub extern fn CheckCollisionRaySphere(ray: Ray, center: Vector3, radius: f32) bool; -pub extern fn CheckCollisionRaySphereEx(ray: Ray, center: Vector3, radius: f32, collisionPoint: [*c]const Vector3) bool; -pub extern fn CheckCollisionRayBox(ray: Ray, box: BoundingBox) bool; -pub extern fn GetCollisionRayMesh(ray: Ray, mesh: Mesh, transform: Matrix) RayHitInfo; -pub extern fn GetCollisionRayModel(ray: Ray, model: Model) RayHitInfo; -pub extern fn GetCollisionRayTriangle(ray: Ray, p1: Vector3, p2: Vector3, p3: Vector3) RayHitInfo; -pub extern fn GetCollisionRayGround(ray: Ray, groundHeight: f32) RayHitInfo; +pub extern fn GetRayCollisionSphere(ray: Ray, center: Vector3, radius: f32) RayCollision; +pub extern fn GetRayCollisionBox(ray: Ray, box: BoundingBox) RayCollision; +pub extern fn GetRayCollisionModel(ray: Ray, model: Model) RayCollision; +pub extern fn GetRayCollisionMesh(ray: Ray, mesh: Mesh, transform: Matrix) RayCollision; +pub extern fn GetRayCollisionTriangle(ray: Ray, p1: Vector3, p2: Vector3, p3: Vector3) RayCollision; +pub extern fn GetRayCollisionQuad(ray: Ray, p1: Vector3, p2: Vector3, p3: Vector3, p4: Vector3) RayCollision; pub extern fn InitAudioDevice() void; pub extern fn CloseAudioDevice() void; pub extern fn IsAudioDeviceReady() bool; @@ -470,7 +493,7 @@ pub extern fn LoadWave(fileName: [*c]const u8) Wave; pub extern fn LoadWaveFromMemory(fileType: [*c]const u8, fileData: [*c]const u8, dataSize: c_int) Wave; pub extern fn LoadSound(fileName: [*c]const u8) Sound; pub extern fn LoadSoundFromWave(wave: Wave) Sound; -pub extern fn UpdateSound(sound: Sound, data: *const anyopaque, samplesCount: c_int) void; +pub extern fn UpdateSound(sound: Sound, data: *const anyopaque, sampleCount: c_int) void; pub extern fn UnloadWave(wave: Wave) void; pub extern fn UnloadSound(sound: Sound) void; pub extern fn ExportWave(wave: Wave, fileName: [*c]const u8) bool; @@ -494,18 +517,19 @@ pub extern fn LoadMusicStream(fileName: [*c]const u8) Music; pub extern fn LoadMusicStreamFromMemory(fileType: [*c]const u8, data: [*c]const u8, dataSize: c_int) Music; pub extern fn UnloadMusicStream(music: Music) void; pub extern fn PlayMusicStream(music: Music) void; -pub extern fn IsMusicPlaying(music: Music) bool; +pub extern fn IsMusicStreamPlaying(music: Music) bool; pub extern fn UpdateMusicStream(music: Music) void; pub extern fn StopMusicStream(music: Music) void; pub extern fn PauseMusicStream(music: Music) void; pub extern fn ResumeMusicStream(music: Music) void; +pub extern fn SeekMusicStream(music: Music, position: f32) void; pub extern fn SetMusicVolume(music: Music, volume: f32) void; pub extern fn SetMusicPitch(music: Music, pitch: f32) void; pub extern fn GetMusicTimeLength(music: Music) f32; pub extern fn GetMusicTimePlayed(music: Music) f32; -pub extern fn InitAudioStream(sampleRate: c_uint, sampleSize: c_uint, channels: c_uint) AudioStream; -pub extern fn UpdateAudioStream(stream: AudioStream, data: *const anyopaque, samplesCount: c_int) void; -pub extern fn CloseAudioStream(stream: AudioStream) void; +pub extern fn LoadAudioStream(sampleRate: c_uint, sampleSize: c_uint, channels: c_uint) AudioStream; +pub extern fn UnloadAudioStream(stream: AudioStream) void; +pub extern fn UpdateAudioStream(stream: AudioStream, data: *const anyopaque, frameCount: c_int) void; pub extern fn IsAudioStreamProcessed(stream: AudioStream) bool; pub extern fn PlayAudioStream(stream: AudioStream) void; pub extern fn PauseAudioStream(stream: AudioStream) void; diff --git a/lib/raylib-zig-math.zig b/lib/raylib-zig-math.zig index 1cb4440..fc2b589 100755 --- a/lib/raylib-zig-math.zig +++ b/lib/raylib-zig-math.zig @@ -4,103 +4,10 @@ const Matrix = rl.Matrix; const Quaternion = rl.Quaternion; const Vector2 = rl.Vector2; const Vector3 = rl.Vector3; +const Vector4 = rl.Vector4; const float16 = rl.float16; const float3 = rl.float3; -pub extern fn Clamp(value: f32, min: f32, max: f32) f32; -pub extern fn Lerp(start: f32, end: f32, amount: f32) f32; -pub extern fn Normalize(value: f32, start: f32, end: f32) f32; -pub extern fn Remap(value: f32, inputStart: f32, inputEnd: f32, outputStart: f32, outputEnd: f32) f32; -pub extern fn Vector2Zero() Vector2; -pub extern fn Vector2One() Vector2; -pub extern fn Vector2Add(v1: Vector2, v2: Vector2) Vector2; -pub extern fn Vector2AddValue(v: Vector2, add: f32) Vector2; -pub extern fn Vector2Subtract(v1: Vector2, v2: Vector2) Vector2; -pub extern fn Vector2SubtractValue(v: Vector2, sub: f32) Vector2; -pub extern fn Vector2Length(v: Vector2) f32; -pub extern fn Vector2LengthSqr(v: Vector2) f32; -pub extern fn Vector2DotProduct(v1: Vector2, v2: Vector2) f32; -pub extern fn Vector2Distance(v1: Vector2, v2: Vector2) f32; -pub extern fn Vector2Angle(v1: Vector2, v2: Vector2) f32; -pub extern fn Vector2Scale(v: Vector2, scale: f32) Vector2; -pub extern fn Vector2Multiply(v1: Vector2, v2: Vector2) Vector2; -pub extern fn Vector2Negate(v: Vector2) Vector2; -pub extern fn Vector2Divide(v1: Vector2, v2: Vector2) Vector2; -pub extern fn Vector2Normalize(v: Vector2) Vector2; -pub extern fn Vector2Lerp(v1: Vector2, v2: Vector2, amount: f32) Vector2; -pub extern fn Vector2Reflect(v: Vector2, normal: Vector2) Vector2; -pub extern fn Vector2Rotate(v: Vector2, degs: f32) Vector2; -pub extern fn Vector2MoveTowards(v: Vector2, target: Vector2, maxDistance: f32) Vector2; -pub extern fn Vector3Zero() Vector3; -pub extern fn Vector3One() Vector3; -pub extern fn Vector3Add(v1: Vector3, v2: Vector3) Vector3; -pub extern fn Vector3AddValue(v: Vector3, add: f32) Vector3; -pub extern fn Vector3Subtract(v1: Vector3, v2: Vector3) Vector3; -pub extern fn Vector3SubtractValue(v: Vector3, sub: f32) Vector3; -pub extern fn Vector3Scale(v: Vector3, scalar: f32) Vector3; -pub extern fn Vector3Multiply(v1: Vector3, v2: Vector3) Vector3; -pub extern fn Vector3CrossProduct(v1: Vector3, v2: Vector3) Vector3; -pub extern fn Vector3Perpendicular(v: Vector3) Vector3; -pub extern fn Vector3Length(v: Vector3) f32; -pub extern fn Vector3LengthSqr(v: Vector3) f32; -pub extern fn Vector3DotProduct(v1: Vector3, v2: Vector3) f32; -pub extern fn Vector3Distance(v1: Vector3, v2: Vector3) f32; -pub extern fn Vector3Negate(v: Vector3) Vector3; -pub extern fn Vector3Divide(v1: Vector3, v2: Vector3) Vector3; -pub extern fn Vector3Normalize(v: Vector3) Vector3; -pub extern fn Vector3OrthoNormalize(v1: [*c]const Vector3, v2: [*c]const Vector3) void; -pub extern fn Vector3Transform(v: Vector3, mat: Matrix) Vector3; -pub extern fn Vector3RotateByQuaternion(v: Vector3, q: Quaternion) Vector3; -pub extern fn Vector3Lerp(v1: Vector3, v2: Vector3, amount: f32) Vector3; -pub extern fn Vector3Reflect(v: Vector3, normal: Vector3) Vector3; -pub extern fn Vector3Min(v1: Vector3, v2: Vector3) Vector3; -pub extern fn Vector3Max(v1: Vector3, v2: Vector3) Vector3; -pub extern fn Vector3Barycenter(p: Vector3, a: Vector3, b: Vector3, c: Vector3) Vector3; -pub extern fn Vector3ToFloatV(v: Vector3) float3; -pub extern fn MatrixDeterminant(mat: Matrix) f32; -pub extern fn MatrixTrace(mat: Matrix) f32; -pub extern fn MatrixTranspose(mat: Matrix) Matrix; -pub extern fn MatrixInvert(mat: Matrix) Matrix; -pub extern fn MatrixNormalize(mat: Matrix) Matrix; -pub extern fn MatrixIdentity() Matrix; -pub extern fn MatrixAdd(left: Matrix, right: Matrix) Matrix; -pub extern fn MatrixSubtract(left: Matrix, right: Matrix) Matrix; -pub extern fn MatrixMultiply(left: Matrix, right: Matrix) Matrix; -pub extern fn MatrixTranslate(x: f32, y: f32, z: f32) Matrix; -pub extern fn MatrixRotate(axis: Vector3, angle: f32) Matrix; -pub extern fn MatrixRotateX(angle: f32) Matrix; -pub extern fn MatrixRotateY(angle: f32) Matrix; -pub extern fn MatrixRotateZ(angle: f32) Matrix; -pub extern fn MatrixRotateXYZ(ang: Vector3) Matrix; -pub extern fn MatrixRotateZYX(ang: Vector3) Matrix; -pub extern fn MatrixScale(x: f32, y: f32, z: f32) Matrix; -pub extern fn MatrixFrustum(left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64) Matrix; -pub extern fn MatrixPerspective(fovy: f64, aspect: f64, near: f64, far: f64) Matrix; -pub extern fn MatrixOrtho(left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64) Matrix; -pub extern fn MatrixLookAt(eye: Vector3, target: Vector3, up: Vector3) Matrix; -pub extern fn MatrixToFloatV(mat: Matrix) float16; -pub extern fn QuaternionAdd(q1: Quaternion, q2: Quaternion) Quaternion; -pub extern fn QuaternionAddValue(q: Quaternion, add: f32) Quaternion; -pub extern fn QuaternionSubtract(q1: Quaternion, q2: Quaternion) Quaternion; -pub extern fn QuaternionSubtractValue(q: Quaternion, sub: f32) Quaternion; -pub extern fn QuaternionIdentity() Quaternion; -pub extern fn QuaternionLength(q: Quaternion) f32; -pub extern fn QuaternionNormalize(q: Quaternion) Quaternion; -pub extern fn QuaternionInvert(q: Quaternion) Quaternion; -pub extern fn QuaternionMultiply(q1: Quaternion, q2: Quaternion) Quaternion; -pub extern fn QuaternionScale(q: Quaternion, mul: f32) Quaternion; -pub extern fn QuaternionDivide(q1: Quaternion, q2: Quaternion) Quaternion; -pub extern fn QuaternionLerp(q1: Quaternion, q2: Quaternion, amount: f32) Quaternion; -pub extern fn QuaternionNlerp(q1: Quaternion, q2: Quaternion, amount: f32) Quaternion; -pub extern fn QuaternionSlerp(q1: Quaternion, q2: Quaternion, amount: f32) Quaternion; -pub extern fn QuaternionFromVector3ToVector3(from: Vector3, to: Vector3) Quaternion; -pub extern fn QuaternionFromMatrix(mat: Matrix) Quaternion; -pub extern fn QuaternionToMatrix(q: Quaternion) Matrix; -pub extern fn QuaternionFromAxisAngle(axis: Vector3, angle: f32) Quaternion; -pub extern fn QuaternionToAxisAngle(q: Quaternion, outAxis: [*c]const Vector3, outAngle: [*c]const f32) void; -pub extern fn QuaternionFromEuler(pitch: f32, yaw: f32, roll: f32) Quaternion; -pub extern fn QuaternionToEuler(q: Quaternion) Vector3; -pub extern fn QuaternionTransform(q: Quaternion, mat: Matrix) Quaternion; -pub extern fn Vector3Unproject(source: Vector3, projection: Matrix, view: Matrix) Vector3; + diff --git a/lib/raylib-zig.zig b/lib/raylib-zig.zig index ecbdaa9..05a86ec 100755 --- a/lib/raylib-zig.zig +++ b/lib/raylib-zig.zig @@ -144,10 +144,6 @@ pub const Image = extern struct { return rl.GenImageWhiteNoise(width, height, factor); } - pub fn GenPerlinNoise(width: c_int, height: c_int, offsetX: c_int, offsetY: c_int, scale: f32) Image { - return rl.GenImagePerlinNoise(width, height, offsetX, offsetY, scale); - } - pub fn GenCellular(width: c_int, height: c_int, tileSize: c_int) Image { return rl.GenImageCellular(width, height, tileSize); } diff --git a/raylib b/raylib index b6c8d34..a6aa5a1 160000 --- a/raylib +++ b/raylib @@ -1 +1 @@ -Subproject commit b6c8d343dca2ef19c23c50975328a028124cf3cb +Subproject commit a6aa5a1e4c34e7d8dfbede6d17ee40f7648265bb