From ac2748ea6b2a9cbf4c4d45a9f79312c18a7ef3af Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Tue, 31 Oct 2023 14:04:35 +0100 Subject: [PATCH] add gui tab bar --- src/main.zig | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main.zig b/src/main.zig index 166c99d..9993f5a 100644 --- a/src/main.zig +++ b/src/main.zig @@ -35,9 +35,7 @@ fn loadSqlite(path: [:0]const u8) State { pub fn main() !void { var state = State{ .unloaded = {} }; - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; - defer _ = gpa.deinit(); - const alloc = gpa.allocator(); + const alloc = std.heap.c_allocator; const args = try std.process.argsAlloc(alloc); defer std.process.argsFree(alloc, args); @@ -50,10 +48,11 @@ pub fn main() !void { const screen_width = 800; const screen_height = 450; - raylib.InitWindow(screen_width, screen_height, "FabApp"); + raylib.InitWindow(screen_width, screen_height, "Loggy"); raylib.SetTargetFPS(60); var file_dialog_state = raylib.InitGuiWindowFileDialog(raylib.GetWorkingDirectory()); + var active_tab: c_int = 0; // const ext = ".sqlite3"; // @memcpy(file_dialog_state.filterExt[0..ext.len], ext); @@ -96,6 +95,8 @@ pub fn main() !void { .loaded => |*db| { _ = db; + var tabs = [_][*c]const u8{ "Fabs", "Marvel" }; + _ = raylib.GuiTabBar(.{ .x = 20, .y = screen_height - 60, .width = screen_width - 40, .height = 40 }, &tabs, tabs.len, &active_tab); }, }