// raylib-zig (c) Nikolas Wipper 2023 const rl = @This(); pub const Vector2 = extern struct { x: f32, y: f32, pub fn init(x: f32, y: f32) Vector2 { return Vector2{ .x = x, .y = y }; } }; pub const Vector3 = extern struct { x: f32, y: f32, z: f32, pub fn init(x: f32, y: f32, z: f32) Vector3 { return Vector3{ .x = x, .y = y, .z = z }; } }; pub const Vector4 = extern struct { x: f32, y: f32, z: f32, w: f32, pub fn init(x: f32, y: f32, z: f32, w: f32) Vector4 { return Vector4{ .x = x, .y = y, .z = z, .w = w }; } }; pub const Quaternion = Vector4; pub const Matrix = extern struct { m0: f32, m4: f32, m8: f32, m12: f32, m1: f32, m5: f32, m9: f32, m13: f32, m2: f32, m6: f32, m10: f32, m14: f32, m3: f32, m7: f32, m11: f32, m15: f32, }; pub const Color = extern struct { r: u8, g: u8, b: u8, a: u8, pub const light_gray = Color.init(200, 200, 200, 255); pub const gray = Color.init(130, 130, 130, 255); pub const dark_gray = Color.init(80, 80, 80, 255); pub const yellow = Color.init(253, 249, 0, 255); pub const gold = Color.init(255, 203, 0, 255); pub const orange = Color.init(255, 161, 0, 255); pub const pink = Color.init(255, 161, 0, 255); pub const red = Color.init(230, 41, 55, 255); pub const maroon = Color.init(190, 33, 55, 255); pub const green = Color.init(0, 228, 48, 255); pub const lime = Color.init(0, 158, 47, 255); pub const dark_green = Color.init(0, 117, 44, 255); pub const sky_blue = Color.init(102, 191, 255, 255); pub const blue = Color.init(0, 121, 241, 255); pub const dark_blue = Color.init(0, 82, 172, 255); pub const purple = Color.init(200, 122, 255, 255); pub const violet = Color.init(135, 60, 190, 255); pub const dark_purple = Color.init(112, 31, 126, 255); pub const beige = Color.init(211, 176, 131, 255); pub const brown = Color.init(127, 106, 79, 255); pub const dark_brown = Color.init(76, 63, 47, 255); pub const white = Color.init(255, 255, 255, 255); pub const black = Color.init(0, 0, 0, 255); pub const blank = Color.init(0, 0, 0, 0); pub const magenta = Color.init(255, 0, 255, 255); pub const ray_white = Color.init(245, 245, 245, 255); pub fn init(r: u8, g: u8, b: u8, a: u8) Color { return Color{ .r = r, .g = g, .b = b, .a = a }; } pub fn fromNormalized(normalized: Vector4) Color { return rl.colorFromNormalized(normalized); } pub fn fromHSV(hue: f32, saturation: f32, value: f32) Color { return rl.colorFromHSV(hue, saturation, value); } pub fn fromInt(hexValue: u32) Color { return rl.getColor(hexValue); } pub fn fade(self: Color, a: f32) Color { return rl.fade(self, a); } pub fn tint(self: Color, t: Color) Color { return rl.colorTint(self, t); } pub fn normalize(self: Color) Vector4 { return rl.colorNormalize(self); } pub fn brightness(self: Color, factor: f32) Color { return rl.colorBrightness(self, factor); } pub fn constrast(self: Color, c: f32) Color { return rl.colorConstrast(self, c); } pub fn alpha(self: Color, a: f32) Color { return rl.colorAlpha(self, a); } pub fn toInt(self: Color) Color { return rl.colorToInt(self); } pub fn toHSV(self: Color) Vector3 { return rl.colorToHSV(self); } }; pub const Rectangle = extern struct { x: f32, y: f32, width: f32, height: f32, pub fn init(x: f32, y: f32, width: f32, height: f32) Rectangle { return Rectangle{ .x = x, .y = y, .width = width, .height = height }; } }; pub const Image = extern struct { data: ?*anyopaque, width: c_int, height: c_int, mipmaps: c_int, format: PixelFormat, pub fn init(fileName: [*c]const u8) Image { return rl.loadImage(fileName); } pub fn initRaw(fileName: *const []u8, width: c_int, height: c_int, format: PixelFormat, headerSize: c_int) Image { return rl.loadImageRaw(fileName, width, height, format, headerSize); } pub fn initText(text: *const []u8, fontSize: c_int, color: Color) Image { return rl.imageText(text, fontSize, color); } pub fn initTextEx(font: Font, text: *const []u8, fontSize: f32, spacing: f32, tint: Color) Image { return rl.imageTextEx(font, text, fontSize, spacing, tint); } pub fn copy(image: Image) Image { return rl.imageCopy(image); } pub fn copyRec(image: Image, rec: Rectangle) Image { return rl.imageFromImage(image, rec); } pub fn genColor(width: c_int, height: c_int, color: Color) Image { return rl.genImageColor(width, height, color); } pub fn genGradientV(width: c_int, height: c_int, top: Color, bottom: Color) Image { return rl.genImageGradientV(width, height, top, bottom); } pub fn genGradientH(width: c_int, height: c_int, left: Color, right: Color) Image { return rl.genImageGradientH(width, height, left, right); } pub fn genGradientRadial(width: c_int, height: c_int, density: f32, inner: Color, outer: Color) Image { return rl.genImageGradientRadial(width, height, density, inner, outer); } pub fn genChecked(width: c_int, height: c_int, checksX: c_int, checksY: c_int, col1: Color, col2: Color) Image { return rl.genImageChecked(width, height, checksX, checksY, col1, col2); } pub fn genWhiteNoise(width: c_int, height: c_int, factor: f32) Image { return rl.genImageWhiteNoise(width, height, factor); } pub fn genCellular(width: c_int, height: c_int, tileSize: c_int) Image { return rl.genImageCellular(width, height, tileSize); } pub fn useAsWindowIcon(self: Image) void { rl.setWindowIcon(self); } }; pub const Texture = extern struct { id: c_uint, width: c_int, height: c_int, mipmaps: c_int, format: c_int, pub fn init(fileName: [*c]const u8) Texture { return rl.loadTexture(fileName); } pub fn fromImage(image: Image) Texture { return rl.loadTextureFromImage(image); } pub fn fromCubemap(image: Image, layout: i32) Texture { return rl.loadTextureCubemap(image, layout); } pub fn draw(self: Texture, posX: i32, posY: i32, tint: Color) void { rl.drawTexture(self, posX, posY, tint); } pub fn drawV(self: Texture, position: Vector2, tint: Color) void { rl.drawTextureV(self, position, tint); } pub fn drawEx(self: Texture, position: Vector2, rotation: f32, scale: f32, tint: Color) void { rl.drawTextureEx(self, position, rotation, scale, tint); } pub fn drawRec(self: Texture, source: Rectangle, position: Vector2, tint: Color) void { rl.drawTextureRec(self, source, position, tint); } pub fn drawPro(self: Texture, source: Rectangle, dest: Rectangle, origin: Vector2, rotation: f32, tint: Color) void { rl.drawTexturePro(self, source, dest, origin, rotation, tint); } pub fn drawNPatch(self: Texture, nPatchInfo: NPatchInfo, dest: Rectangle, origin: Vector2, rotation: f32, tint: Color) void { rl.drawTextureNPatch(self, nPatchInfo, dest, origin, rotation, tint); } }; pub const Texture2D = Texture; pub const TextureCubemap = Texture; pub const RenderTexture = extern struct { id: c_uint, texture: Texture, depth: Texture, pub fn init(width: i32, height: i32) RenderTexture { return rl.loadRenderTexture(width, height); } pub fn begin(self: RenderTexture2D) void { rl.beginTextureMode(self); } pub fn end(_: RenderTexture2D) void { rl.endTextureMode(); } }; pub const RenderTexture2D = RenderTexture; pub const NPatchInfo = extern struct { source: Rectangle, left: c_int, top: c_int, right: c_int, bottom: c_int, layout: c_int, }; pub const GlyphInfo = extern struct { value: c_int, offsetX: c_int, offsetY: c_int, advanceX: c_int, image: Image, }; pub const Font = extern struct { baseSize: c_int, glyphCount: c_int, glyphPadding: c_int, texture: Texture2D, recs: [*c]Rectangle, glyphs: [*c]GlyphInfo, }; pub const Camera3D = extern struct { position: Vector3, target: Vector3, up: Vector3, fovy: f32, projection: CameraProjection, pub fn begin(self: Camera3D) void { rl.beginMode3D(self); } pub fn update(self: *Camera3D) void { rl.updateCamera(self); } 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(); } }; pub const Camera = Camera3D; pub const Camera2D = extern struct { offset: Vector2, target: Vector2, rotation: f32, zoom: f32, pub fn begin(self: Camera2D) void { rl.beginMode2D(self); } pub fn getMatrix(self: Camera2D) Matrix { return rl.getCameraMatrix2D(self); } pub fn end(_: Camera2D) void { rl.endMode2D(); } }; pub const Mesh = extern struct { vertexCount: c_int, triangleCount: c_int, vertices: [*c]f32, texcoords: [*c]f32, texcoords2: [*c]f32, normals: [*c]f32, tangents: [*c]f32, colors: [*c]u8, indices: [*c]c_ushort, animVertices: [*c]f32, animNormals: [*c]f32, boneIds: [*c]u8, boneWeights: [*c]f32, vaoId: c_uint, vboId: [*c]c_uint, pub fn draw(self: Mesh, material: Material, transform: Matrix) void { rl.drawMesh(self, material, transform); } pub fn drawInstanced(self: Mesh, material: Material, transforms: []const Matrix) void { rl.drawMeshInstanced(self, material, transforms, transforms.len); } }; pub const Shader = extern struct { id: c_uint, locs: [*c]c_int, pub fn activate(self: Shader) void { rl.beginShaderMode(self); } pub fn deactivate(_: Shader) void { rl.endShaderMode(); } }; pub const MaterialMap = extern struct { texture: Texture2D, color: Color, value: f32, }; pub const Material = extern struct { shader: Shader, maps: [*c]MaterialMap, params: [4]f32, }; pub const Transform = extern struct { translation: Vector3, rotation: Quaternion, scale: Vector3, }; pub const BoneInfo = extern struct { name: [32]u8, parent: c_int, }; pub const Model = extern struct { transform: Matrix, meshCount: c_int, materialCount: c_int, meshes: [*c]Mesh, materials: [*c]Material, meshMaterial: [*c]c_int, boneCount: c_int, bones: [*c]BoneInfo, bindPose: [*c]Transform, pub fn init(fileName: [*c]const u8) Model { return rl.loadModel(fileName); } pub fn initFromMesh(mesh: Mesh) Model { return rl.loadModelFromMesh(mesh); } pub fn draw(self: Mesh, position: Vector3, scale: f32, tint: Color) void { return rl.drawMesh(self, position, scale, tint); } pub fn drawEx(self: Mesh, position: Vector3, rotationAxis: Vector3, rotationAngle: f32, scale: Vector3, tint: Color) void { return rl.drawMeshEx(self, position, rotationAxis, rotationAngle, scale, tint); } pub fn drawWires(self: Mesh, position: Vector3, scale: f32, tint: Color) void { return rl.drawMeshWires(self, position, scale, tint); } pub fn drawWiresEx(self: Mesh, position: Vector3, rotationAxis: Vector3, rotationAngle: f32, scale: Vector3, tint: Color) void { return rl.drawMeshWiresEx(self, position, rotationAxis, rotationAngle, scale, tint); } }; pub const ModelAnimation = extern struct { boneCount: c_int, frameCount: c_int, bones: [*c]BoneInfo, framePoses: [*c][*c]Transform, }; pub const Ray = extern struct { position: Vector3, direction: Vector3, }; pub const RayCollision = extern struct { hit: bool, distance: f32, point: Vector3, normal: Vector3, }; pub const BoundingBox = extern struct { min: Vector3, max: Vector3, }; pub const Wave = extern struct { frameCount: c_uint, sampleRate: c_uint, sampleSize: c_uint, channels: c_uint, data: ?*anyopaque, }; pub const rAudioBuffer = opaque {}; pub const rAudioProcessor = opaque {}; pub const AudioStream = extern struct { buffer: ?*rAudioBuffer, processor: ?*rAudioProcessor, sampleRate: c_uint, sampleSize: c_uint, channels: c_uint, }; pub const Sound = extern struct { stream: AudioStream, frameCount: c_uint, }; pub const Music = extern struct { stream: AudioStream, frameCount: c_uint, looping: bool, ctxType: c_int, ctxData: ?*anyopaque, }; pub const VrDeviceInfo = extern struct { hResolution: c_int, vResolution: c_int, hScreenSize: f32, vScreenSize: f32, vScreenCenter: f32, eyeToScreenDistance: f32, lensSeparationDistance: f32, interpupillaryDistance: f32, lensDistortionValues: [4]f32, chromaAbCorrection: [4]f32, }; pub const VrStereoConfig = extern struct { projection: [2]Matrix, viewOffset: [2]Matrix, leftLensCenter: [2]f32, rightLensCenter: [2]f32, leftScreenCenter: [2]f32, rightScreenCenter: [2]f32, scale: [2]f32, scaleIn: [2]f32, }; pub const FilePathList = extern struct { capacity: c_uint, count: c_uint, paths: [*c][*c]u8, }; pub const ConfigFlags = enum(c_int) { flag_fullscreen_mode = 2, flag_window_resizable = 4, flag_window_undecorated = 8, flag_window_transparent = 16, flag_msaa_4x_hint = 32, flag_vsync_hint = 64, flag_window_hidden = 128, flag_window_always_run = 256, flag_window_minimized = 512, flag_window_maximized = 1024, flag_window_unfocused = 2048, flag_window_topmost = 4096, flag_window_highdpi = 8192, flag_window_mouse_passthrough = 16384, flag_interlaced_hint = 65536, _, }; pub const TraceLogLevel = enum(c_int) { log_all = 0, log_trace = 1, log_debug = 2, log_info = 3, log_warning = 4, log_error = 5, log_fatal = 6, log_none = 7, }; pub const KeyboardKey = enum(c_int) { key_null = 0, key_apostrophe = 39, key_comma = 44, key_minus = 45, key_period = 46, key_slash = 47, key_zero = 48, key_one = 49, key_two = 50, key_three = 51, key_four = 52, key_five = 53, key_six = 54, key_seven = 55, key_eight = 56, key_nine = 57, key_semicolon = 59, key_equal = 61, key_a = 65, key_b = 66, key_c = 67, key_d = 68, key_e = 69, key_f = 70, key_g = 71, key_h = 72, key_i = 73, key_j = 74, key_k = 75, key_l = 76, key_m = 77, key_n = 78, key_o = 79, key_p = 80, key_q = 81, key_r = 82, key_s = 83, key_t = 84, key_u = 85, key_v = 86, key_w = 87, key_x = 88, key_y = 89, key_z = 90, key_space = 32, key_escape = 256, key_enter = 257, key_tab = 258, key_backspace = 259, key_insert = 260, key_delete = 261, key_right = 262, key_left = 263, key_down = 264, key_up = 265, key_page_up = 266, key_page_down = 267, key_home = 268, key_end = 269, key_caps_lock = 280, key_scroll_lock = 281, key_num_lock = 282, key_print_screen = 283, key_pause = 284, key_f1 = 290, key_f2 = 291, key_f3 = 292, key_f4 = 293, key_f5 = 294, key_f6 = 295, key_f7 = 296, key_f8 = 297, key_f9 = 298, key_f10 = 299, key_f11 = 300, key_f12 = 301, key_left_shift = 340, key_left_control = 341, key_left_alt = 342, key_left_super = 343, key_right_shift = 344, key_right_control = 345, key_right_alt = 346, key_right_super = 347, key_kb_menu = 348, key_left_bracket = 91, key_backslash = 92, key_right_bracket = 93, key_grave = 96, key_kp_0 = 320, key_kp_1 = 321, key_kp_2 = 322, key_kp_3 = 323, key_kp_4 = 324, key_kp_5 = 325, key_kp_6 = 326, key_kp_7 = 327, key_kp_8 = 328, key_kp_9 = 329, key_kp_decimal = 330, key_kp_divide = 331, key_kp_multiply = 332, key_kp_subtract = 333, key_kp_add = 334, key_kp_enter = 335, key_kp_equal = 336, key_back = 4, //key_menu = 82, key_volume_up = 24, key_volume_down = 25, }; pub const MouseButton = enum(c_int) { mouse_button_left = 0, mouse_button_right = 1, mouse_button_middle = 2, mouse_button_side = 3, mouse_button_extra = 4, mouse_button_forward = 5, mouse_button_back = 6, }; pub const MouseCursor = enum(c_int) { mouse_cursor_default = 0, mouse_cursor_arrow = 1, mouse_cursor_ibeam = 2, mouse_cursor_crosshair = 3, mouse_cursor_pointing_hand = 4, mouse_cursor_resize_ew = 5, mouse_cursor_resize_ns = 6, mouse_cursor_resize_nwse = 7, mouse_cursor_resize_nesw = 8, mouse_cursor_resize_all = 9, mouse_cursor_not_allowed = 10, }; pub const GamepadButton = enum(c_int) { gamepad_button_unknown = 0, gamepad_button_left_face_up = 1, gamepad_button_left_face_right = 2, gamepad_button_left_face_down = 3, gamepad_button_left_face_left = 4, gamepad_button_right_face_up = 5, gamepad_button_right_face_right = 6, gamepad_button_right_face_down = 7, gamepad_button_right_face_left = 8, gamepad_button_left_trigger_1 = 9, gamepad_button_left_trigger_2 = 10, gamepad_button_right_trigger_1 = 11, gamepad_button_right_trigger_2 = 12, gamepad_button_middle_left = 13, gamepad_button_middle = 14, gamepad_button_middle_right = 15, gamepad_button_left_thumb = 16, gamepad_button_right_thumb = 17, }; pub const GamepadAxis = enum(c_int) { gamepad_axis_left_x = 0, gamepad_axis_left_y = 1, gamepad_axis_right_x = 2, gamepad_axis_right_y = 3, gamepad_axis_left_trigger = 4, gamepad_axis_right_trigger = 5, }; pub const MaterialMapIndex = enum(c_int) { material_map_albedo = 0, material_map_metalness = 1, material_map_normal = 2, material_map_roughness = 3, material_map_occlusion = 4, material_map_emission = 5, material_map_height = 6, material_map_cubemap = 7, material_map_irradiance = 8, material_map_prefilter = 9, material_map_brdf = 10, }; pub const ShaderLocationIndex = enum(c_int) { shader_loc_vertex_position = 0, shader_loc_vertex_texcoord01 = 1, shader_loc_vertex_texcoord02 = 2, shader_loc_vertex_normal = 3, shader_loc_vertex_tangent = 4, shader_loc_vertex_color = 5, shader_loc_matrix_mvp = 6, shader_loc_matrix_view = 7, shader_loc_matrix_projection = 8, shader_loc_matrix_model = 9, shader_loc_matrix_normal = 10, shader_loc_vector_view = 11, shader_loc_color_diffuse = 12, shader_loc_color_specular = 13, shader_loc_color_ambient = 14, shader_loc_map_albedo = 15, shader_loc_map_metalness = 16, shader_loc_map_normal = 17, shader_loc_map_roughness = 18, shader_loc_map_occlusion = 19, shader_loc_map_emission = 20, shader_loc_map_height = 21, shader_loc_map_cubemap = 22, shader_loc_map_irradiance = 23, shader_loc_map_prefilter = 24, shader_loc_map_brdf = 25, }; pub const ShaderUniformDataType = enum(c_int) { shader_uniform_float = 0, shader_uniform_vec2 = 1, shader_uniform_vec3 = 2, shader_uniform_vec4 = 3, shader_uniform_int = 4, shader_uniform_ivec2 = 5, shader_uniform_ivec3 = 6, shader_uniform_ivec4 = 7, shader_uniform_sampler2d = 8, }; pub const ShaderAttribute = enum(c_int) { shader_attrib_float = 0, shader_attrib_vec2 = 1, shader_attrib_vec3 = 2, shader_attrib_vec4 = 3, }; pub const PixelFormat = enum(c_int) { pixelformat_uncompressed_grayscale = 1, pixelformat_uncompressed_gray_alpha = 2, pixelformat_uncompressed_r5g6b5 = 3, pixelformat_uncompressed_r8g8b8 = 4, pixelformat_uncompressed_r5g5b5a1 = 5, pixelformat_uncompressed_r4g4b4a4 = 6, pixelformat_uncompressed_r8g8b8a8 = 7, pixelformat_uncompressed_r32 = 8, pixelformat_uncompressed_r32g32b32 = 9, pixelformat_uncompressed_r32g32b32a32 = 10, pixelformat_compressed_dxt1_rgb = 11, pixelformat_compressed_dxt1_rgba = 12, pixelformat_compressed_dxt3_rgba = 13, pixelformat_compressed_dxt5_rgba = 14, pixelformat_compressed_etc1_rgb = 15, pixelformat_compressed_etc2_rgb = 16, pixelformat_compressed_etc2_eac_rgba = 17, pixelformat_compressed_pvrt_rgb = 18, pixelformat_compressed_pvrt_rgba = 19, pixelformat_compressed_astc_4x4_rgba = 20, pixelformat_compressed_astc_8x8_rgba = 21, }; pub const TextureFilter = enum(c_int) { texture_filter_point = 0, texture_filter_bilinear = 1, texture_filter_trilinear = 2, texture_filter_anisotropic_4x = 3, texture_filter_anisotropic_8x = 4, texture_filter_anisotropic_16x = 5, }; pub const TextureWrap = enum(c_int) { texture_wrap_repeat = 0, texture_wrap_clamp = 1, texture_wrap_mirror_repeat = 2, texture_wrap_mirror_clamp = 3, }; pub const CubemapLayout = enum(c_int) { cubemap_layout_auto_detect = 0, cubemap_layout_line_vertical = 1, cubemap_layout_line_horizontal = 2, cubemap_layout_cross_three_by_four = 3, cubemap_layout_cross_four_by_three = 4, cubemap_layout_panorama = 5, }; pub const FontType = enum(c_int) { font_default = 0, font_bitmap = 1, font_sdf = 2, }; pub const BlendMode = enum(c_int) { blend_alpha = 0, blend_additive = 1, blend_multiplied = 2, blend_add_colors = 3, blend_subtract_colors = 4, blend_alpha_premultiply = 5, blend_custom = 6, blend_custom_separate = 7, }; pub const Gestures = enum(c_int) { gesture_none = 0, gesture_tap = 1, gesture_doubletap = 2, gesture_hold = 4, gesture_drag = 8, gesture_swipe_right = 16, gesture_swipe_left = 32, gesture_swipe_up = 64, gesture_swipe_down = 128, gesture_pinch_in = 256, gesture_pinch_out = 512, }; pub const CameraMode = enum(c_int) { camera_custom = 0, camera_free = 1, camera_orbital = 2, camera_first_person = 3, camera_third_person = 4, }; pub const CameraProjection = enum(c_int) { camera_perspective = 0, camera_orthographic = 1, }; pub const NPatchType = enum(c_int) { npatch_nine_patch = 0, npatch_three_patch_vertical = 1, npatch_three_patch_horizontal = 2, }; // pub const TraceLogCallback = ?fn (c_int, [*c]const u8, [*c]struct___va_list_tag) callconv(.C) void; pub const LoadFileDataCallback = ?fn ([*c]const u8, [*c]c_uint) callconv(.C) [*c]u8; pub const SaveFileDataCallback = ?fn ([*c]const u8, ?*anyopaque, c_uint) callconv(.C) bool; pub const LoadFileTextCallback = ?fn ([*c]const u8) callconv(.C) [*c]u8; 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_PATCH = @as(i32, 0); pub const RAYLIB_VERSION = "4.5-dev"; pub const MAX_TOUCH_POINTS = 10; pub const MAX_MATERIAL_MAPS = 12; pub const MAX_SHADER_LOCATIONS = 32; pub const MATERIAL_MAP_DIFFUSE = MaterialMapIndex.MATERIAL_MAP_ALBEDO; pub const MATERIAL_MAP_SPECULAR = MaterialMapIndex.MATERIAL_MAP_METALNESS; pub const SHADER_LOC_MAP_DIFFUSE = ShaderLocationIndex.SHADER_LOC_MAP_ALBEDO; pub const SHADER_LOC_MAP_SPECULAR = ShaderLocationIndex.SHADER_LOC_MAP_METALNESS; const cdef = @import("raylib-zig-ext.zig"); pub fn textFormat(text: []const u8, args: anytype) [*c]const u8 { return @call(.{}, cdef.TextFormat, .{@ptrCast([*c]const u8, text)} ++ args); } pub fn loadShader(vsFileName: ?[]const u8, fsFileName: ?[]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); } if (fsFileName) |fsFileNameSure| { fsFileNameFinal = @ptrCast([*c]const u8, fsFileNameSure); } return cdef.LoadShader(vsFileNameFinal, fsFileNameFinal); } pub fn loadShaderFromMemory(vsCode: ?[]const u8, fsCode: ?[]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); } if (fsCode) |fsCodeSure| { fsCodeFinal = @ptrCast([*c]const u8, fsCodeSure); } return cdef.LoadShaderFromMemory(vsCodeFinal, fsCodeFinal); }