Make panel text optional (#109)

This commit is contained in:
Not-Nik 2024-06-25 19:49:50 +02:00
parent 18a7daa631
commit fb11a4e1c8
No known key found for this signature in database
GPG Key ID: E95F679E3CDD9784
3 changed files with 35 additions and 9 deletions

View File

@ -338,7 +338,9 @@ def parse_header(header_name: str, output_file: str, ext_file: str, prefix: str,
"DrawTriangleStrip", "DrawTriangleStrip",
"DrawTriangleStrip3D", "DrawTriangleStrip3D",
"GuiTabBar", "GuiTabBar",
"GuiListViewEx" "GuiListViewEx",
"GuiPanel",
"GuiScrollPanel"
] ]
if func_name in manual or "FromMemory" in func_name: if func_name in manual or "FromMemory" in func_name:

View File

@ -435,3 +435,19 @@ pub fn guiTabBar(bounds: Rectangle, text: [][:0]const u8, active: *i32) i32 {
pub fn guiListViewEx(bounds: Rectangle, text: [][:0]const u8, scrollIndex: *i32, active: *i32, focus: *i32) i32 { pub fn guiListViewEx(bounds: Rectangle, text: [][:0]const u8, scrollIndex: *i32, active: *i32, focus: *i32) i32 {
return @as(i32, cdef.GuiListViewEx(bounds, @as([*c][*c]const u8, @ptrCast(text)), @as(c_int, @intCast(text.len)), @as([*c]c_int, @ptrCast(scrollIndex)), @as([*c]c_int, @ptrCast(active)), @as([*c]c_int, @ptrCast(focus)))); return @as(i32, cdef.GuiListViewEx(bounds, @as([*c][*c]const u8, @ptrCast(text)), @as(c_int, @intCast(text.len)), @as([*c]c_int, @ptrCast(scrollIndex)), @as([*c]c_int, @ptrCast(active)), @as([*c]c_int, @ptrCast(focus))));
} }
pub fn guiPanel(bounds: Rectangle, text: ?[:0]const u8) i32 {
var textFinal = @as([*c]const u8, 0);
if (text) |textSure| {
textFinal = @as([*c]const u8, @ptrCast(textSure));
}
return @as(i32, cdef.GuiPanel(bounds, textFinal));
}
pub fn guiScrollPanel(bounds: Rectangle, text: ?[:0]const u8, content: Rectangle, scroll: *Vector2, view: *Rectangle) i32 {
var textFinal = @as([*c]const u8, 0);
if (text) |textSure| {
textFinal = @as([*c]const u8, @ptrCast(textSure));
}
return @as(i32, cdef.GuiScrollPanel(bounds, textFinal, content, @as([*c]Vector2, @ptrCast(scroll)), @as([*c]Rectangle, @ptrCast(view))));
}

View File

@ -436,6 +436,22 @@ pub fn guiListViewEx(bounds: Rectangle, text: [][:0]const u8, scrollIndex: *i32,
return @as(i32, cdef.GuiListViewEx(bounds, @as([*c][*c]const u8, @ptrCast(text)), @as(c_int, @intCast(text.len)), @as([*c]c_int, @ptrCast(scrollIndex)), @as([*c]c_int, @ptrCast(active)), @as([*c]c_int, @ptrCast(focus)))); return @as(i32, cdef.GuiListViewEx(bounds, @as([*c][*c]const u8, @ptrCast(text)), @as(c_int, @intCast(text.len)), @as([*c]c_int, @ptrCast(scrollIndex)), @as([*c]c_int, @ptrCast(active)), @as([*c]c_int, @ptrCast(focus))));
} }
pub fn guiPanel(bounds: Rectangle, text: ?[:0]const u8) i32 {
var textFinal = @as([*c]const u8, 0);
if (text) |textSure| {
textFinal = @as([*c]const u8, @ptrCast(textSure));
}
return @as(i32, cdef.GuiPanel(bounds, textFinal));
}
pub fn guiScrollPanel(bounds: Rectangle, text: ?[:0]const u8, content: Rectangle, scroll: *Vector2, view: *Rectangle) i32 {
var textFinal = @as([*c]const u8, 0);
if (text) |textSure| {
textFinal = @as([*c]const u8, @ptrCast(textSure));
}
return @as(i32, cdef.GuiScrollPanel(bounds, textFinal, content, @as([*c]Vector2, @ptrCast(scroll)), @as([*c]Rectangle, @ptrCast(view))));
}
pub fn guiEnable() void { pub fn guiEnable() void {
cdef.GuiEnable(); cdef.GuiEnable();
} }
@ -528,14 +544,6 @@ pub fn guiLine(bounds: Rectangle, text: [:0]const u8) i32 {
return @as(i32, cdef.GuiLine(bounds, @as([*c]const u8, @ptrCast(text)))); return @as(i32, cdef.GuiLine(bounds, @as([*c]const u8, @ptrCast(text))));
} }
pub fn guiPanel(bounds: Rectangle, text: [:0]const u8) i32 {
return @as(i32, cdef.GuiPanel(bounds, @as([*c]const u8, @ptrCast(text))));
}
pub fn guiScrollPanel(bounds: Rectangle, text: [:0]const u8, content: Rectangle, scroll: *Vector2, view: *Rectangle) i32 {
return @as(i32, cdef.GuiScrollPanel(bounds, @as([*c]const u8, @ptrCast(text)), content, @as([*c]Vector2, @ptrCast(scroll)), @as([*c]Rectangle, @ptrCast(view))));
}
pub fn guiLabel(bounds: Rectangle, text: [:0]const u8) i32 { pub fn guiLabel(bounds: Rectangle, text: [:0]const u8) i32 {
return @as(i32, cdef.GuiLabel(bounds, @as([*c]const u8, @ptrCast(text)))); return @as(i32, cdef.GuiLabel(bounds, @as([*c]const u8, @ptrCast(text))));
} }