ghostty/pkg/imgui/io.zig
Mitchell Hashimoto f29393bca6 Imgui (#20)
* vendor/cimgui

* Add a "dev mode" window which for now is just imgui demo
2022-10-16 16:20:08 -07:00

27 lines
581 B
Zig

const std = @import("std");
const c = @import("c.zig");
const imgui = @import("main.zig");
const Allocator = std.mem.Allocator;
pub const IO = opaque {
pub fn get() Allocator.Error!*IO {
return @ptrCast(
?*IO,
c.igGetIO(),
) orelse Allocator.Error.OutOfMemory;
}
pub inline fn cval(self: *IO) *c.ImGuiIO {
return @ptrCast(
*c.ImGuiIO,
@alignCast(@alignOf(c.ImGuiIO), self),
);
}
};
test {
const ctx = try imgui.Context.create();
defer ctx.destroy();
_ = try IO.get();
}