mirror of
https://github.com/Not-Nik/raylib-zig.git
synced 2025-09-09 03:57:29 +00:00
Bump to Zig 0.11/raylib 4.6-dev
This commit is contained in:
parent
9c5197bad4
commit
edbd73e6be
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,4 +3,6 @@ zig-cache/
|
||||
Project/*
|
||||
|
||||
libraylib.a
|
||||
raylib.h
|
||||
raymath.h
|
||||
**/.DS_Store
|
||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
||||
[submodule "raylib"]
|
||||
path = raylib
|
||||
url = https://github.com/raysan5/raylib
|
49
build.zig
49
build.zig
@ -1,13 +1,7 @@
|
||||
//
|
||||
// build
|
||||
// Zig version: 0.9.0
|
||||
// Author: Nikolas Wipper
|
||||
// Date: 2020-02-15
|
||||
//
|
||||
// raylib-zig (c) Nikolas Wipper 2020-2023
|
||||
|
||||
const std = @import("std");
|
||||
const Builder = std.build.Builder;
|
||||
const raylib = @import("lib.zig");
|
||||
|
||||
const Program = struct {
|
||||
name: []const u8,
|
||||
@ -15,9 +9,28 @@ const Program = struct {
|
||||
desc: []const u8,
|
||||
};
|
||||
|
||||
pub fn build(b: *Builder) void {
|
||||
const mode = b.standardReleaseOptions();
|
||||
pub fn getArtifact(b: *std.Build, target: std.zig.CrossTarget, optimize: std.builtin.Mode) *std.Build.Step.Compile {
|
||||
const raylib = b.dependency("raylib", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
return raylib.artifact("raylib");
|
||||
}
|
||||
|
||||
pub fn getModule(b: *std.Build) *std.Build.Module {
|
||||
return b.addModule("raylib", .{ .source_file = .{ .path = "lib/raylib-zig.zig" } });
|
||||
}
|
||||
|
||||
pub const math = struct {
|
||||
pub fn getModule(b: *std.Build) *std.Build.Module {
|
||||
return b.addModule("raylib-math", .{ .source_file = .{ .path = "lib/raylib-zig-math.zig" } });
|
||||
}
|
||||
};
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const examples = [_]Program{
|
||||
.{
|
||||
@ -84,18 +97,20 @@ pub fn build(b: *Builder) void {
|
||||
|
||||
const examples_step = b.step("examples", "Builds all the examples");
|
||||
const system_lib = b.option(bool, "system-raylib", "link to preinstalled raylib libraries") orelse false;
|
||||
_ = system_lib;
|
||||
|
||||
var raylib = getModule(b);
|
||||
var raylib_math = math.getModule(b);
|
||||
var raylib_artifact = getArtifact(b, target, optimize);
|
||||
|
||||
for (examples) |ex| {
|
||||
const exe = b.addExecutable(ex.name, ex.path);
|
||||
const exe = b.addExecutable(.{ .name = ex.name, .root_source_file = .{ .path = ex.path }, .optimize = optimize, .target = target });
|
||||
|
||||
exe.setBuildMode(mode);
|
||||
exe.setTarget(target);
|
||||
exe.linkLibrary(raylib_artifact);
|
||||
exe.addModule("raylib", raylib);
|
||||
exe.addModule("raylib-math", raylib_math);
|
||||
|
||||
raylib.link(exe, system_lib);
|
||||
raylib.addAsPackage("raylib", exe);
|
||||
raylib.math.addAsPackage("raylib-math", exe);
|
||||
|
||||
const run_cmd = exe.run();
|
||||
const run_cmd = b.addRunArtifact(exe);
|
||||
const run_step = b.step(ex.name, ex.desc);
|
||||
run_step.dependOn(&run_cmd.step);
|
||||
examples_step.dependOn(&exe.step);
|
||||
|
10
build.zig.zon
Normal file
10
build.zig.zon
Normal file
@ -0,0 +1,10 @@
|
||||
.{
|
||||
.name = "zig-raylib",
|
||||
.version = "0.1.0",
|
||||
.dependencies = .{
|
||||
.raylib = .{
|
||||
.url = "https://github.com/raysan5/raylib/archive/ad2338b994785c887528c91a843d6720cac2c2b0.tar.gz",
|
||||
.hash = "122003990d16146cfb85e04e0557f41b54e81bae635fa4379f3a597ed5fb7716ee53",
|
||||
},
|
||||
},
|
||||
}
|
@ -20,15 +20,15 @@ pub fn main() anyerror!void {
|
||||
|
||||
var spacing: i32 = 0;
|
||||
|
||||
for (buildings) |_, i| {
|
||||
buildings[i].width = @intToFloat(f32, rl.getRandomValue(50, 200));
|
||||
buildings[i].height = @intToFloat(f32, rl.getRandomValue(100, 800));
|
||||
for (0..buildings.len) |i| {
|
||||
buildings[i].width = @as(f32, @floatFromInt(rl.getRandomValue(50, 200)));
|
||||
buildings[i].height = @as(f32, @floatFromInt(rl.getRandomValue(100, 800)));
|
||||
buildings[i].y = screenHeight - 130 - buildings[i].height;
|
||||
buildings[i].x = @intToFloat(f32, -6000 + spacing);
|
||||
buildings[i].x = @as(f32, @floatFromInt(-6000 + spacing));
|
||||
|
||||
spacing += @floatToInt(i32, buildings[i].width);
|
||||
spacing += @as(i32, @intFromFloat(buildings[i].width));
|
||||
|
||||
buildColors[i] = rl.Color.init(@intCast(u8, rl.getRandomValue(200, 240)), @intCast(u8, rl.getRandomValue(200, 240)), @intCast(u8, rl.getRandomValue(200, 250)), 255);
|
||||
buildColors[i] = rl.Color.init(@as(u8, @intCast(rl.getRandomValue(200, 240))), @as(u8, @intCast(rl.getRandomValue(200, 240))), @as(u8, @intCast(rl.getRandomValue(200, 250))), 255);
|
||||
}
|
||||
|
||||
var camera = rl.Camera2D{
|
||||
@ -91,14 +91,14 @@ pub fn main() anyerror!void {
|
||||
|
||||
rl.drawRectangle(-6000, 320, 13000, 8000, rl.Color.dark_gray);
|
||||
|
||||
for (buildings) |building, i| {
|
||||
for (buildings, 0..) |building, i| {
|
||||
rl.drawRectangleRec(building, buildColors[i]);
|
||||
}
|
||||
|
||||
rl.drawRectangleRec(player, rl.Color.red);
|
||||
|
||||
rl.drawLine(@floatToInt(i32, camera.target.x), -screenHeight * 10, @floatToInt(i32, camera.target.x), screenHeight * 10, rl.Color.green);
|
||||
rl.drawLine(-screenWidth * 10, @floatToInt(i32, camera.target.y), screenWidth * 10, @floatToInt(i32, camera.target.y), rl.Color.green);
|
||||
rl.drawLine(@as(i32, @intFromFloat(camera.target.x)), -screenHeight * 10, @as(i32, @intFromFloat(camera.target.x)), screenHeight * 10, rl.Color.green);
|
||||
rl.drawLine(-screenWidth * 10, @as(i32, @intFromFloat(camera.target.y)), screenWidth * 10, @as(i32, @intFromFloat(camera.target.y)), rl.Color.green);
|
||||
}
|
||||
|
||||
rl.drawText("SCREEN AREA", 640, 10, 20, rl.Color.red);
|
||||
|
@ -25,14 +25,12 @@ pub fn main() anyerror!void {
|
||||
var positions: [MAX_COLUMNS]rl.Vector3 = undefined;
|
||||
var colors: [MAX_COLUMNS]rl.Color = undefined;
|
||||
|
||||
for (heights) |_, i| {
|
||||
heights[i] = @intToFloat(f32, rl.getRandomValue(1, 12));
|
||||
positions[i] = rl.Vector3.init(@intToFloat(f32, rl.getRandomValue(-15, 15)), heights[i] / 2.0, @intToFloat(f32, rl.getRandomValue(-15, 15)));
|
||||
colors[i] = rl.Color.init(@intCast(u8, rl.getRandomValue(20, 255)), @intCast(u8, rl.getRandomValue(10, 55)), 30, 255);
|
||||
for (0..heights.len) |i| {
|
||||
heights[i] = @as(f32, @floatFromInt(rl.getRandomValue(1, 12)));
|
||||
positions[i] = rl.Vector3.init(@as(f32, @floatFromInt(rl.getRandomValue(-15, 15))), heights[i] / 2.0, @as(f32, @floatFromInt(rl.getRandomValue(-15, 15))));
|
||||
colors[i] = rl.Color.init(@as(u8, @intCast(rl.getRandomValue(20, 255))), @as(u8, @intCast(rl.getRandomValue(10, 55))), 30, 255);
|
||||
}
|
||||
|
||||
camera.setMode(rl.CameraMode.camera_first_person);
|
||||
|
||||
rl.setTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
@ -40,7 +38,7 @@ pub fn main() anyerror!void {
|
||||
while (!rl.windowShouldClose()) { // Detect window close button or ESC key
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
camera.update();
|
||||
camera.update(rl.CameraMode.camera_first_person);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
@ -61,7 +59,7 @@ pub fn main() anyerror!void {
|
||||
rl.drawCube(rl.Vector3.init(0.0, 2.5, 16.0), 32.0, 5.0, 1.0, rl.Color.gold); // Draw a yellow wall
|
||||
|
||||
// Draw some cubes around
|
||||
for (heights) |height, i| {
|
||||
for (heights, 0..) |height, i| {
|
||||
rl.drawCube(positions[i], 2.0, height, 2.0, colors[i]);
|
||||
rl.drawCubeWires(positions[i], 2.0, height, 2.0, rl.Color.maroon);
|
||||
}
|
||||
|
@ -22,8 +22,8 @@ pub fn main() anyerror!void {
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
ballPosition = rl.getMousePosition();
|
||||
ballPosition.x = @intToFloat(f32, rl.getMouseX());
|
||||
ballPosition.y = @intToFloat(f32, rl.getMouseY());
|
||||
ballPosition.x = @as(f32, @floatFromInt(rl.getMouseX()));
|
||||
ballPosition.y = @as(f32, @floatFromInt(rl.getMouseY()));
|
||||
|
||||
if (rl.isMouseButtonPressed(rl.MouseButton.mouse_button_left)) {
|
||||
ballColor = rl.Color.maroon;
|
||||
|
@ -32,11 +32,11 @@ pub fn main() anyerror!void {
|
||||
|
||||
rl.clearBackground(rl.Color.white);
|
||||
|
||||
rl.drawRectangle(screenWidth / 2 - 40, @floatToInt(i32, boxPositionY), 80, 80, rl.Color.maroon);
|
||||
rl.drawRectangle(screenWidth / 2 - 40, @as(i32, @intFromFloat(boxPositionY)), 80, 80, rl.Color.maroon);
|
||||
|
||||
rl.drawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, rl.Color.gray);
|
||||
|
||||
rl.drawText(rl.textFormat("Box position Y: %03i", .{@floatToInt(c_int, boxPositionY)}), 10, 40, 20, rl.Color.light_gray);
|
||||
rl.drawText(rl.textFormat("Box position Y: %03i", .{@as(i32, @intFromFloat(boxPositionY))}), 10, 40, 20, rl.Color.light_gray);
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ pub fn main() anyerror!void {
|
||||
|
||||
// Draw circle and touch index number
|
||||
rl.drawCircleV(touchPosition, 34, rl.Color.orange);
|
||||
rl.drawText(rl.textFormat("%d", .{i}), @floatToInt(c_int, touchPosition.x) - 10, @floatToInt(c_int, touchPosition.y) - 70, 40, rl.Color.black);
|
||||
rl.drawText(rl.textFormat("%d", .{i}), @as(i32, @intFromFloat(touchPosition.x)) - 10, @as(i32, @intFromFloat(touchPosition.y)) - 70, 40, rl.Color.black);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ pub fn main() anyerror!void {
|
||||
|
||||
var outlineSize: f32 = 2.0;
|
||||
const outlineColor = [4]f32{ 1.0, 0.0, 0.0, 1.0 }; // Normalized RED color
|
||||
const textureSize = rl.Vector2.init(@intToFloat(f32, texture.width), @intToFloat(f32, texture.height));
|
||||
const textureSize = rl.Vector2.init(@as(f32, @floatFromInt(texture.width)), @as(f32, @floatFromInt(texture.height)));
|
||||
|
||||
// Get shader locations
|
||||
const outlineSizeLoc = rl.getShaderLocation(shdrOutline, "outlineSize");
|
||||
@ -31,9 +31,9 @@ pub fn main() anyerror!void {
|
||||
const textureSizeLoc = rl.getShaderLocation(shdrOutline, "textureSize");
|
||||
|
||||
// Set shader values (they can be changed later)
|
||||
rl.setShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, @enumToInt(rl.ShaderUniformDataType.shader_uniform_float));
|
||||
rl.setShaderValue(shdrOutline, outlineColorLoc, &outlineColor, @enumToInt(rl.ShaderUniformDataType.shader_uniform_vec4));
|
||||
rl.setShaderValue(shdrOutline, textureSizeLoc, &textureSize, @enumToInt(rl.ShaderUniformDataType.shader_uniform_vec2));
|
||||
rl.setShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, @intFromEnum(rl.ShaderUniformDataType.shader_uniform_float));
|
||||
rl.setShaderValue(shdrOutline, outlineColorLoc, &outlineColor, @intFromEnum(rl.ShaderUniformDataType.shader_uniform_vec4));
|
||||
rl.setShaderValue(shdrOutline, textureSizeLoc, &textureSize, @intFromEnum(rl.ShaderUniformDataType.shader_uniform_vec2));
|
||||
|
||||
rl.setTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
@ -45,7 +45,7 @@ pub fn main() anyerror!void {
|
||||
outlineSize += rl.getMouseWheelMove();
|
||||
if (outlineSize < 1.0) outlineSize = 1.0;
|
||||
|
||||
rl.setShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, @enumToInt(rl.ShaderUniformDataType.shader_uniform_float));
|
||||
rl.setShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, @intFromEnum(rl.ShaderUniformDataType.shader_uniform_float));
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
@ -64,7 +64,7 @@ pub fn main() anyerror!void {
|
||||
|
||||
rl.drawText("Shader-based\ntexture\noutline", 10, 10, 20, rl.Color.gray);
|
||||
|
||||
rl.drawText(rl.textFormat("Outline size: %i px", .{@floatToInt(i32, outlineSize)}), 10, 120, 20, rl.Color.maroon);
|
||||
rl.drawText(rl.textFormat("Outline size: %i px", .{@as(i32, @intFromFloat(outlineSize))}), 10, 120, 20, rl.Color.maroon);
|
||||
|
||||
rl.drawFPS(710, 10);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -21,7 +21,7 @@ pub fn main() anyerror!void {
|
||||
defer rl.unloadTexture(scarfy); // Texture unloading
|
||||
|
||||
const position = rl.Vector2.init(350.0, 280.0);
|
||||
var frameRec = rl.Rectangle.init(0, 0, @intToFloat(f32, @divFloor(scarfy.width, 6)), @intToFloat(f32, scarfy.height));
|
||||
var frameRec = rl.Rectangle.init(0, 0, @as(f32, @floatFromInt(@divFloor(scarfy.width, 6))), @as(f32, @floatFromInt(scarfy.height)));
|
||||
var currentFrame: u8 = 0;
|
||||
|
||||
var framesCounter: u8 = 0;
|
||||
@ -42,7 +42,7 @@ pub fn main() anyerror!void {
|
||||
|
||||
if (currentFrame > 5) currentFrame = 0;
|
||||
|
||||
frameRec.x = @intToFloat(f32, currentFrame) * @intToFloat(f32, @divFloor(scarfy.width, 6));
|
||||
frameRec.x = @as(f32, @floatFromInt(currentFrame)) * @as(f32, @floatFromInt(@divFloor(scarfy.width, 6)));
|
||||
}
|
||||
|
||||
// Control frames speed
|
||||
@ -69,17 +69,17 @@ pub fn main() anyerror!void {
|
||||
|
||||
rl.drawTexture(scarfy, 15, 40, rl.Color.white);
|
||||
rl.drawRectangleLines(15, 40, scarfy.width, scarfy.height, rl.Color.lime);
|
||||
rl.drawRectangleLines(15 + @floatToInt(i32, frameRec.x), 40 + @floatToInt(i32, frameRec.y), @floatToInt(i32, frameRec.width), @floatToInt(i32, frameRec.height), rl.Color.red);
|
||||
rl.drawRectangleLines(15 + @as(i32, @intFromFloat(frameRec.x)), 40 + @as(i32, @intFromFloat(frameRec.y)), @as(i32, @intFromFloat(frameRec.width)), @as(i32, @intFromFloat(frameRec.height)), rl.Color.red);
|
||||
|
||||
rl.drawText("FRAME SPEED: ", 165, 210, 10, rl.Color.dark_gray);
|
||||
rl.drawText(rl.textFormat("%02i FPS", .{framesSpeed}), 575, 210, 10, rl.Color.dark_gray);
|
||||
rl.drawText("PRESS RIGHT/LEFT KEYS to CHANGE SPEED!", 290, 240, 10, rl.Color.dark_gray);
|
||||
|
||||
for ([_]u32{0} ** MAX_FRAME_SPEED) |_, i| {
|
||||
for ([_]u32{0} ** MAX_FRAME_SPEED, 0..) |_, i| {
|
||||
if (i < framesSpeed) {
|
||||
rl.drawRectangle(250 + 21 * @intCast(i32, i), 205, 20, 20, rl.Color.red);
|
||||
rl.drawRectangle(250 + 21 * @as(i32, @intCast(i)), 205, 20, 20, rl.Color.red);
|
||||
}
|
||||
rl.drawRectangleLines(250 + 21 * @intCast(i32, i), 205, 20, 20, rl.Color.maroon);
|
||||
rl.drawRectangleLines(250 + 21 * @as(i32, @intCast(i)), 205, 20, 20, rl.Color.maroon);
|
||||
}
|
||||
|
||||
scarfy.drawRec(frameRec, position, rl.Color.white); // Draw part of the texture
|
||||
|
11
lib.zig
11
lib.zig
@ -3,20 +3,14 @@ const Builder = std.build.Builder;
|
||||
const LibExeObjStep = std.build.LibExeObjStep;
|
||||
const rl = @import("raylib/src/build.zig");
|
||||
|
||||
var ran_git = false;
|
||||
const srcdir = getSrcDir();
|
||||
|
||||
fn getSrcDir() []const u8 {
|
||||
return std.fs.path.dirname(@src().file) orelse ".";
|
||||
}
|
||||
|
||||
pub fn link(exe: *LibExeObjStep, system_lib: bool) void {
|
||||
if (system_lib) {
|
||||
exe.linkSystemLibrary("raylib");
|
||||
return;
|
||||
} else {
|
||||
exe.linkLibrary(rl.addRaylib(exe.builder, exe.target));
|
||||
}
|
||||
pub fn link(exe: *std.Build.CompileStep) void {
|
||||
exe.linkLibrary(rl.addRaylib(exe.builder, exe.target));
|
||||
|
||||
const target_os = exe.target.toTarget().os.tag;
|
||||
switch (target_os) {
|
||||
@ -57,6 +51,7 @@ pub fn link(exe: *LibExeObjStep, system_lib: bool) void {
|
||||
pub fn addAsPackage(name: []const u8, to: *LibExeObjStep) void {
|
||||
to.addPackagePath(name, srcdir ++ "/lib/raylib-zig.zig");
|
||||
}
|
||||
|
||||
pub const math = struct {
|
||||
pub fn addAsPackage(name: []const u8, to: *LibExeObjStep) void {
|
||||
to.addPackagePath(name, srcdir ++ "/lib/raylib-zig-math.zig");
|
||||
|
@ -38,8 +38,8 @@ def c_to_zig_type(c: str) -> str:
|
||||
def ziggify_type(name: str, t: str) -> str:
|
||||
NO_STRINGS = ["data", "fileData", "compData"]
|
||||
|
||||
single = ["value", "ptr", "bytesRead", "compDataSize", "dataSize", "outputSize", "camera", "collisionPoint", "frames", "image", "colorCount", "dst", "texture", "srcPtr", "dstPtr", "count", "codepointSize", "utf8Size", "position", "mesh", "materialCount", "material", "model", "animCount", "wave", "v1", "v2", "outAxis", "outAngle"]
|
||||
multi = ["data", "compData", "points", "fileData", "colors", "pixels", "fontChars", "chars", "recs", "codepoints", "textList", "transforms", "animations", "samples", "LoadImageColors", "LoadImagePalette", "LoadFontData", "LoadCodepoints", "TextSplit", "LoadMaterials", "LoadModelAnimations", "LoadWaveSamples"]
|
||||
single = ["value", "ptr", "bytesRead", "compDataSize", "dataSize", "outputSize", "camera", "collisionPoint", "frames", "image", "colorCount", "dst", "texture", "srcPtr", "dstPtr", "count", "codepointSize", "utf8Size", "position", "mesh", "materialCount", "material", "model", "animCount", "wave", "v1", "v2", "outAxis", "outAngle", "fileSize"]
|
||||
multi = ["data", "compData", "points", "fileData", "colors", "pixels", "fontChars", "chars", "recs", "codepoints", "textList", "transforms", "animations", "samples", "LoadImageColors", "LoadImagePalette", "LoadFontData", "LoadCodepoints", "TextSplit", "LoadMaterials", "LoadModelAnimations", "LoadWaveSamples", "images"]
|
||||
string = False
|
||||
|
||||
if t.startswith("[*c]") and name not in single and name not in multi:
|
||||
@ -126,7 +126,7 @@ def fix_enums(arg_name, arg_type, func_name):
|
||||
arg_type = "GamepadButton"
|
||||
else:
|
||||
arg_type = "MouseButton"
|
||||
elif arg_name == "mode" and func_name == "SetCameraMode":
|
||||
elif arg_name == "mode" and func_name == "UpdateCamera":
|
||||
arg_type = "CameraMode"
|
||||
elif arg_name == "gesture":
|
||||
arg_type = "Gesture"
|
||||
@ -227,7 +227,7 @@ def parse_header(header_name: str, output_file: str, ext_file: str, prefix: str,
|
||||
zig_call_args.append(arg_name)
|
||||
else:
|
||||
if arg_type.startswith("[*c]"):
|
||||
zig_call_args.append(f"@ptrCast({arg_type}, {arg_name})")
|
||||
zig_call_args.append(f"@as({arg_type}, @ptrCast({arg_name}))")
|
||||
else:
|
||||
zig_call_args.append(f"@as({arg_type}, {arg_name})")
|
||||
zig_c_arguments = ", ".join(zig_c_arguments)
|
||||
@ -254,7 +254,8 @@ def parse_header(header_name: str, output_file: str, ext_file: str, prefix: str,
|
||||
"CompressData",
|
||||
"DecompressData",
|
||||
"EncodeDataBase64",
|
||||
"DecodeDataBase64"
|
||||
"DecodeDataBase64",
|
||||
"SetWindowIcons"
|
||||
]
|
||||
|
||||
if func_name in manual or "FromMemory" in func_name:
|
||||
@ -283,5 +284,5 @@ def parse_header(header_name: str, output_file: str, ext_file: str, prefix: str,
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parse_header("../raylib/src/raylib.h", "raylib-zig.zig", "raylib-zig-ext.zig", "RLAPI ", "preludes/raylib-zig-prelude.zig", "preludes/raylib-zig-ext-prelude.zig")
|
||||
parse_header("../raylib/src/raymath.h", "raylib-zig-math.zig", "raylib-zig-math-ext.zig", "RMAPI ", "preludes/raylib-zig-math-prelude.zig", "preludes/raylib-zig-math-ext-prelude.zig")
|
||||
parse_header("raylib.h", "raylib-zig.zig", "raylib-zig-ext.zig", "RLAPI ", "preludes/raylib-zig-prelude.zig", "preludes/raylib-zig-ext-prelude.zig")
|
||||
parse_header("raymath.h", "raylib-zig-math.zig", "raylib-zig-math-ext.zig", "RMAPI ", "preludes/raylib-zig-math-prelude.zig", "preludes/raylib-zig-math-ext-prelude.zig")
|
||||
|
@ -198,18 +198,18 @@ pub const Image = extern struct {
|
||||
return rl.genImageColor(width, height, color);
|
||||
}
|
||||
|
||||
pub fn genGradientV(width: i32, height: i32, top: Color, bottom: Color) Image {
|
||||
return rl.genImageGradientV(width, height, top, bottom);
|
||||
}
|
||||
|
||||
pub fn genGradientH(width: i32, height: i32, left: Color, right: Color) Image {
|
||||
return rl.genImageGradientH(width, height, left, right);
|
||||
pub fn genGradientLinear(width: i32, height: i32, direction: i32, start: Color, end: Color) Image {
|
||||
return rl.genImageGradientLinear(width, height, direction, start, end);
|
||||
}
|
||||
|
||||
pub fn genGradientRadial(width: i32, height: i32, density: f32, inner: Color, outer: Color) Image {
|
||||
return rl.genImageGradientRadial(width, height, density, inner, outer);
|
||||
}
|
||||
|
||||
pub fn genGradientSquare(width: i32, height: i32, density: f32, inner: Color, outer: Color) Image {
|
||||
return rl.genImageGradientSquare(width, height, density, inner, outer);
|
||||
}
|
||||
|
||||
pub fn genChecked(width: i32, height: i32, checksX: i32, checksY: i32, col1: Color, col2: Color) Image {
|
||||
return rl.genImageChecked(width, height, checksX, checksY, col1, col2);
|
||||
}
|
||||
@ -300,6 +300,10 @@ pub const Image = extern struct {
|
||||
rl.imageFlipHorizontal(self);
|
||||
}
|
||||
|
||||
pub fn rotate(self: *Image, degrees: f32) void {
|
||||
rl.imageRotate(self, degrees);
|
||||
}
|
||||
|
||||
pub fn rotateCW(self: *Image) void {
|
||||
rl.imageRotateCW(self);
|
||||
}
|
||||
@ -337,71 +341,71 @@ pub const Image = extern struct {
|
||||
}
|
||||
|
||||
pub fn getColor(self: Image, x: i32, y: i32) Color {
|
||||
return cdef.GetImageColor(self, x, y);
|
||||
return rl.getImageColor(self, x, y);
|
||||
}
|
||||
|
||||
pub fn clearBackground(self: *Image, color: Color) void {
|
||||
cdef.ImageClearBackground(self, color);
|
||||
rl.imageClearBackground(self, color);
|
||||
}
|
||||
|
||||
pub fn drawPixel(self: *Image, posX: i32, posY: i32, color: Color) void {
|
||||
cdef.ImageDrawPixel(self, posX, posY, color);
|
||||
rl.imageDrawPixel(self, posX, posY, color);
|
||||
}
|
||||
|
||||
pub fn drawPixelV(self: *Image, position: Vector2, color: Color) void {
|
||||
cdef.ImageDrawPixelV(self, position, color);
|
||||
rl.imageDrawPixelV(self, position, color);
|
||||
}
|
||||
|
||||
pub fn drawLine(self: *Image, startPosX: i32, startPosY: i32, endPosX: i32, endPosY: i32, color: Color) void {
|
||||
cdef.ImageDrawLine(self, startPosX, startPosY, endPosX, endPosY, color);
|
||||
rl.imageDrawLine(self, startPosX, startPosY, endPosX, endPosY, color);
|
||||
}
|
||||
|
||||
pub fn drawLineV(self: *Image, start: Vector2, end: Vector2, color: Color) void {
|
||||
cdef.ImageDrawLineV(self, start, end, color);
|
||||
rl.imageDrawLineV(self, start, end, color);
|
||||
}
|
||||
|
||||
pub fn drawCircle(self: *Image, centerX: i32, centerY: i32, radius: i32, color: Color) void {
|
||||
cdef.ImageDrawCircle(self, centerX, centerY, radius, color);
|
||||
rl.imageDrawCircle(self, centerX, centerY, radius, color);
|
||||
}
|
||||
|
||||
pub fn drawCircleV(self: *Image, center: Vector2, radius: i32, color: Color) void {
|
||||
cdef.ImageDrawCircleV(self, center, radius, color);
|
||||
rl.imageDrawCircleV(self, center, radius, color);
|
||||
}
|
||||
|
||||
pub fn drawCircleLines(self: *Image, centerX: i32, centerY: i32, radius: i32, color: Color) void {
|
||||
cdef.ImageDrawCircleLines(self, centerX, centerY, radius, color);
|
||||
rl.imageDrawCircleLines(self, centerX, centerY, radius, color);
|
||||
}
|
||||
|
||||
pub fn drawCircleLinesV(self: *Image, center: Vector2, radius: i32, color: Color) void {
|
||||
cdef.ImageDrawCircleLinesV(self, center, radius, color);
|
||||
rl.imageDrawCircleLinesV(self, center, radius, color);
|
||||
}
|
||||
|
||||
pub fn drawRectangle(self: *Image, posX: i32, posY: i32, width: i32, height: i32, color: Color) void {
|
||||
cdef.ImageDrawRectangle(self, posX, posY, width, height, color);
|
||||
rl.imageDrawRectangle(self, posX, posY, width, height, color);
|
||||
}
|
||||
|
||||
pub fn drawRectangleV(self: *Image, position: Vector2, size: Vector2, color: Color) void {
|
||||
cdef.ImageDrawRectangleV(self, position, size, color);
|
||||
rl.imageDrawRectangleV(self, position, size, color);
|
||||
}
|
||||
|
||||
pub fn drawRectangleRec(self: *Image, rec: Rectangle, color: Color) void {
|
||||
cdef.ImageDrawRectangleRec(self, rec, color);
|
||||
rl.imageDrawRectangleRec(self, rec, color);
|
||||
}
|
||||
|
||||
pub fn drawRectangleLines(self: *Image, rec: Rectangle, thick: i32, color: Color) void {
|
||||
cdef.ImageDrawRectangleLines(self, rec, @as(c_int, thick), color);
|
||||
rl.imageDrawRectangleLines(self, rec, @as(c_int, thick), color);
|
||||
}
|
||||
|
||||
pub fn drawImage(self: *Image, src: Image, srcRec: Rectangle, dstRec: Rectangle, t: Color) void {
|
||||
cdef.ImageDraw(self, src, srcRec, dstRec, t);
|
||||
rl.imageDraw(self, src, srcRec, dstRec, t);
|
||||
}
|
||||
|
||||
pub fn drawText(self: *Image, text: [:0]const u8, posX: i32, posY: i32, fontSize: i32, color: Color) void {
|
||||
cdef.ImageDrawText(self, @ptrCast([*c]const u8, text), posX, posY, fontSize, color);
|
||||
rl.imageDrawText(self, text, posX, posY, fontSize, color);
|
||||
}
|
||||
|
||||
pub fn drawTextEx(self: *Image, font: Font, text: [:0]const u8, position: Vector2, fontSize: f32, spacing: f32, t: Color) void {
|
||||
cdef.ImageDrawTextEx(self, font, @ptrCast([*c]const u8, text), position, fontSize, spacing, t);
|
||||
rl.imageDrawTextEx(self, font, text, position, fontSize, spacing, t);
|
||||
}
|
||||
|
||||
pub fn exportToFile(self: Image, fileName: [:0]const u8) bool {
|
||||
@ -564,18 +568,14 @@ pub const Camera3D = extern struct {
|
||||
rl.beginMode3D(self);
|
||||
}
|
||||
|
||||
pub fn update(self: *Camera3D) void {
|
||||
rl.updateCamera(self);
|
||||
pub fn update(self: *Camera3D, mode: rl.CameraMode) void {
|
||||
rl.updateCamera(self, mode);
|
||||
}
|
||||
|
||||
pub fn getMatrix(self: Camera3D) Matrix {
|
||||
return rl.getCameraMatrix(self);
|
||||
}
|
||||
|
||||
pub fn setMode(self: Camera3D, mode: CameraMode) void {
|
||||
rl.setCameraMode(self, mode);
|
||||
}
|
||||
|
||||
pub fn end(_: Camera3D) void {
|
||||
rl.endMode3D();
|
||||
}
|
||||
@ -1155,9 +1155,9 @@ pub const SaveFileTextCallback = ?fn ([*c]const u8, [*c]u8) callconv(.C) bool;
|
||||
pub const AudioCallback = ?*const fn (?*anyopaque, c_uint) callconv(.C) void;
|
||||
|
||||
pub const RAYLIB_VERSION_MAJOR = @as(i32, 4);
|
||||
pub const RAYLIB_VERSION_MINOR = @as(i32, 5);
|
||||
pub const RAYLIB_VERSION_MINOR = @as(i32, 6);
|
||||
pub const RAYLIB_VERSION_PATCH = @as(i32, 0);
|
||||
pub const RAYLIB_VERSION = "4.5-dev";
|
||||
pub const RAYLIB_VERSION = "4.6-dev";
|
||||
|
||||
pub const MAX_TOUCH_POINTS = 10;
|
||||
pub const MAX_MATERIAL_MAPS = 12;
|
||||
@ -1170,14 +1170,18 @@ pub const SHADER_LOC_MAP_SPECULAR = ShaderLocationIndex.SHADER_LOC_MAP_METALNESS
|
||||
|
||||
const cdef = @import("raylib-zig-ext.zig");
|
||||
|
||||
pub fn setWindowIcons(images: []Image) void {
|
||||
cdef.SetWindowIcons(@as([*c]Image, @ptrCast(images)), @as(c_int, @intCast(images.len)));
|
||||
}
|
||||
|
||||
pub fn loadShader(vsFileName: ?[:0]const u8, fsFileName: ?[:0]const u8) Shader {
|
||||
var vsFileNameFinal = @as([*c]const u8, 0);
|
||||
var fsFileNameFinal = @as([*c]const u8, 0);
|
||||
if (vsFileName) |vsFileNameSure| {
|
||||
vsFileNameFinal = @ptrCast([*c]const u8, vsFileNameSure);
|
||||
vsFileNameFinal = @as([*c]const u8, @ptrCast(vsFileNameSure));
|
||||
}
|
||||
if (fsFileName) |fsFileNameSure| {
|
||||
fsFileNameFinal = @ptrCast([*c]const u8, fsFileNameSure);
|
||||
fsFileNameFinal = @as([*c]const u8, @ptrCast(fsFileNameSure));
|
||||
}
|
||||
return cdef.LoadShader(vsFileNameFinal, fsFileNameFinal);
|
||||
}
|
||||
@ -1186,10 +1190,10 @@ pub fn loadShaderFromMemory(vsCode: ?[:0]const u8, fsCode: ?[:0]const u8) Shader
|
||||
var vsCodeFinal = @as([*c]const u8, 0);
|
||||
var fsCodeFinal = @as([*c]const u8, 0);
|
||||
if (vsCode) |vsCodeSure| {
|
||||
vsCodeFinal = @ptrCast([*c]const u8, vsCodeSure);
|
||||
vsCodeFinal = @as([*c]const u8, @ptrCast(vsCodeSure));
|
||||
}
|
||||
if (fsCode) |fsCodeSure| {
|
||||
fsCodeFinal = @ptrCast([*c]const u8, fsCodeSure);
|
||||
fsCodeFinal = @as([*c]const u8, @ptrCast(fsCodeSure));
|
||||
}
|
||||
return cdef.LoadShaderFromMemory(vsCodeFinal, fsCodeFinal);
|
||||
}
|
||||
@ -1197,67 +1201,67 @@ pub fn loadShaderFromMemory(vsCode: ?[:0]const u8, fsCode: ?[:0]const u8) Shader
|
||||
pub fn loadFileData(fileName: [:0]const u8) []u8 {
|
||||
var bytesRead = 0;
|
||||
var res: []u8 = undefined;
|
||||
res.ptr = @ptrCast([*]u8, cdef.LoadFileData(@ptrCast([*c]const u8, fileName), @ptrCast([*c]c_uint, &bytesRead)));
|
||||
res.len = @intCast(usize, bytesRead);
|
||||
res.ptr = @as([*]u8, @ptrCast(cdef.LoadFileData(@as([*c]const u8, @ptrCast(fileName)), @as([*c]c_uint, @ptrCast(&bytesRead)))));
|
||||
res.len = @as(usize, @intCast(bytesRead));
|
||||
return res;
|
||||
}
|
||||
|
||||
pub fn saveFileData(fileName: [:0]const u8, data: []anyopaque) bool {
|
||||
return cdef.SaveFileData(@ptrCast([*c]const u8, fileName), @ptrCast(*anyopaque, data.ptr), @intCast(c_uint, data.len));
|
||||
return cdef.SaveFileData(@as([*c]const u8, @ptrCast(fileName)), @as(*anyopaque, @ptrCast(data.ptr)), @as(c_uint, @intCast(data.len)));
|
||||
}
|
||||
|
||||
pub fn exportDataAsCode(data: []const u8, fileName: [:0]const u8) bool {
|
||||
return cdef.ExportDataAsCode(@ptrCast([*c]const u8, data), @intCast(c_uint, data.len), @ptrCast([*c]const u8, fileName));
|
||||
return cdef.ExportDataAsCode(@as([*c]const u8, @ptrCast(data)), @as(c_uint, @intCast(data.len)), @as([*c]const u8, @ptrCast(fileName)));
|
||||
}
|
||||
|
||||
pub fn compressData(data: []const u8) [:0]u8 {
|
||||
var compDataSize = 0;
|
||||
var res: []u8 = undefined;
|
||||
res.ptr = cdef.CompressData(@ptrCast([*c]const u8, data), @intCast(c_int, data.len), @ptrCast([*c]c_int, &compDataSize));
|
||||
res.len = @intCast(usize, compDataSize);
|
||||
res.ptr = cdef.CompressData(@as([*c]const u8, @ptrCast(data)), @as(c_int, @intCast(data.len)), @as([*c]c_int, @ptrCast(&compDataSize)));
|
||||
res.len = @as(usize, @intCast(compDataSize));
|
||||
return res;
|
||||
}
|
||||
|
||||
pub fn decompressData(compData: []const u8) [:0]u8 {
|
||||
var dataSize = 0;
|
||||
var res: []u8 = undefined;
|
||||
res.ptr = cdef.DecompressData(@ptrCast([*c]const u8, compData), @intCast(c_int, compData.len), @ptrCast([*c]c_int, &dataSize));
|
||||
res.len = @intCast(usize, dataSize);
|
||||
res.ptr = cdef.DecompressData(@as([*c]const u8, @ptrCast(compData)), @as(c_int, @intCast(compData.len)), @as([*c]c_int, @ptrCast(&dataSize)));
|
||||
res.len = @as(usize, @intCast(dataSize));
|
||||
return res;
|
||||
}
|
||||
|
||||
pub fn encodeDataBase64(data: []const u8) []u8 {
|
||||
var outputSize = 0;
|
||||
var res: []u8 = undefined;
|
||||
res.ptr = cdef.EncodeDataBase64(@ptrCast([*c]const u8, data), @intCast(c_int, data.len), @ptrCast([*c]c_int, &outputSize));
|
||||
res.len = @intCast(usize, outputSize);
|
||||
res.ptr = cdef.EncodeDataBase64(@as([*c]const u8, @ptrCast(data)), @as(c_int, @intCast(data.len)), @as([*c]const u8, @ptrCast(&outputSize)));
|
||||
res.len = @as(usize, @intCast(outputSize));
|
||||
return res;
|
||||
}
|
||||
|
||||
pub fn decodeDataBase64(data: []const u8) []u8 {
|
||||
var outputSize = 0;
|
||||
var res: []u8 = undefined;
|
||||
res.ptr = cdef.DecodeDataBase64(@ptrCast([*c]const u8, data), @ptrCast([*c]c_int, &outputSize));
|
||||
res.len = @intCast(usize, outputSize);
|
||||
res.ptr = cdef.DecodeDataBase64(@as([*c]const u8, @ptrCast(data)), @as([*c]const u8, @ptrCast(&outputSize)));
|
||||
res.len = @as(usize, @intCast(outputSize));
|
||||
return res;
|
||||
}
|
||||
|
||||
pub fn loadImageFromMemory(fileType: [:0]const u8, fileData: [:0]const u8) Image {
|
||||
return cdef.LoadImageFromMemory(@ptrCast([*c]const u8, fileType), @ptrCast([*c]const u8, fileData), @intCast(c_int, fileData.len));
|
||||
return cdef.LoadImageFromMemory(@as([*c]const u8, @ptrCast(fileType)), @as([*c]const u8, @ptrCast(fileData)), @as(c_int, @intCast(fileData.len)));
|
||||
}
|
||||
|
||||
pub fn loadImageColors(image: Image) []Color {
|
||||
var res: []Color = undefined;
|
||||
res.ptr = @ptrCast([*]Color, cdef.LoadImageColors(image));
|
||||
res.len = @intCast(usize, image.width * image.height);
|
||||
res.ptr = @as([*]Color, @ptrCast(cdef.LoadImageColors(image)));
|
||||
res.len = @as(usize, @intCast(image.width * image.height));
|
||||
return res;
|
||||
}
|
||||
|
||||
pub fn loadImagePalette(image: Image, maxPaletteSize: i32) []Color {
|
||||
var colorCount = 0;
|
||||
var res: []Color = undefined;
|
||||
res.ptr = @ptrCast([*]Color, cdef.LoadImagePalette(image, @as(c_int, maxPaletteSize), @ptrCast([*c]c_int, &colorCount)));
|
||||
res.len = @intCast(usize, colorCount);
|
||||
res.ptr = @as([*]Color, @ptrCast(cdef.LoadImagePalette(image, @as(c_int, maxPaletteSize), @as([*c]c_int, @ptrCast(&colorCount)))));
|
||||
res.len = @as(usize, @intCast(colorCount));
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -1265,16 +1269,16 @@ pub fn loadFontFromMemory(fileType: [:0]const u8, fileData: ?[]const u8, fontSiz
|
||||
var fileDataFinal = @as([*c]const u8, 0);
|
||||
var fileDataLen = 0;
|
||||
if (fileData) |fileDataSure| {
|
||||
fileDataFinal = @ptrCast([*c]const u8, fileDataSure);
|
||||
fileDataFinal = @as([*c]const u8, @ptrCast(fileDataSure));
|
||||
fileDataLen = fileDataSure.len;
|
||||
}
|
||||
return cdef.LoadFontFromMemory(@ptrCast([*c]const u8, fileType), @ptrCast([*c]const u8, fileDataFinal), @intCast(c_int, fileDataLen), @as(c_int, fontSize), @ptrCast([*c]c_int, fontChars), @intCast(c_int, fontChars.len));
|
||||
return cdef.LoadFontFromMemory(@as([*c]const u8, @ptrCast(fileType)), @as([*c]const u8, @ptrCast(fileDataFinal)), @as(c_int, @intCast(fileDataLen)), @as(c_int, fontSize), @as([*c]c_int, @ptrCast(fontChars)), @as(c_int, @intCast(fontChars.len)));
|
||||
}
|
||||
|
||||
pub fn loadFontData(fileData: []const u8, fontSize: i32, fontChars: []i32, ty: i32) []GlyphInfo {
|
||||
var res: []GlyphInfo = undefined;
|
||||
res.ptr = @ptrCast([*]GlyphInfo, cdef.LoadFontData(@ptrCast([*c]const u8, fileData), @intCast(c_int, fileData.len), @as(c_int, fontSize), @ptrCast([*c]c_int, fontChars), @intCast(c_int, fontChars.len), @as(c_int, ty)));
|
||||
res.len = @intCast(usize, fontChars.len);
|
||||
res.ptr = @as([*]GlyphInfo, @ptrCast(cdef.LoadFontData(@as([*c]const u8, @ptrCast(fileData)), @as(c_int, @intCast(fileData.len)), @as(c_int, fontSize), @as([*c]c_int, @ptrCast(fontChars)), @as(c_int, @intCast(fontChars.len)), @as(c_int, ty))));
|
||||
res.len = @as(usize, @intCast(fontChars.len));
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -1284,58 +1288,58 @@ pub fn loadCodepoints(text: [:0]const u8) []i32 {
|
||||
}
|
||||
var count = 0;
|
||||
var res: []i32 = undefined;
|
||||
res.ptr = @ptrCast([*]i32, cdef.LoadCodepoints(@ptrCast([*c]const u8, text), @ptrCast([*c]c_int, &count)));
|
||||
res.len = @intCast(usize, count);
|
||||
res.ptr = @as([*]i32, @ptrCast(cdef.LoadCodepoints(@as([*c]const u8, @ptrCast(text)), @as([*c]c_int, @ptrCast(&count)))));
|
||||
res.len = @as(usize, @intCast(count));
|
||||
return res;
|
||||
}
|
||||
|
||||
pub fn textFormat(text: [:0]const u8, args: anytype) [:0]const u8 {
|
||||
return std.mem.span(@call(.{}, cdef.TextFormat, .{@ptrCast([*c]const u8, text)} ++ args));
|
||||
return std.mem.span(@call(.{}, cdef.TextFormat, .{@as([*c]const u8, @ptrCast(text))} ++ args));
|
||||
}
|
||||
|
||||
pub fn textSplit(text: [:0]const u8, delimiter: u8) [][:0]const u8 {
|
||||
var count = 0;
|
||||
var res: [][*]const u8 = undefined;
|
||||
res.ptr = @ptrCast([*][*]const u8, cdef.TextSplit(@ptrCast([*c]const u8, text), delimiter, @ptrCast([*c]c_int, &count)));
|
||||
res.len = @intCast(usize, count);
|
||||
res.ptr = @as([*][:0]const u8, @ptrCast(cdef.TextSplit(@as([*c]const u8, @ptrCast(text)), delimiter, @as([*c]c_int, @ptrCast(&count)))));
|
||||
res.len = @as(usize, @intCast(count));
|
||||
return res;
|
||||
}
|
||||
|
||||
pub fn drawMeshInstanced(mesh: Mesh, material: Material, transforms: []const Matrix) void {
|
||||
cdef.DrawMeshInstanced(mesh, material, @ptrCast([*c]const Matrix, transforms), @intCast(c_int, transforms.len));
|
||||
cdef.DrawMeshInstanced(mesh, material, @as([*c]const Matrix, @ptrCast(transforms)), @as(c_int, @intCast(transforms.len)));
|
||||
}
|
||||
|
||||
pub fn loadMaterials(fileName: [:0]const u8) []Material {
|
||||
var materialCount = 0;
|
||||
var res: []Material = undefined;
|
||||
res.ptr = @ptrCast([*]Material, cdef.LoadMaterials(@ptrCast([*c]const u8, fileName), @ptrCast([*c]c_int, &materialCount)));
|
||||
res.len = @intCast(usize, materialCount);
|
||||
res.ptr = @as([*]Material, @ptrCast(cdef.LoadMaterials(@as([*c]const u8, @ptrCast(fileName)), @as([*c]c_int, @ptrCast(&materialCount)))));
|
||||
res.len = @as(usize, @intCast(materialCount));
|
||||
return res;
|
||||
}
|
||||
|
||||
pub fn loadModelAnimations(fileName: [:0]const u8) []ModelAnimation {
|
||||
var animCount = 0;
|
||||
var res: []ModelAnimation = undefined;
|
||||
res.ptr = @ptrCast([*]ModelAnimation, cdef.LoadModelAnimations(@ptrCast([*c]const u8, fileName), @ptrCast([*c]c_uint, &animCount)));
|
||||
res.len = @intCast(usize, animCount);
|
||||
res.ptr = @as([*]ModelAnimation, @ptrCast(cdef.LoadModelAnimations(@as([*c]const u8, @ptrCast(fileName)), @as([*c]c_uint, @ptrCast(&animCount)))));
|
||||
res.len = @as(usize, @intCast(animCount));
|
||||
return res;
|
||||
}
|
||||
|
||||
pub fn unloadModelAnimations(animations: []ModelAnimation) void {
|
||||
cdef.UnloadModelAnimations(@ptrCast([*c]ModelAnimation, animations), @intCast(c_uint, animations.len));
|
||||
cdef.UnloadModelAnimations(@as([*c]ModelAnimation, @ptrCast(animations)), @as(c_uint, @intCast(animations.len)));
|
||||
}
|
||||
|
||||
pub fn loadWaveFromMemory(fileType: [:0]const u8, fileData: []const u8) Wave {
|
||||
return cdef.LoadWaveFromMemory(@ptrCast([*c]const u8, fileType), @ptrCast([*c]const u8, fileData), @intCast(c_int, fileData.len));
|
||||
return cdef.LoadWaveFromMemory(@as([*c]const u8, @ptrCast(fileType)), @as([*c]const u8, @ptrCast(fileData)), @as(c_int, @intCast(fileData.len)));
|
||||
}
|
||||
|
||||
pub fn loadWaveSamples(wave: Wave) []f32 {
|
||||
var res: []f32 = undefined;
|
||||
res.ptr = @ptrCast([*]f32, cdef.LoadWaveSamples(wave));
|
||||
res.len = @intCast(usize, wave.frameCount * wave.channels);
|
||||
res.ptr = @as([*]f32, @ptrCast(cdef.LoadWaveSamples(wave)));
|
||||
res.len = @as(usize, @intCast(wave.frameCount * wave.channels));
|
||||
return res;
|
||||
}
|
||||
|
||||
pub fn loadMusicStreamFromMemory(fileType: [:0]const u8, data: []const u8) Music {
|
||||
return cdef.LoadMusicStreamFromMemory(@ptrCast([*c]const u8, fileType), @ptrCast([*c]const u8, data), @intCast(c_int, data.len));
|
||||
return cdef.LoadMusicStreamFromMemory(@as([*c]const u8, @ptrCast(fileType)), @as([*c]const u8, @ptrCast(data)), @as(c_int, @intCast(data.len)));
|
||||
}
|
||||
|
@ -20,12 +20,14 @@ pub extern "c" fn MaximizeWindow() void;
|
||||
pub extern "c" fn MinimizeWindow() void;
|
||||
pub extern "c" fn RestoreWindow() void;
|
||||
pub extern "c" fn SetWindowIcon(image: rl.Image) void;
|
||||
pub extern "c" fn SetWindowIcons(images: [*c]rl.Image, count: c_int) void;
|
||||
pub extern "c" fn SetWindowTitle(title: [*c]const u8) void;
|
||||
pub extern "c" fn SetWindowPosition(x: c_int, y: c_int) void;
|
||||
pub extern "c" fn SetWindowMonitor(monitor: c_int) void;
|
||||
pub extern "c" fn SetWindowMinSize(width: c_int, height: c_int) void;
|
||||
pub extern "c" fn SetWindowSize(width: c_int, height: c_int) void;
|
||||
pub extern "c" fn SetWindowOpacity(opacity: f32) void;
|
||||
pub extern "c" fn SetWindowFocused() void;
|
||||
pub extern "c" fn GetWindowHandle() *anyopaque;
|
||||
pub extern "c" fn GetScreenWidth() c_int;
|
||||
pub extern "c" fn GetScreenHeight() c_int;
|
||||
@ -76,6 +78,7 @@ pub extern "c" fn LoadVrStereoConfig(device: rl.VrDeviceInfo) rl.VrStereoConfig;
|
||||
pub extern "c" fn UnloadVrStereoConfig(config: rl.VrStereoConfig) void;
|
||||
pub extern "c" fn LoadShader(vsFileName: [*c]const u8, fsFileName: [*c]const u8) rl.Shader;
|
||||
pub extern "c" fn LoadShaderFromMemory(vsCode: [*c]const u8, fsCode: [*c]const u8) rl.Shader;
|
||||
pub extern "c" fn IsShaderReady(shader: rl.Shader) bool;
|
||||
pub extern "c" fn GetShaderLocation(shader: rl.Shader, uniformName: [*c]const u8) c_int;
|
||||
pub extern "c" fn GetShaderLocationAttrib(shader: rl.Shader, attribName: [*c]const u8) c_int;
|
||||
pub extern "c" fn SetShaderValue(shader: rl.Shader, locIndex: c_int, value: *const anyopaque, uniformType: c_int) void;
|
||||
@ -183,12 +186,8 @@ pub extern "c" fn GetGestureDragVector() rl.Vector2;
|
||||
pub extern "c" fn GetGestureDragAngle() f32;
|
||||
pub extern "c" fn GetGesturePinchVector() rl.Vector2;
|
||||
pub extern "c" fn GetGesturePinchAngle() f32;
|
||||
pub extern "c" fn SetCameraMode(camera: rl.Camera, mode: rl.CameraMode) void;
|
||||
pub extern "c" fn UpdateCamera(camera: [*c]rl.Camera) void;
|
||||
pub extern "c" fn SetCameraPanControl(keyPan: c_int) void;
|
||||
pub extern "c" fn SetCameraAltControl(keyAlt: c_int) void;
|
||||
pub extern "c" fn SetCameraSmoothZoomControl(keySmoothZoom: c_int) void;
|
||||
pub extern "c" fn SetCameraMoveControls(keyFront: c_int, keyBack: c_int, keyRight: c_int, keyLeft: c_int, keyUp: c_int, keyDown: c_int) void;
|
||||
pub extern "c" fn UpdateCamera(camera: [*c]rl.Camera, mode: rl.CameraMode) void;
|
||||
pub extern "c" fn UpdateCameraPro(camera: [*c]rl.Camera, movement: rl.Vector3, rotation: rl.Vector3, zoom: f32) void;
|
||||
pub extern "c" fn SetShapesTexture(texture: rl.Texture2D, source: rl.Rectangle) void;
|
||||
pub extern "c" fn DrawPixel(posX: c_int, posY: c_int, color: rl.Color) void;
|
||||
pub extern "c" fn DrawPixelV(position: rl.Vector2, color: rl.Color) void;
|
||||
@ -243,13 +242,15 @@ pub extern "c" fn LoadImageAnim(fileName: [*c]const u8, frames: [*c]c_int) rl.Im
|
||||
pub extern "c" fn LoadImageFromMemory(fileType: [*c]const u8, fileData: [*c]const u8, dataSize: c_int) rl.Image;
|
||||
pub extern "c" fn LoadImageFromTexture(texture: rl.Texture2D) rl.Image;
|
||||
pub extern "c" fn LoadImageFromScreen() rl.Image;
|
||||
pub extern "c" fn IsImageReady(image: rl.Image) bool;
|
||||
pub extern "c" fn UnloadImage(image: rl.Image) void;
|
||||
pub extern "c" fn ExportImage(image: rl.Image, fileName: [*c]const u8) bool;
|
||||
pub extern "c" fn ExportImageToMemory(image: rl.Image, fileType: [*c]const u8, fileSize: [*c]c_int) [*c]u8;
|
||||
pub extern "c" fn ExportImageAsCode(image: rl.Image, fileName: [*c]const u8) bool;
|
||||
pub extern "c" fn GenImageColor(width: c_int, height: c_int, color: rl.Color) rl.Image;
|
||||
pub extern "c" fn GenImageGradientV(width: c_int, height: c_int, top: rl.Color, bottom: rl.Color) rl.Image;
|
||||
pub extern "c" fn GenImageGradientH(width: c_int, height: c_int, left: rl.Color, right: rl.Color) rl.Image;
|
||||
pub extern "c" fn GenImageGradientLinear(width: c_int, height: c_int, direction: c_int, start: rl.Color, end: rl.Color) rl.Image;
|
||||
pub extern "c" fn GenImageGradientRadial(width: c_int, height: c_int, density: f32, inner: rl.Color, outer: rl.Color) rl.Image;
|
||||
pub extern "c" fn GenImageGradientSquare(width: c_int, height: c_int, density: f32, inner: rl.Color, outer: rl.Color) rl.Image;
|
||||
pub extern "c" fn GenImageChecked(width: c_int, height: c_int, checksX: c_int, checksY: c_int, col1: rl.Color, col2: rl.Color) rl.Image;
|
||||
pub extern "c" fn GenImageWhiteNoise(width: c_int, height: c_int, factor: f32) rl.Image;
|
||||
pub extern "c" fn GenImagePerlinNoise(width: c_int, height: c_int, offsetX: c_int, offsetY: c_int, scale: f32) rl.Image;
|
||||
@ -274,6 +275,7 @@ pub extern "c" fn ImageMipmaps(image: [*c]rl.Image) void;
|
||||
pub extern "c" fn ImageDither(image: [*c]rl.Image, rBpp: c_int, gBpp: c_int, bBpp: c_int, aBpp: c_int) void;
|
||||
pub extern "c" fn ImageFlipVertical(image: [*c]rl.Image) void;
|
||||
pub extern "c" fn ImageFlipHorizontal(image: [*c]rl.Image) void;
|
||||
pub extern "c" fn ImageRotate(image: [*c]rl.Image, degrees: c_int) void;
|
||||
pub extern "c" fn ImageRotateCW(image: [*c]rl.Image) void;
|
||||
pub extern "c" fn ImageRotateCCW(image: [*c]rl.Image) void;
|
||||
pub extern "c" fn ImageColorTint(image: [*c]rl.Image, color: rl.Color) void;
|
||||
@ -308,7 +310,9 @@ pub extern "c" fn LoadTexture(fileName: [*c]const u8) rl.Texture2D;
|
||||
pub extern "c" fn LoadTextureFromImage(image: rl.Image) rl.Texture2D;
|
||||
pub extern "c" fn LoadTextureCubemap(image: rl.Image, layout: c_int) rl.TextureCubemap;
|
||||
pub extern "c" fn LoadRenderTexture(width: c_int, height: c_int) rl.RenderTexture2D;
|
||||
pub extern "c" fn IsTextureReady(texture: rl.Texture2D) bool;
|
||||
pub extern "c" fn UnloadTexture(texture: rl.Texture2D) void;
|
||||
pub extern "c" fn IsRenderTextureReady(target: rl.RenderTexture2D) bool;
|
||||
pub extern "c" fn UnloadRenderTexture(target: rl.RenderTexture2D) void;
|
||||
pub extern "c" fn UpdateTexture(texture: rl.Texture2D, pixels: *const anyopaque) void;
|
||||
pub extern "c" fn UpdateTextureRec(texture: rl.Texture2D, rec: rl.Rectangle, pixels: *const anyopaque) void;
|
||||
@ -341,6 +345,7 @@ pub extern "c" fn LoadFont(fileName: [*c]const u8) rl.Font;
|
||||
pub extern "c" fn LoadFontEx(fileName: [*c]const u8, fontSize: c_int, fontChars: [*c]c_int, glyphCount: c_int) rl.Font;
|
||||
pub extern "c" fn LoadFontFromImage(image: rl.Image, key: rl.Color, firstChar: c_int) rl.Font;
|
||||
pub extern "c" fn LoadFontFromMemory(fileType: [*c]const u8, fileData: [*c]const u8, dataSize: c_int, fontSize: c_int, fontChars: [*c]c_int, glyphCount: c_int) rl.Font;
|
||||
pub extern "c" fn IsFontReady(font: rl.Font) bool;
|
||||
pub extern "c" fn LoadFontData(fileData: [*c]const u8, dataSize: c_int, fontSize: c_int, fontChars: [*c]c_int, glyphCount: c_int, ty: c_int) [*c]rl.GlyphInfo;
|
||||
pub extern "c" fn GenImageFontAtlas(chars: [*c]const rl.GlyphInfo, recs: [*c][*c]rl.Rectangle, glyphCount: c_int, fontSize: c_int, padding: c_int, packMethod: c_int) rl.Image;
|
||||
pub extern "c" fn UnloadFontData(chars: [*c]rl.GlyphInfo, glyphCount: c_int) void;
|
||||
@ -352,6 +357,7 @@ pub extern "c" fn DrawTextEx(font: rl.Font, text: [*c]const u8, position: rl.Vec
|
||||
pub extern "c" fn DrawTextPro(font: rl.Font, text: [*c]const u8, position: rl.Vector2, origin: rl.Vector2, rotation: f32, fontSize: f32, spacing: f32, tint: rl.Color) void;
|
||||
pub extern "c" fn DrawTextCodepoint(font: rl.Font, codepoint: c_int, position: rl.Vector2, fontSize: f32, tint: rl.Color) void;
|
||||
pub extern "c" fn DrawTextCodepoints(font: rl.Font, codepoints: [*c]const c_int, count: c_int, position: rl.Vector2, fontSize: f32, spacing: f32, tint: rl.Color) void;
|
||||
pub extern "c" fn SetTextLineSpacing(spacing: c_int) void;
|
||||
pub extern "c" fn MeasureText(text: [*c]const u8, fontSize: c_int) c_int;
|
||||
pub extern "c" fn MeasureTextEx(font: rl.Font, text: [*c]const u8, fontSize: f32, spacing: f32) rl.Vector2;
|
||||
pub extern "c" fn GetGlyphIndex(font: rl.Font, codepoint: c_int) c_int;
|
||||
@ -404,8 +410,8 @@ pub extern "c" fn DrawRay(ray: rl.Ray, color: rl.Color) void;
|
||||
pub extern "c" fn DrawGrid(slices: c_int, spacing: f32) void;
|
||||
pub extern "c" fn LoadModel(fileName: [*c]const u8) rl.Model;
|
||||
pub extern "c" fn LoadModelFromMesh(mesh: rl.Mesh) rl.Model;
|
||||
pub extern "c" fn IsModelReady(model: rl.Model) bool;
|
||||
pub extern "c" fn UnloadModel(model: rl.Model) void;
|
||||
pub extern "c" fn UnloadModelKeepMeshes(model: rl.Model) void;
|
||||
pub extern "c" fn GetModelBoundingBox(model: rl.Model) rl.BoundingBox;
|
||||
pub extern "c" fn DrawModel(model: rl.Model, position: rl.Vector3, scale: f32, tint: rl.Color) void;
|
||||
pub extern "c" fn DrawModelEx(model: rl.Model, position: rl.Vector3, rotationAxis: rl.Vector3, rotationAngle: f32, scale: rl.Vector3, tint: rl.Color) void;
|
||||
@ -436,6 +442,7 @@ pub extern "c" fn GenMeshHeightmap(heightmap: rl.Image, size: rl.Vector3) rl.Mes
|
||||
pub extern "c" fn GenMeshCubicmap(cubicmap: rl.Image, cubeSize: rl.Vector3) rl.Mesh;
|
||||
pub extern "c" fn LoadMaterials(fileName: [*c]const u8, materialCount: [*c]c_int) [*c]rl.Material;
|
||||
pub extern "c" fn LoadMaterialDefault() rl.Material;
|
||||
pub extern "c" fn IsMaterialReady(material: rl.Material) bool;
|
||||
pub extern "c" fn UnloadMaterial(material: rl.Material) void;
|
||||
pub extern "c" fn SetMaterialTexture(material: [*c]rl.Material, mapType: c_int, texture: rl.Texture2D) void;
|
||||
pub extern "c" fn SetModelMeshMaterial(model: [*c]rl.Model, meshId: c_int, materialId: c_int) void;
|
||||
@ -458,8 +465,10 @@ pub extern "c" fn IsAudioDeviceReady() bool;
|
||||
pub extern "c" fn SetMasterVolume(volume: f32) void;
|
||||
pub extern "c" fn LoadWave(fileName: [*c]const u8) rl.Wave;
|
||||
pub extern "c" fn LoadWaveFromMemory(fileType: [*c]const u8, fileData: [*c]const u8, dataSize: c_int) rl.Wave;
|
||||
pub extern "c" fn IsWaveReady(wave: rl.Wave) bool;
|
||||
pub extern "c" fn LoadSound(fileName: [*c]const u8) rl.Sound;
|
||||
pub extern "c" fn LoadSoundFromWave(wave: rl.Wave) rl.Sound;
|
||||
pub extern "c" fn IsSoundReady(sound: rl.Sound) bool;
|
||||
pub extern "c" fn UpdateSound(sound: rl.Sound, data: *const anyopaque, sampleCount: c_int) void;
|
||||
pub extern "c" fn UnloadWave(wave: rl.Wave) void;
|
||||
pub extern "c" fn UnloadSound(sound: rl.Sound) void;
|
||||
@ -469,9 +478,6 @@ pub extern "c" fn PlaySound(sound: rl.Sound) void;
|
||||
pub extern "c" fn StopSound(sound: rl.Sound) void;
|
||||
pub extern "c" fn PauseSound(sound: rl.Sound) void;
|
||||
pub extern "c" fn ResumeSound(sound: rl.Sound) void;
|
||||
pub extern "c" fn PlaySoundMulti(sound: rl.Sound) void;
|
||||
pub extern "c" fn StopSoundMulti() void;
|
||||
pub extern "c" fn GetSoundsPlaying() c_int;
|
||||
pub extern "c" fn IsSoundPlaying(sound: rl.Sound) bool;
|
||||
pub extern "c" fn SetSoundVolume(sound: rl.Sound, volume: f32) void;
|
||||
pub extern "c" fn SetSoundPitch(sound: rl.Sound, pitch: f32) void;
|
||||
@ -483,6 +489,7 @@ pub extern "c" fn LoadWaveSamples(wave: rl.Wave) [*c]f32;
|
||||
pub extern "c" fn UnloadWaveSamples(samples: [*c]f32) void;
|
||||
pub extern "c" fn LoadMusicStream(fileName: [*c]const u8) rl.Music;
|
||||
pub extern "c" fn LoadMusicStreamFromMemory(fileType: [*c]const u8, data: [*c]const u8, dataSize: c_int) rl.Music;
|
||||
pub extern "c" fn IsMusicReady(music: rl.Music) bool;
|
||||
pub extern "c" fn UnloadMusicStream(music: rl.Music) void;
|
||||
pub extern "c" fn PlayMusicStream(music: rl.Music) void;
|
||||
pub extern "c" fn IsMusicStreamPlaying(music: rl.Music) bool;
|
||||
@ -497,6 +504,7 @@ pub extern "c" fn SetMusicPan(music: rl.Music, pan: f32) void;
|
||||
pub extern "c" fn GetMusicTimeLength(music: rl.Music) f32;
|
||||
pub extern "c" fn GetMusicTimePlayed(music: rl.Music) f32;
|
||||
pub extern "c" fn LoadAudioStream(sampleRate: c_uint, sampleSize: c_uint, channels: c_uint) rl.AudioStream;
|
||||
pub extern "c" fn IsAudioStreamReady(stream: rl.AudioStream) bool;
|
||||
pub extern "c" fn UnloadAudioStream(stream: rl.AudioStream) void;
|
||||
pub extern "c" fn UpdateAudioStream(stream: rl.AudioStream, data: *const anyopaque, frameCount: c_int) void;
|
||||
pub extern "c" fn IsAudioStreamProcessed(stream: rl.AudioStream) bool;
|
||||
@ -512,3 +520,5 @@ pub extern "c" fn SetAudioStreamBufferSizeDefault(size: c_int) void;
|
||||
pub extern "c" fn SetAudioStreamCallback(stream: rl.AudioStream, callback: rl.AudioCallback) void;
|
||||
pub extern "c" fn AttachAudioStreamProcessor(stream: rl.AudioStream, processor: rl.AudioCallback) void;
|
||||
pub extern "c" fn DetachAudioStreamProcessor(stream: rl.AudioStream, processor: rl.AudioCallback) void;
|
||||
pub extern "c" fn AttachAudioMixedProcessor(processor: rl.AudioCallback) void;
|
||||
pub extern "c" fn DetachAudioMixedProcessor(processor: rl.AudioCallback) void;
|
||||
|
@ -21,6 +21,7 @@ pub extern "c" fn Vector2DotProduct(v1: rl.Vector2, v2: rl.Vector2) f32;
|
||||
pub extern "c" fn Vector2Distance(v1: rl.Vector2, v2: rl.Vector2) f32;
|
||||
pub extern "c" fn Vector2DistanceSqr(v1: rl.Vector2, v2: rl.Vector2) f32;
|
||||
pub extern "c" fn Vector2Angle(v1: rl.Vector2, v2: rl.Vector2) f32;
|
||||
pub extern "c" fn Vector2LineAngle(start: rl.Vector2, end: rl.Vector2) f32;
|
||||
pub extern "c" fn Vector2Scale(v: rl.Vector2, scale: f32) rl.Vector2;
|
||||
pub extern "c" fn Vector2Multiply(v1: rl.Vector2, v2: rl.Vector2) rl.Vector2;
|
||||
pub extern "c" fn Vector2Negate(v: rl.Vector2) rl.Vector2;
|
||||
@ -87,8 +88,8 @@ pub extern "c" fn MatrixRotateXYZ(angle: rl.Vector3) rl.Matrix;
|
||||
pub extern "c" fn MatrixRotateZYX(angle: rl.Vector3) rl.Matrix;
|
||||
pub extern "c" fn MatrixScale(x: f32, y: f32, z: f32) rl.Matrix;
|
||||
pub extern "c" fn MatrixFrustum(left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64) rl.Matrix;
|
||||
pub extern "c" fn MatrixPerspective(fovy: f64, aspect: f64, near: f64, far: f64) rl.Matrix;
|
||||
pub extern "c" fn MatrixOrtho(left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64) rl.Matrix;
|
||||
pub extern "c" fn MatrixPerspective(fovY: f64, aspect: f64, nearPlane: f64, farPlane: f64) rl.Matrix;
|
||||
pub extern "c" fn MatrixOrtho(left: f64, right: f64, bottom: f64, top: f64, nearPlane: f64, farPlane: f64) rl.Matrix;
|
||||
pub extern "c" fn MatrixLookAt(eye: rl.Vector3, target: rl.Vector3, up: rl.Vector3) rl.Matrix;
|
||||
pub extern "c" fn MatrixToFloatV(mat: rl.Matrix) rlm.float16;
|
||||
pub extern "c" fn QuaternionAdd(q1: rl.Quaternion, q2: rl.Quaternion) rl.Quaternion;
|
||||
|
@ -90,6 +90,10 @@ pub fn vector2Angle(v1: Vector2, v2: Vector2) f32 {
|
||||
return cdef.Vector2Angle(v1, v2);
|
||||
}
|
||||
|
||||
pub fn vector2LineAngle(start: Vector2, end: Vector2) f32 {
|
||||
return cdef.Vector2LineAngle(start, end);
|
||||
}
|
||||
|
||||
pub fn vector2Scale(v: Vector2, scale: f32) Vector2 {
|
||||
return cdef.Vector2Scale(v, scale);
|
||||
}
|
||||
@ -223,7 +227,7 @@ pub fn vector3Normalize(v: Vector3) Vector3 {
|
||||
}
|
||||
|
||||
pub fn vector3OrthoNormalize(v1: *Vector3, v2: *Vector3) void {
|
||||
cdef.Vector3OrthoNormalize(@ptrCast([*c]Vector3, v1), @ptrCast([*c]Vector3, v2));
|
||||
cdef.Vector3OrthoNormalize(@as([*c]Vector3, @ptrCast(v1)), @as([*c]Vector3, @ptrCast(v2)));
|
||||
}
|
||||
|
||||
pub fn vector3Transform(v: Vector3, mat: Matrix) Vector3 {
|
||||
@ -354,12 +358,12 @@ pub fn matrixFrustum(left: f64, right: f64, bottom: f64, top: f64, near: f64, fa
|
||||
return cdef.MatrixFrustum(left, right, bottom, top, near, far);
|
||||
}
|
||||
|
||||
pub fn matrixPerspective(fovy: f64, aspect: f64, near: f64, far: f64) Matrix {
|
||||
return cdef.MatrixPerspective(fovy, aspect, near, far);
|
||||
pub fn matrixPerspective(fovY: f64, aspect: f64, nearPlane: f64, farPlane: f64) Matrix {
|
||||
return cdef.MatrixPerspective(fovY, aspect, nearPlane, farPlane);
|
||||
}
|
||||
|
||||
pub fn matrixOrtho(left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64) Matrix {
|
||||
return cdef.MatrixOrtho(left, right, bottom, top, near, far);
|
||||
pub fn matrixOrtho(left: f64, right: f64, bottom: f64, top: f64, nearPlane: f64, farPlane: f64) Matrix {
|
||||
return cdef.MatrixOrtho(left, right, bottom, top, nearPlane, farPlane);
|
||||
}
|
||||
|
||||
pub fn matrixLookAt(eye: Vector3, target: Vector3, up: Vector3) Matrix {
|
||||
@ -443,7 +447,7 @@ pub fn quaternionFromAxisAngle(axis: Vector3, angle: f32) Quaternion {
|
||||
}
|
||||
|
||||
pub fn quaternionToAxisAngle(q: Quaternion, outAxis: *Vector3, outAngle: *f32) void {
|
||||
cdef.QuaternionToAxisAngle(q, @ptrCast([*c]Vector3, outAxis), @ptrCast([*c]f32, outAngle));
|
||||
cdef.QuaternionToAxisAngle(q, @as([*c]Vector3, @ptrCast(outAxis)), @as([*c]f32, @ptrCast(outAngle)));
|
||||
}
|
||||
|
||||
pub fn quaternionFromEuler(pitch: f32, yaw: f32, roll: f32) Quaternion {
|
||||
|
File diff suppressed because it is too large
Load Diff
1
raylib
1
raylib
@ -1 +0,0 @@
|
||||
Subproject commit 542ef8904a2ce9d87ab53289026da7a715907b87
|
Loading…
x
Reference in New Issue
Block a user