pkg/imgui: support context current

This commit is contained in:
Mitchell Hashimoto
2022-11-06 16:03:03 -08:00
parent 705772ed28
commit afd4800da4

View File

@ -14,6 +14,10 @@ pub const Context = opaque {
c.igDestroyContext(self.cval()); c.igDestroyContext(self.cval());
} }
pub fn setCurrent(self: *Context) void {
c.igSetCurrentContext(self.cval());
}
pub inline fn cval(self: *Context) *c.ImGuiContext { pub inline fn cval(self: *Context) *c.ImGuiContext {
return @ptrCast( return @ptrCast(
*c.ImGuiContext, *c.ImGuiContext,
@ -25,4 +29,6 @@ pub const Context = opaque {
test { test {
var ctx = try Context.create(); var ctx = try Context.create();
defer ctx.destroy(); defer ctx.destroy();
ctx.setCurrent();
} }