put some config in the devmode UI

This commit is contained in:
Mitchell Hashimoto
2022-11-21 09:09:25 -08:00
parent b4f5107717
commit 9b0fbde838
3 changed files with 185 additions and 1 deletions

View File

@@ -3,10 +3,14 @@ const c = @import("c.zig");
const imgui = @import("main.zig");
const Allocator = std.mem.Allocator;
pub const fltMax = c.igGET_FLT_MAX;
pub const fltMin = c.igGET_FLT_MIN;
pub const newFrame = c.igNewFrame;
pub const endFrame = c.igEndFrame;
pub const getTextLineHeight = c.igGetTextLineHeight;
pub const render = c.igRender;
pub const end = c.igEnd;
pub const endTable = c.igEndTable;
pub const beginTooltip = c.igBeginTooltip;
pub const endTooltip = c.igEndTooltip;
pub const spacing = c.igSpacing;
@@ -19,6 +23,8 @@ pub const getFontSize = c.igGetFontSize;
pub const pushTextWrapPos = c.igPushTextWrapPos;
pub const popTextWrapPos = c.igPopTextWrapPos;
pub const treePop = c.igTreePop;
pub const tableHeadersRow = c.igTableHeadersRow;
pub const tableNextColumn = c.igTableNextColumn;
pub fn showDemoWindow(open: ?*bool) void {
c.igShowDemoWindow(@ptrCast([*c]bool, if (open) |v| v else null));
@@ -60,6 +66,54 @@ pub fn treeNode(
);
}
pub fn beginTable(
id: [:0]const u8,
cols: c_int,
flags: TableFlags,
) bool {
return c.igBeginTable(
id.ptr,
cols,
@bitCast(c_int, flags),
.{ .x = 0, .y = 0 },
0,
);
}
pub fn tableNextRow(min_height: f32) void {
c.igTableNextRow(0, min_height);
}
pub fn tableSetupColumn(
label: [:0]const u8,
flags: TableColumnFlags,
init_size: f32,
) void {
c.igTableSetupColumn(
label.ptr,
@bitCast(c_int, flags),
init_size,
0,
);
}
pub fn inputTextMultiline(
label: [:0]const u8,
buf: []u8,
size: c.ImVec2,
flags: InputTextFlags,
) bool {
return c.igInputTextMultiline(
label.ptr,
buf.ptr,
buf.len,
size,
@bitCast(c_int, flags),
null,
null,
);
}
pub const WindowFlags = packed struct {
no_title_bar: bool = false,
no_resize: bool = false,
@@ -119,6 +173,93 @@ pub const TreeNodeFlags = packed struct {
}
};
pub const TableFlags = packed struct(u32) {
resizable: bool = false,
reorderable: bool = false,
hideable: bool = false,
sortable: bool = false,
no_saved_settings: bool = false,
context_menu_in_body: bool = false,
row_bg: bool = false,
borders_inner_h: bool = false,
borders_outer_h: bool = false,
borders_inner_v: bool = false,
borders_outer_v: bool = false,
no_borders_in_body: bool = false,
no_borders_in_body_until_resize: bool = false,
sizing_fixed_fit: bool = false,
sizing_fixed_same: bool = false,
sizing_stretch_prop: bool = false,
sizing_stretch_same: bool = false,
no_host_extend_x: bool = false,
no_host_extend_y: bool = false,
no_keep_columns_visible: bool = false,
precise_widths: bool = false,
no_clip: bool = false,
pad_outer_x: bool = false,
no_pad_outer_x: bool = false,
no_pad_inner_x: bool = false,
scroll_x: bool = false,
scroll_y: bool = false,
sort_multi: bool = false,
sort_tristate: bool = false,
_padding: u3 = 0,
};
pub const TableColumnFlags = packed struct(u32) {
disabled: bool = false,
default_hide: bool = false,
default_sort: bool = false,
width_stretch: bool = false,
width_fixed: bool = false,
no_resize: bool = false,
no_reorder: bool = false,
no_hide: bool = false,
no_clip: bool = false,
no_sort: bool = false,
no_sort_ascending: bool = false,
no_sort_descending: bool = false,
no_header_label: bool = false,
no_header_width: bool = false,
prefer_sort_ascending: bool = false,
prefer_sort_descending: bool = false,
indent_enable: bool = false,
indent_disable: bool = false,
is_enabled: bool = false,
is_visible: bool = false,
is_sorted: bool = false,
is_hovered: bool = false,
_unused: u10 = 0,
};
pub const InputTextFlags = packed struct(c_int) {
chars_decimal: bool = false,
chars_hexadecimal: bool = false,
chars_uppercase: bool = false,
chars_no_blank: bool = false,
auto_select_all: bool = false,
enter_returns_true: bool = false,
callback_completion: bool = false,
callback_history: bool = false,
callback_always: bool = false,
callback_char_filter: bool = false,
allow_tab_input: bool = false,
ctrl_enter_for_newline: bool = false,
no_horizontal_scroll: bool = false,
always_overwrite: bool = false,
read_only: bool = false,
password: bool = false,
no_undo_redo: bool = false,
chars_scientific: bool = false,
callback_resize: bool = false,
callback_edit: bool = false,
_padding: u12 = 0,
test {
try std.testing.expectEqual(@bitSizeOf(c_int), @bitSizeOf(InputTextFlags));
}
};
pub const HoveredFlags = packed struct {
child_windows: bool = false,
root_window: bool = false,