mirror of
https://github.com/Not-Nik/raylib-zig.git
synced 2025-09-08 19:47:28 +00:00
Added missing variadic arguments to traceLog()
(#186)
* Added missing variadic arguments to `traceLog()` * Made changes resillient to `generate_function.py`
This commit is contained in:
parent
57041e707c
commit
4e05ee5a3f
@ -331,6 +331,7 @@ def parse_header(header_name: str, output_file: str, ext_file: str, prefix: str,
|
||||
|
||||
manual = [
|
||||
"TextFormat",
|
||||
"TraceLog",
|
||||
"LoadShader",
|
||||
"ExportDataAsCode",
|
||||
"LoadFileData",
|
||||
|
@ -2182,6 +2182,24 @@ pub fn textFormat(text: [*:0]const u8, args: anytype) [*:0]const u8 {
|
||||
return std.mem.span(@call(.auto, cdef.TextFormat, .{@as([*c]const u8, @ptrCast(text))} ++ args));
|
||||
}
|
||||
|
||||
/// Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...)
|
||||
pub fn traceLog(logLevel: TraceLogLevel, text: [*:0]const u8, args: anytype) void {
|
||||
comptime {
|
||||
const info = @typeInfo(@TypeOf(args));
|
||||
switch (info) {
|
||||
.Struct => {
|
||||
if (!info.Struct.is_tuple)
|
||||
@compileError("Args should be in a tuple (call this function like traceLog(.{arg1, arg2, ...});)!");
|
||||
},
|
||||
else => {
|
||||
@compileError("Args should be in a tuple (call this function like traceLog(.{arg1, arg2, ...});)!");
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@call(.auto, cdef.TraceLog, .{ logLevel, @as([*c]const u8, @ptrCast(text)) } ++ args);
|
||||
}
|
||||
|
||||
/// Split text into multiple strings
|
||||
pub fn textSplit(text: [*:0]const u8, delimiter: u8) [][*:0]const u8 {
|
||||
var count: i32 = 0;
|
||||
|
@ -2182,6 +2182,24 @@ pub fn textFormat(text: [*:0]const u8, args: anytype) [*:0]const u8 {
|
||||
return std.mem.span(@call(.auto, cdef.TextFormat, .{@as([*c]const u8, @ptrCast(text))} ++ args));
|
||||
}
|
||||
|
||||
/// Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...)
|
||||
pub fn traceLog(logLevel: TraceLogLevel, text: [*:0]const u8, args: anytype) void {
|
||||
comptime {
|
||||
const info = @typeInfo(@TypeOf(args));
|
||||
switch (info) {
|
||||
.Struct => {
|
||||
if (!info.Struct.is_tuple)
|
||||
@compileError("Args should be in a tuple (call this function like traceLog(.{arg1, arg2, ...});)!");
|
||||
},
|
||||
else => {
|
||||
@compileError("Args should be in a tuple (call this function like traceLog(.{arg1, arg2, ...});)!");
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@call(.auto, cdef.TraceLog, .{ logLevel, @as([*c]const u8, @ptrCast(text)) } ++ args);
|
||||
}
|
||||
|
||||
/// Split text into multiple strings
|
||||
pub fn textSplit(text: [*:0]const u8, delimiter: u8) [][*:0]const u8 {
|
||||
var count: i32 = 0;
|
||||
@ -2860,11 +2878,6 @@ pub fn openURL(url: [*:0]const u8) void {
|
||||
cdef.OpenURL(@as([*c]const u8, @ptrCast(url)));
|
||||
}
|
||||
|
||||
/// Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...)
|
||||
pub fn traceLog(logLevel: TraceLogLevel, text: [*:0]const u8) void {
|
||||
cdef.TraceLog(logLevel, @as([*c]const u8, @ptrCast(text)));
|
||||
}
|
||||
|
||||
/// Set the current threshold (minimum) log level
|
||||
pub fn setTraceLogLevel(logLevel: TraceLogLevel) void {
|
||||
cdef.SetTraceLogLevel(logLevel);
|
||||
|
Loading…
x
Reference in New Issue
Block a user