Add drawTextCodepoints (#135)

This commit is contained in:
Not-Nik 2024-08-17 17:22:15 +02:00
parent 4b2d9b305f
commit 58df62807f
No known key found for this signature in database
GPG Key ID: E95F679E3CDD9784
2 changed files with 10 additions and 0 deletions

View File

@ -2285,6 +2285,11 @@ pub fn unloadFontData(chars: []GlyphInfo) void {
cdef.UnloadFontData(@as([*c]GlyphInfo, @ptrCast(chars)), @as(c_int, @intCast(chars.len)));
}
/// Draw multiple character (codepoint)
pub fn drawTextCodepoints(font: Font, codepoints: []const c_int, position: Vector2, fontSize: f32, spacing: f32, tint: Color) void {
cdef.DrawTextCodepoints(font, @as([*c]const c_int, @ptrCast(codepoints)), @as(c_int, @intCast(codepoints.len)), position, fontSize, spacing, tint);
}
/// Load UTF-8 text encoded from codepoints array
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))));

View File

@ -2285,6 +2285,11 @@ pub fn unloadFontData(chars: []GlyphInfo) void {
cdef.UnloadFontData(@as([*c]GlyphInfo, @ptrCast(chars)), @as(c_int, @intCast(chars.len)));
}
/// Draw multiple character (codepoint)
pub fn drawTextCodepoints(font: Font, codepoints: []const c_int, position: Vector2, fontSize: f32, spacing: f32, tint: Color) void {
cdef.DrawTextCodepoints(font, @as([*c]const c_int, @ptrCast(codepoints)), @as(c_int, @intCast(codepoints.len)), position, fontSize, spacing, tint);
}
/// Load UTF-8 text encoded from codepoints array
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))));