diff --git a/lib/generate_functions.py b/lib/generate_functions.py index 6d26076..b94e127 100644 --- a/lib/generate_functions.py +++ b/lib/generate_functions.py @@ -338,7 +338,9 @@ def parse_header(header_name: str, output_file: str, ext_file: str, prefix: str, "DrawTriangleStrip", "DrawTriangleStrip3D", "GuiTabBar", - "GuiListViewEx" + "GuiListViewEx", + "GuiPanel", + "GuiScrollPanel" ] if func_name in manual or "FromMemory" in func_name: diff --git a/lib/preludes/raygui-prelude.zig b/lib/preludes/raygui-prelude.zig index 95f2d82..d7727d4 100644 --- a/lib/preludes/raygui-prelude.zig +++ b/lib/preludes/raygui-prelude.zig @@ -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 { 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)))); +} diff --git a/lib/raygui.zig b/lib/raygui.zig index 47d023f..545d7a1 100644 --- a/lib/raygui.zig +++ b/lib/raygui.zig @@ -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)))); } +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 { 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)))); } -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 { return @as(i32, cdef.GuiLabel(bounds, @as([*c]const u8, @ptrCast(text)))); }