mirror of
https://github.com/Not-Nik/raylib-zig.git
synced 2025-09-08 19:47:28 +00:00
Allow not specifiying codepoints in loadFontEx (#110)
This commit is contained in:
parent
fb11a4e1c8
commit
1dab3352b3
@ -1815,6 +1815,16 @@ pub fn loadImagePalette(image: Image, maxPaletteSize: i32) RaylibError![]Color {
|
||||
return res;
|
||||
}
|
||||
|
||||
pub fn loadFontEx(fileName: [:0]const u8, fontSize: i32, fontChars: ?[]i32) Font {
|
||||
var fontCharsFinal = @as([*c]c_int, 0);
|
||||
var fontCharsLen: c_int = @as(c_int, 0);
|
||||
if (fontChars) |fontCharsSure| {
|
||||
fontCharsFinal = @as([*c]c_int, @ptrCast(fontCharsSure));
|
||||
fontCharsLen = @as(i32, @intCast(fontCharsSure.len));
|
||||
}
|
||||
return cdef.LoadFontEx(@as([*c]const u8, @ptrCast(fileName)), @as(c_int, fontSize), fontCharsFinal, fontCharsLen);
|
||||
}
|
||||
|
||||
pub fn loadFontFromMemory(fileType: [:0]const u8, fileData: ?[]const u8, fontSize: i32, fontChars: []i32) Font {
|
||||
var fileDataFinal = @as([*c]const u8, 0);
|
||||
var fileDataLen: i32 = 0;
|
||||
@ -1939,10 +1949,6 @@ pub fn checkCollisionPointPoly(point: Vector2, points: []Vector2) bool {
|
||||
return cdef.CheckCollisionPointPoly(point, @as([*c]Vector2, @ptrCast(points)), @as(c_int, @intCast(points.len)));
|
||||
}
|
||||
|
||||
pub fn loadFontEx(fileName: [:0]const u8, fontSize: i32, fontChars: []i32) Font {
|
||||
return cdef.LoadFontEx(@as([*c]const u8, @ptrCast(fileName)), @as(c_int, fontSize), @as([*c]c_int, @ptrCast(fontChars)), @as(c_int, @intCast(fontChars.len)));
|
||||
}
|
||||
|
||||
pub fn genImageFontAtlas(chars: []const GlyphInfo, recs: [][]Rectangle, fontSize: i32, padding: i32, packMethod: i32) Image {
|
||||
return cdef.GenImageFontAtlas(@as([*c]const GlyphInfo, @ptrCast(chars)), @as([*c][*c]Rectangle, @ptrCast(recs)), @as(c_int, @intCast(recs.len)), @as(c_int, fontSize), @as(c_int, padding), @as(c_int, packMethod));
|
||||
}
|
||||
|
@ -1815,6 +1815,16 @@ pub fn loadImagePalette(image: Image, maxPaletteSize: i32) RaylibError![]Color {
|
||||
return res;
|
||||
}
|
||||
|
||||
pub fn loadFontEx(fileName: [:0]const u8, fontSize: i32, fontChars: ?[]i32) Font {
|
||||
var fontCharsFinal = @as([*c]c_int, 0);
|
||||
var fontCharsLen: c_int = @as(c_int, 0);
|
||||
if (fontChars) |fontCharsSure| {
|
||||
fontCharsFinal = @as([*c]c_int, @ptrCast(fontCharsSure));
|
||||
fontCharsLen = @as(i32, @intCast(fontCharsSure.len));
|
||||
}
|
||||
return cdef.LoadFontEx(@as([*c]const u8, @ptrCast(fileName)), @as(c_int, fontSize), fontCharsFinal, fontCharsLen);
|
||||
}
|
||||
|
||||
pub fn loadFontFromMemory(fileType: [:0]const u8, fileData: ?[]const u8, fontSize: i32, fontChars: []i32) Font {
|
||||
var fileDataFinal = @as([*c]const u8, 0);
|
||||
var fileDataLen: i32 = 0;
|
||||
@ -1939,10 +1949,6 @@ pub fn checkCollisionPointPoly(point: Vector2, points: []Vector2) bool {
|
||||
return cdef.CheckCollisionPointPoly(point, @as([*c]Vector2, @ptrCast(points)), @as(c_int, @intCast(points.len)));
|
||||
}
|
||||
|
||||
pub fn loadFontEx(fileName: [:0]const u8, fontSize: i32, fontChars: []i32) Font {
|
||||
return cdef.LoadFontEx(@as([*c]const u8, @ptrCast(fileName)), @as(c_int, fontSize), @as([*c]c_int, @ptrCast(fontChars)), @as(c_int, @intCast(fontChars.len)));
|
||||
}
|
||||
|
||||
pub fn genImageFontAtlas(chars: []const GlyphInfo, recs: [][]Rectangle, fontSize: i32, padding: i32, packMethod: i32) Image {
|
||||
return cdef.GenImageFontAtlas(@as([*c]const GlyphInfo, @ptrCast(chars)), @as([*c][*c]Rectangle, @ptrCast(recs)), @as(c_int, @intCast(recs.len)), @as(c_int, fontSize), @as(c_int, padding), @as(c_int, packMethod));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user