Bump raylib to master (#278)

This commit is contained in:
Nikolas 2025-08-31 16:42:27 +02:00
parent b44a355a81
commit acd5507b0e
No known key found for this signature in database
GPG Key ID: E95F679E3CDD9784
6 changed files with 58 additions and 20 deletions

View File

@ -89,6 +89,7 @@ MANUAL = [
"UnloadFontData", "UnloadFontData",
"DrawTextCodepoints", "DrawTextCodepoints",
"LoadUTF8", "LoadUTF8",
"LoadTextLines",
"TextJoin", "TextJoin",
"DrawLineStrip", "DrawLineStrip",
"DrawTriangleFan", "DrawTriangleFan",
@ -154,7 +155,7 @@ def ziggify_type(name: str, t: str, func_name: str) -> str:
] ]
string = False string = False
if name == "text" and t == "[*c][*c]const u8": if name == "text" and (t == "[*c][*c]const u8" or t == "[*c][*c]u8"):
return "[][:0]const u8" return "[][:0]const u8"
if t.startswith("[*c]") and name not in single and name not in multi: if t.startswith("[*c]") and name not in single and name not in multi:

View File

@ -26,6 +26,7 @@ pub const RaylibError = error{
LoadFont, LoadFont,
LoadFontData, LoadFontData,
LoadCodepoints, LoadCodepoints,
LoadTextLines,
TextSplit, TextSplit,
LoadMaterial, LoadMaterial,
LoadMaterials, LoadMaterials,
@ -2215,11 +2216,11 @@ pub fn loadFont(fileName: [:0]const u8) RaylibError!Font {
} }
/// Load font from file with extended parameters, use null for fontChars to load the default character set /// Load font from file with extended parameters, use null for fontChars to load the default character set
pub fn loadFontEx(fileName: [:0]const u8, fontSize: i32, fontChars: ?[]i32) RaylibError!Font { pub fn loadFontEx(fileName: [:0]const u8, fontSize: i32, fontChars: ?[]const i32) RaylibError!Font {
var fontCharsFinal = @as([*c]c_int, 0); var fontCharsFinal = @as([*c]const c_int, 0);
var fontCharsLen: c_int = @as(c_int, 0); var fontCharsLen: c_int = @as(c_int, 0);
if (fontChars) |fontCharsSure| { if (fontChars) |fontCharsSure| {
fontCharsFinal = @as([*c]c_int, @ptrCast(fontCharsSure)); fontCharsFinal = @as([*c]const c_int, @ptrCast(fontCharsSure));
fontCharsLen = @as(i32, @intCast(fontCharsSure.len)); fontCharsLen = @as(i32, @intCast(fontCharsSure.len));
} }
const font = cdef.LoadFontEx(@as([*c]const u8, @ptrCast(fileName)), @as(c_int, fontSize), fontCharsFinal, fontCharsLen); const font = cdef.LoadFontEx(@as([*c]const u8, @ptrCast(fileName)), @as(c_int, fontSize), fontCharsFinal, fontCharsLen);
@ -2228,7 +2229,7 @@ pub fn loadFontEx(fileName: [:0]const u8, fontSize: i32, fontChars: ?[]i32) Rayl
} }
/// Load font from memory buffer, fileType refers to extension: i.e. '.ttf' /// Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
pub fn loadFontFromMemory(fileType: [:0]const u8, fileData: ?[]const u8, fontSize: i32, fontChars: ?[]i32) RaylibError!Font { pub fn loadFontFromMemory(fileType: [:0]const u8, fileData: ?[]const u8, fontSize: i32, fontChars: ?[]const i32) RaylibError!Font {
var fileDataFinal = @as([*c]const u8, 0); var fileDataFinal = @as([*c]const u8, 0);
var fileDataLen: i32 = 0; var fileDataLen: i32 = 0;
if (fileData) |fileDataSure| { if (fileData) |fileDataSure| {
@ -2236,7 +2237,7 @@ pub fn loadFontFromMemory(fileType: [:0]const u8, fileData: ?[]const u8, fontSiz
fileDataLen = @as(i32, @intCast(fileDataSure.len)); fileDataLen = @as(i32, @intCast(fileDataSure.len));
} }
const codepointCount: c_int = if (fontChars) |fontCharsSure| @intCast(fontCharsSure.len) else 0; const codepointCount: c_int = if (fontChars) |fontCharsSure| @intCast(fontCharsSure.len) else 0;
const font = 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)), codepointCount); const font = 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]const c_int, @ptrCast(fontChars)), codepointCount);
const isValid = cdef.IsFontValid(font); const isValid = cdef.IsFontValid(font);
return if (isValid) font else RaylibError.LoadFont; return if (isValid) font else RaylibError.LoadFont;
} }
@ -2455,8 +2456,7 @@ pub fn imageKernelConvolution(image: *Image, kernel: []const f32) void {
} }
/// Generate image font atlas using chars info /// Generate image font atlas using chars info
pub fn genImageFontAtlas(glyphs: []const GlyphInfo, fontSize: i32, padding: i32, packMethod: i32) RaylibError!struct{ pub fn genImageFontAtlas(glyphs: []const GlyphInfo, fontSize: i32, padding: i32, packMethod: i32) RaylibError!struct { Image, []Rectangle } {
Image, []Rectangle } {
var res: []Rectangle = undefined; var res: []Rectangle = undefined;
var recs: [*c]Rectangle = 0; var recs: [*c]Rectangle = 0;
const image = cdef.GenImageFontAtlas(@as([*c]const GlyphInfo, @ptrCast(glyphs)), @as([*c][*c]Rectangle, @ptrCast(&recs)), @as(c_int, @intCast(glyphs.len)), @as(c_int, fontSize), @as(c_int, padding), @as(c_int, packMethod)); const image = cdef.GenImageFontAtlas(@as([*c]const GlyphInfo, @ptrCast(glyphs)), @as([*c][*c]Rectangle, @ptrCast(&recs)), @as(c_int, @intCast(glyphs.len)), @as(c_int, fontSize), @as(c_int, padding), @as(c_int, packMethod));
@ -2485,6 +2485,20 @@ pub fn loadUTF8(codepoints: []const c_int) [:0]u8 {
return std.mem.span(cdef.LoadUTF8(@as([*c]const c_int, @ptrCast(codepoints)), @as(c_int, @intCast(codepoints.len)))); return std.mem.span(cdef.LoadUTF8(@as([*c]const c_int, @ptrCast(codepoints)), @as(c_int, @intCast(codepoints.len))));
} }
// Load text as separate lines ('\n')
pub fn loadTextLines(text: [:0]const u8) RaylibError![][:0]u8 {
var lineCount: i32 = 0;
var res: [][:0]u8 = undefined;
const ptr = cdef.LoadTextLines(@as([*c]const u8, @ptrCast(text)), @as([*c]c_int, @ptrCast(&lineCount)));
if (ptr == 0) return RaylibError.LoadTextLines;
res.ptr = @as([*][:0]u8, @ptrCast(ptr));
res.len = @as(usize, @intCast(lineCount));
return res;
}
/// Join text strings with delimiter /// Join text strings with delimiter
pub fn textJoin(textList: [][:0]u8, delimiter: [:0]const u8) [:0]const u8 { pub fn textJoin(textList: [][:0]u8, delimiter: [:0]const u8) [:0]const u8 {
return std.mem.span(cdef.TextJoin(@as([*c][*c]u8, @ptrCast(textList)), @as(c_int, @intCast(textList.len)), @as([*c]const u8, @ptrCast(delimiter)))); return std.mem.span(cdef.TextJoin(@as([*c][*c]u8, @ptrCast(textList)), @as(c_int, @intCast(textList.len)), @as([*c]const u8, @ptrCast(delimiter))));

View File

@ -395,9 +395,9 @@ pub extern "c" fn SetPixelColor(dstPtr: *anyopaque, color: rl.Color, format: rl.
pub extern "c" fn GetPixelDataSize(width: c_int, height: c_int, format: rl.PixelFormat) c_int; pub extern "c" fn GetPixelDataSize(width: c_int, height: c_int, format: rl.PixelFormat) c_int;
pub extern "c" fn GetFontDefault() rl.Font; pub extern "c" fn GetFontDefault() rl.Font;
pub extern "c" fn LoadFont(fileName: [*c]const u8) rl.Font; pub extern "c" fn LoadFont(fileName: [*c]const u8) rl.Font;
pub extern "c" fn LoadFontEx(fileName: [*c]const u8, fontSize: c_int, codepoints: [*c]c_int, codepointCount: c_int) rl.Font; pub extern "c" fn LoadFontEx(fileName: [*c]const u8, fontSize: c_int, codepoints: [*c]const c_int, codepointCount: c_int) rl.Font;
pub extern "c" fn LoadFontFromImage(image: rl.Image, key: rl.Color, firstChar: 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, codepoints: [*c]c_int, codepointCount: c_int) rl.Font; pub extern "c" fn LoadFontFromMemory(fileType: [*c]const u8, fileData: [*c]const u8, dataSize: c_int, fontSize: c_int, codepoints: [*c]const c_int, codepointCount: c_int) rl.Font;
pub extern "c" fn IsFontValid(font: rl.Font) bool; pub extern "c" fn IsFontValid(font: rl.Font) bool;
pub extern "c" fn LoadFontData(fileData: [*c]const u8, dataSize: c_int, fontSize: c_int, codepoints: [*c]c_int, codepointCount: c_int, ty: rl.FontType) [*c]rl.GlyphInfo; pub extern "c" fn LoadFontData(fileData: [*c]const u8, dataSize: c_int, fontSize: c_int, codepoints: [*c]c_int, codepointCount: c_int, ty: rl.FontType) [*c]rl.GlyphInfo;
pub extern "c" fn GenImageFontAtlas(glyphs: [*c]const rl.GlyphInfo, glyphRecs: [*c][*c]rl.Rectangle, glyphCount: c_int, fontSize: c_int, padding: c_int, packMethod: c_int) rl.Image; pub extern "c" fn GenImageFontAtlas(glyphs: [*c]const rl.GlyphInfo, glyphRecs: [*c][*c]rl.Rectangle, glyphCount: c_int, fontSize: c_int, padding: c_int, packMethod: c_int) rl.Image;
@ -425,6 +425,8 @@ pub extern "c" fn GetCodepoint(text: [*c]const u8, codepointSize: [*c]c_int) c_i
pub extern "c" fn GetCodepointNext(text: [*c]const u8, codepointSize: [*c]c_int) c_int; pub extern "c" fn GetCodepointNext(text: [*c]const u8, codepointSize: [*c]c_int) c_int;
pub extern "c" fn GetCodepointPrevious(text: [*c]const u8, codepointSize: [*c]c_int) c_int; pub extern "c" fn GetCodepointPrevious(text: [*c]const u8, codepointSize: [*c]c_int) c_int;
pub extern "c" fn CodepointToUTF8(codepoint: c_int, utf8Size: [*c]c_int) [*c]const u8; pub extern "c" fn CodepointToUTF8(codepoint: c_int, utf8Size: [*c]c_int) [*c]const u8;
pub extern "c" fn LoadTextLines(text: [*c]const u8, count: [*c]c_int) [*c][*c]u8;
pub extern "c" fn UnloadTextLines(text: [*c][*c]u8) void;
pub extern "c" fn TextCopy(dst: [*c]u8, src: [*c]const u8) c_int; pub extern "c" fn TextCopy(dst: [*c]u8, src: [*c]const u8) c_int;
pub extern "c" fn TextIsEqual(text1: [*c]const u8, text2: [*c]const u8) bool; pub extern "c" fn TextIsEqual(text1: [*c]const u8, text2: [*c]const u8) bool;
pub extern "c" fn TextLength(text: [*c]const u8) c_uint; pub extern "c" fn TextLength(text: [*c]const u8) c_uint;

7
lib/raylib.h vendored
View File

@ -1466,9 +1466,9 @@ RLAPI int GetPixelDataSize(int width, int height, int format); // G
// Font loading/unloading functions // Font loading/unloading functions
RLAPI Font GetFontDefault(void); // Get the default Font RLAPI Font GetFontDefault(void); // Get the default Font
RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM) RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM)
RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height RLAPI Font LoadFontEx(const char *fileName, int fontSize, const int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height
RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style) RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style)
RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf' RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, const int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
RLAPI bool IsFontValid(Font font); // Check if a font is valid (font data loaded, WARNING: GPU texture not checked) RLAPI bool IsFontValid(Font font); // Check if a font is valid (font data loaded, WARNING: GPU texture not checked)
RLAPI GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount, int type); // Load font data for further use RLAPI GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount, int type); // Load font data for further use
RLAPI Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyphCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info RLAPI Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyphCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info
@ -1506,6 +1506,8 @@ RLAPI const char *CodepointToUTF8(int codepoint, int *utf8Size);
// Text strings management functions (no UTF-8 strings, only byte chars) // Text strings management functions (no UTF-8 strings, only byte chars)
// WARNING 1: Most of these functions use internal static buffers, it's recommended to store returned data on user-side for re-use // WARNING 1: Most of these functions use internal static buffers, it's recommended to store returned data on user-side for re-use
// WARNING 2: Some strings allocate memory internally for the returned strings, those strings must be free by user using MemFree() // WARNING 2: Some strings allocate memory internally for the returned strings, those strings must be free by user using MemFree()
RLAPI char **LoadTextLines(const char *text, int *count); // Load text as separate lines ('\n')
RLAPI void UnloadTextLines(char **text); // Unload text lines
RLAPI int TextCopy(char *dst, const char *src); // Copy one string to another, returns bytes copied RLAPI int TextCopy(char *dst, const char *src); // Copy one string to another, returns bytes copied
RLAPI bool TextIsEqual(const char *text1, const char *text2); // Check if two text string are equal RLAPI bool TextIsEqual(const char *text1, const char *text2); // Check if two text string are equal
RLAPI unsigned int TextLength(const char *text); // Get text length, checks for '\0' ending RLAPI unsigned int TextLength(const char *text); // Get text length, checks for '\0' ending
@ -1522,7 +1524,6 @@ RLAPI char *TextToLower(const char *text);
RLAPI char *TextToPascal(const char *text); // Get Pascal case notation version of provided string RLAPI char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
RLAPI char *TextToSnake(const char *text); // Get Snake case notation version of provided string RLAPI char *TextToSnake(const char *text); // Get Snake case notation version of provided string
RLAPI char *TextToCamel(const char *text); // Get Camel case notation version of provided string RLAPI char *TextToCamel(const char *text); // Get Camel case notation version of provided string
RLAPI int TextToInteger(const char *text); // Get integer value from text RLAPI int TextToInteger(const char *text); // Get integer value from text
RLAPI float TextToFloat(const char *text); // Get float value from text RLAPI float TextToFloat(const char *text); // Get float value from text

View File

@ -26,6 +26,7 @@ pub const RaylibError = error{
LoadFont, LoadFont,
LoadFontData, LoadFontData,
LoadCodepoints, LoadCodepoints,
LoadTextLines,
TextSplit, TextSplit,
LoadMaterial, LoadMaterial,
LoadMaterials, LoadMaterials,
@ -2215,11 +2216,11 @@ pub fn loadFont(fileName: [:0]const u8) RaylibError!Font {
} }
/// Load font from file with extended parameters, use null for fontChars to load the default character set /// Load font from file with extended parameters, use null for fontChars to load the default character set
pub fn loadFontEx(fileName: [:0]const u8, fontSize: i32, fontChars: ?[]i32) RaylibError!Font { pub fn loadFontEx(fileName: [:0]const u8, fontSize: i32, fontChars: ?[]const i32) RaylibError!Font {
var fontCharsFinal = @as([*c]c_int, 0); var fontCharsFinal = @as([*c]const c_int, 0);
var fontCharsLen: c_int = @as(c_int, 0); var fontCharsLen: c_int = @as(c_int, 0);
if (fontChars) |fontCharsSure| { if (fontChars) |fontCharsSure| {
fontCharsFinal = @as([*c]c_int, @ptrCast(fontCharsSure)); fontCharsFinal = @as([*c]const c_int, @ptrCast(fontCharsSure));
fontCharsLen = @as(i32, @intCast(fontCharsSure.len)); fontCharsLen = @as(i32, @intCast(fontCharsSure.len));
} }
const font = cdef.LoadFontEx(@as([*c]const u8, @ptrCast(fileName)), @as(c_int, fontSize), fontCharsFinal, fontCharsLen); const font = cdef.LoadFontEx(@as([*c]const u8, @ptrCast(fileName)), @as(c_int, fontSize), fontCharsFinal, fontCharsLen);
@ -2228,7 +2229,7 @@ pub fn loadFontEx(fileName: [:0]const u8, fontSize: i32, fontChars: ?[]i32) Rayl
} }
/// Load font from memory buffer, fileType refers to extension: i.e. '.ttf' /// Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
pub fn loadFontFromMemory(fileType: [:0]const u8, fileData: ?[]const u8, fontSize: i32, fontChars: ?[]i32) RaylibError!Font { pub fn loadFontFromMemory(fileType: [:0]const u8, fileData: ?[]const u8, fontSize: i32, fontChars: ?[]const i32) RaylibError!Font {
var fileDataFinal = @as([*c]const u8, 0); var fileDataFinal = @as([*c]const u8, 0);
var fileDataLen: i32 = 0; var fileDataLen: i32 = 0;
if (fileData) |fileDataSure| { if (fileData) |fileDataSure| {
@ -2236,7 +2237,7 @@ pub fn loadFontFromMemory(fileType: [:0]const u8, fileData: ?[]const u8, fontSiz
fileDataLen = @as(i32, @intCast(fileDataSure.len)); fileDataLen = @as(i32, @intCast(fileDataSure.len));
} }
const codepointCount: c_int = if (fontChars) |fontCharsSure| @intCast(fontCharsSure.len) else 0; const codepointCount: c_int = if (fontChars) |fontCharsSure| @intCast(fontCharsSure.len) else 0;
const font = 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)), codepointCount); const font = 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]const c_int, @ptrCast(fontChars)), codepointCount);
const isValid = cdef.IsFontValid(font); const isValid = cdef.IsFontValid(font);
return if (isValid) font else RaylibError.LoadFont; return if (isValid) font else RaylibError.LoadFont;
} }
@ -2455,8 +2456,7 @@ pub fn imageKernelConvolution(image: *Image, kernel: []const f32) void {
} }
/// Generate image font atlas using chars info /// Generate image font atlas using chars info
pub fn genImageFontAtlas(glyphs: []const GlyphInfo, fontSize: i32, padding: i32, packMethod: i32) RaylibError!struct{ pub fn genImageFontAtlas(glyphs: []const GlyphInfo, fontSize: i32, padding: i32, packMethod: i32) RaylibError!struct { Image, []Rectangle } {
Image, []Rectangle } {
var res: []Rectangle = undefined; var res: []Rectangle = undefined;
var recs: [*c]Rectangle = 0; var recs: [*c]Rectangle = 0;
const image = cdef.GenImageFontAtlas(@as([*c]const GlyphInfo, @ptrCast(glyphs)), @as([*c][*c]Rectangle, @ptrCast(&recs)), @as(c_int, @intCast(glyphs.len)), @as(c_int, fontSize), @as(c_int, padding), @as(c_int, packMethod)); const image = cdef.GenImageFontAtlas(@as([*c]const GlyphInfo, @ptrCast(glyphs)), @as([*c][*c]Rectangle, @ptrCast(&recs)), @as(c_int, @intCast(glyphs.len)), @as(c_int, fontSize), @as(c_int, padding), @as(c_int, packMethod));
@ -2485,6 +2485,20 @@ pub fn loadUTF8(codepoints: []const c_int) [:0]u8 {
return std.mem.span(cdef.LoadUTF8(@as([*c]const c_int, @ptrCast(codepoints)), @as(c_int, @intCast(codepoints.len)))); return std.mem.span(cdef.LoadUTF8(@as([*c]const c_int, @ptrCast(codepoints)), @as(c_int, @intCast(codepoints.len))));
} }
// Load text as separate lines ('\n')
pub fn loadTextLines(text: [:0]const u8) RaylibError![][:0]u8 {
var lineCount: i32 = 0;
var res: [][:0]u8 = undefined;
const ptr = cdef.LoadTextLines(@as([*c]const u8, @ptrCast(text)), @as([*c]c_int, @ptrCast(&lineCount)));
if (ptr == 0) return RaylibError.LoadTextLines;
res.ptr = @as([*][:0]u8, @ptrCast(ptr));
res.len = @as(usize, @intCast(lineCount));
return res;
}
/// Join text strings with delimiter /// Join text strings with delimiter
pub fn textJoin(textList: [][:0]u8, delimiter: [:0]const u8) [:0]const u8 { pub fn textJoin(textList: [][:0]u8, delimiter: [:0]const u8) [:0]const u8 {
return std.mem.span(cdef.TextJoin(@as([*c][*c]u8, @ptrCast(textList)), @as(c_int, @intCast(textList.len)), @as([*c]const u8, @ptrCast(delimiter)))); return std.mem.span(cdef.TextJoin(@as([*c][*c]u8, @ptrCast(textList)), @as(c_int, @intCast(textList.len)), @as([*c]const u8, @ptrCast(delimiter))));
@ -4444,6 +4458,11 @@ pub fn codepointToUTF8(codepoint: i32, utf8Size: *i32) [:0]const u8 {
return std.mem.span(cdef.CodepointToUTF8(@as(c_int, codepoint), @as([*c]c_int, @ptrCast(utf8Size)))); return std.mem.span(cdef.CodepointToUTF8(@as(c_int, codepoint), @as([*c]c_int, @ptrCast(utf8Size))));
} }
/// Unload text lines
pub fn unloadTextLines(text: [][:0]const u8) void {
cdef.UnloadTextLines(@as([*c][*c]u8, @ptrCast(text)));
}
/// Copy one string to another, returns bytes copied /// Copy one string to another, returns bytes copied
pub fn textCopy(dst: *u8, src: [:0]const u8) i32 { pub fn textCopy(dst: *u8, src: [:0]const u8) i32 {
return @as(i32, cdef.TextCopy(@as([*c]u8, @ptrCast(dst)), @as([*c]const u8, @ptrCast(src)))); return @as(i32, cdef.TextCopy(@as([*c]u8, @ptrCast(dst)), @as([*c]const u8, @ptrCast(src))));

1
lib/rlgl.h vendored
View File

@ -3243,6 +3243,7 @@ unsigned int rlLoadTexture(const void *data, int width, int height, int format,
int mipWidth = width; int mipWidth = width;
int mipHeight = height; int mipHeight = height;
int mipOffset = 0; // Mipmap data offset, only used for tracelog int mipOffset = 0; // Mipmap data offset, only used for tracelog
(void)mipOffset; // Used to avoid gcc warnings about unused variable
// NOTE: Added pointer math separately from function to avoid UBSAN complaining // NOTE: Added pointer math separately from function to avoid UBSAN complaining
unsigned char *dataPtr = NULL; unsigned char *dataPtr = NULL;