ghostty/pkg/imgui/io.zig
Mitchell Hashimoto 314f9287b1 Update Zig (#164)
* update zig

* pkg/fontconfig: clean up @as

* pkg/freetype,harfbuzz: clean up @as

* pkg/imgui: clean up @as

* pkg/macos: clean up @as

* pkg/pixman,utf8proc: clean up @as

* clean up @as

* lots more @as cleanup

* undo flatpak changes

* clean up @as
2023-06-30 12:15:31 -07:00

24 lines
518 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 @as(
?*IO,
@ptrCast(c.igGetIO()),
) orelse Allocator.Error.OutOfMemory;
}
pub inline fn cval(self: *IO) *c.ImGuiIO {
return @ptrCast(@alignCast(self));
}
};
test {
const ctx = try imgui.Context.create();
defer ctx.destroy();
_ = try IO.get();
}