diff --git a/src/imgui.zig b/src/imgui.zig index 1d62181..5a6a82e 100644 --- a/src/imgui.zig +++ b/src/imgui.zig @@ -33,9 +33,10 @@ pub const State = struct { pub fn init(allocator: Allocator, title: [12]u8) !@This() { const history = try allocator.alloc(u32, histogram_len); + const without_null = std.mem.sliceTo(&title, 0); return .{ - .title = try allocator.dupeZ(u8, &title), + .title = try allocator.dupeZ(u8, without_null), .fps_hist = RingBuffer(u32).init(history), }; } @@ -87,7 +88,8 @@ pub fn draw(state: *State, tex_id: GLuint, cpu: *Arm7tdmi) void { const w = @intToFloat(f32, gba_width * win_scale); const h = @intToFloat(f32, gba_height * win_scale); - _ = zgui.begin(state.title, .{ .flags = .{ .no_resize = true, .always_auto_resize = true } }); + const window_title = if (state.title.len != 0) state.title else "[No Title]"; + _ = zgui.begin(window_title, .{ .flags = .{ .no_resize = true, .always_auto_resize = true } }); defer zgui.end(); zgui.image(@intToPtr(*anyopaque, tex_id), .{ .w = w, .h = h, .uv0 = .{ 0, 1 }, .uv1 = .{ 1, 0 } }); diff --git a/src/platform.zig b/src/platform.zig index 5ef333b..57c395b 100644 --- a/src/platform.zig +++ b/src/platform.zig @@ -182,7 +182,7 @@ pub const Gui = struct { gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, @sizeOf(@TypeOf(indices)), &indices, gl.STATIC_DRAW); // Position - gl.vertexAttribPointer(0, 3, gl.FLOAT, gl.FALSE, 8 * @sizeOf(f32), @intToPtr(?*anyopaque, 0)); // lmao + gl.vertexAttribPointer(0, 3, gl.FLOAT, gl.FALSE, 8 * @sizeOf(f32), null); // lmao gl.enableVertexAttribArray(0); // Colour gl.vertexAttribPointer(1, 3, gl.FLOAT, gl.FALSE, 8 * @sizeOf(f32), @intToPtr(?*anyopaque, (3 * @sizeOf(f32))));