Skip to content

Commit 1e9b501

Browse files
author
Anthony Debucquoy
committed
cimgui passtrough + text function
1 parent ddb764d commit 1e9b501

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/gui.zig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub const gizmo = @import("gizmo.zig");
99
pub const node_editor = @import("node_editor.zig");
1010
pub const te = @import("te.zig");
1111

12-
const cimgui = @cImport({
12+
pub const cimgui = @cImport({
1313
@cDefine("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", "");
1414
@cInclude("cimgui.h");
1515
});
@@ -345,9 +345,10 @@ pub const io = struct {
345345
}
346346
extern fn zguiIoGetDisplaySize(size: *[2]f32) void;
347347

348-
/// `pub fn setDisplayFramebufferScale(sx: f32, sy: f32) void`
349-
pub const setDisplayFramebufferScale = zguiIoSetDisplayFramebufferScale;
350-
extern fn zguiIoSetDisplayFramebufferScale(sx: f32, sy: f32) void;
348+
pub fn setDisplayFramebufferScale(sx: f32, sy: f32) void{
349+
const IO = cimgui.igGetIO_Nil();
350+
IO.*.DisplayFramebufferScale = .{.x = sx, .y = sy};
351+
}
351352

352353
/// `pub fn setConfigFlags(flags: ConfigFlags) void`
353354
pub const setConfigFlags = zguiIoSetConfigFlags;
@@ -1609,7 +1610,7 @@ extern fn zguiGetPtrId(ptr_id: *const anyopaque) Ident;
16091610
//
16101611
//--------------------------------------------------------------------------------------------------
16111612
pub fn textUnformatted(txt: []const u8) void {
1612-
zguiTextUnformatted(txt.ptr, txt.ptr + txt.len);
1613+
cimgui.igTextUnformatted(txt.ptr, txt.ptr + txt.len);
16131614
}
16141615
pub fn textUnformattedColored(color: [4]f32, txt: []const u8) void {
16151616
pushStyleColor4f(.{ .idx = .text, .c = color });
@@ -1619,14 +1620,13 @@ pub fn textUnformattedColored(color: [4]f32, txt: []const u8) void {
16191620
//--------------------------------------------------------------------------------------------------
16201621
pub fn text(comptime fmt: []const u8, args: anytype) void {
16211622
const result = format(fmt, args);
1622-
zguiTextUnformatted(result.ptr, result.ptr + result.len);
1623+
cimgui.igTextUnformatted(result.ptr, result.ptr + result.len);
16231624
}
16241625
pub fn textColored(color: [4]f32, comptime fmt: []const u8, args: anytype) void {
16251626
pushStyleColor4f(.{ .idx = .text, .c = color });
16261627
text(fmt, args);
16271628
popStyleColor(.{});
16281629
}
1629-
extern fn zguiTextUnformatted(txt: [*]const u8, txt_end: [*]const u8) void;
16301630
//--------------------------------------------------------------------------------------------------
16311631
pub fn textDisabled(comptime fmt: []const u8, args: anytype) void {
16321632
zguiTextDisabled("%s", formatZ(fmt, args).ptr);

0 commit comments

Comments
 (0)