chore: update upstream
This commit is contained in:
53
src/gui.zig
53
src/gui.zig
@@ -243,6 +243,9 @@ pub const io = struct {
|
||||
pub const addKeyEvent = zguiIoAddKeyEvent;
|
||||
extern fn zguiIoAddKeyEvent(key: Key, down: bool) void;
|
||||
|
||||
pub const addInputCharactersUTF8 = zguiIoAddInputCharactersUTF8;
|
||||
extern fn zguiIoAddInputCharactersUTF8(utf8_chars: ?[*:0]const u8) void;
|
||||
|
||||
pub const setKeyEventNativeData = zguiIoSetKeyEventNativeData;
|
||||
extern fn zguiIoSetKeyEventNativeData(key: Key, keycode: i32, scancode: i32) void;
|
||||
|
||||
@@ -298,7 +301,7 @@ pub const Key = enum(u32) {
|
||||
four,
|
||||
five,
|
||||
six,
|
||||
severn,
|
||||
seven,
|
||||
eight,
|
||||
nine,
|
||||
a,
|
||||
@@ -407,11 +410,11 @@ pub const Key = enum(u32) {
|
||||
mouse_wheel_x,
|
||||
mouse_wheel_y,
|
||||
|
||||
pub const mod_ctrl: u32 = 1 << 12;
|
||||
pub const mod_shift: u32 = 1 << 13;
|
||||
pub const mod_alt: u32 = 1 << 14;
|
||||
pub const mod_super: u32 = 1 << 15;
|
||||
pub const mod_mask_: u32 = 0xf000;
|
||||
mod_ctrl = 1 << 12,
|
||||
mod_shift = 1 << 13,
|
||||
mod_alt = 1 << 14,
|
||||
mod_super = 1 << 15,
|
||||
mod_mask_ = 0xf000,
|
||||
};
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
pub const WindowFlags = packed struct(u32) {
|
||||
@@ -558,6 +561,10 @@ pub fn setNextWindowBgAlpha(args: SetNextWindowBgAlpha) void {
|
||||
zguiSetNextWindowBgAlpha(args.alpha);
|
||||
}
|
||||
extern fn zguiSetNextWindowBgAlpha(alpha: f32) void;
|
||||
|
||||
/// `pub fn setKeyboardFocusHere(offset: i32) void`
|
||||
pub const setKeyboardFocusHere = zguiSetKeyboardFocusHere;
|
||||
extern fn zguiSetKeyboardFocusHere(offset: i32) void;
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const Begin = struct {
|
||||
popen: ?*bool = null,
|
||||
@@ -1098,6 +1105,19 @@ extern fn zguiGetTextLineHeightWithSpacing() f32;
|
||||
extern fn zguiGetFrameHeight() f32;
|
||||
extern fn zguiGetFrameHeightWithSpacing() f32;
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
pub fn getItemRectMax() [2]f32 {
|
||||
var rect: [2]f32 = undefined;
|
||||
zguiGetItemRectMax(&rect);
|
||||
return rect;
|
||||
}
|
||||
pub fn getItemRectMin() [2]f32 {
|
||||
var rect: [2]f32 = undefined;
|
||||
zguiGetItemRectMin(&rect);
|
||||
return rect;
|
||||
}
|
||||
extern fn zguiGetItemRectMax(rect: *[2]f32) void;
|
||||
extern fn zguiGetItemRectMin(rect: *[2]f32) void;
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// ID stack/scopes
|
||||
//
|
||||
@@ -2763,14 +2783,21 @@ pub const TableBgTarget = enum(u32) {
|
||||
};
|
||||
|
||||
pub const BeginTable = struct {
|
||||
column: i32,
|
||||
flags: TableFlags = .{},
|
||||
outer_size: [2]f32 = .{ 0, 0 },
|
||||
inner_width: f32 = 0,
|
||||
};
|
||||
pub fn beginTable(name: [:0]const u8, args: BeginTable) void {
|
||||
zguiBeginTable(name, args.flags, args.outer_size, args.inner_width);
|
||||
zguiBeginTable(name, args.column, args.flags, &args.outer_size, args.inner_width);
|
||||
}
|
||||
extern fn zguiBeginTable(str_id: [*:0]const u8, column: i32, flags: TableFlags, outer_size: [2]f32, inner_width: f32) void;
|
||||
extern fn zguiBeginTable(
|
||||
str_id: [*:0]const u8,
|
||||
column: i32,
|
||||
flags: TableFlags,
|
||||
outer_size: *const [2]f32,
|
||||
inner_width: f32,
|
||||
) void;
|
||||
|
||||
pub fn endTable() void {
|
||||
zguiEndTable();
|
||||
@@ -2870,6 +2897,8 @@ pub const MouseButton = enum(u32) {
|
||||
right = 1,
|
||||
middle = 2,
|
||||
};
|
||||
/// `pub fn isMouseDoubleClicked(mouse_button: MouseButton) bool`
|
||||
pub const isMouseDoubleClicked = zguiIsMouseDoubleClicked;
|
||||
/// `pub fn isItemClicked(mouse_button: MouseButton) bool`
|
||||
pub const isItemClicked = zguiIsItemClicked;
|
||||
/// `pub fn isItemVisible() bool`
|
||||
@@ -2890,6 +2919,7 @@ pub const isAnyItemHovered = zguiIsAnyItemHovered;
|
||||
pub const isAnyItemActive = zguiIsAnyItemActive;
|
||||
/// `pub fn isAnyItemFocused() bool`
|
||||
pub const isAnyItemFocused = zguiIsAnyItemFocused;
|
||||
extern fn zguiIsMouseDoubleClicked(mouse_button: MouseButton) bool;
|
||||
extern fn zguiIsItemHovered(flags: HoveredFlags) bool;
|
||||
extern fn zguiIsItemActive() bool;
|
||||
extern fn zguiIsItemFocused() bool;
|
||||
@@ -3023,6 +3053,8 @@ pub const endTooltip = zguiEndTooltip;
|
||||
extern fn zguiBeginTooltip() void;
|
||||
extern fn zguiEndTooltip() void;
|
||||
|
||||
/// `pub fn beginPopupContextWindow() bool`
|
||||
pub const beginPopupContextWindow = zguiBeginPopupContextWindow;
|
||||
pub const PopupFlags = packed struct(u32) {
|
||||
mouse_button_left: bool = false,
|
||||
mouse_button_right: bool = false,
|
||||
@@ -3046,6 +3078,7 @@ pub fn openPopup(str_id: [:0]const u8, flags: PopupFlags) void {
|
||||
pub const endPopup = zguiEndPopup;
|
||||
/// `pub fn closeCurrentPopup() void`
|
||||
pub const closeCurrentPopup = zguiCloseCurrentPopup;
|
||||
extern fn zguiBeginPopupContextWindow() bool;
|
||||
extern fn zguiBeginPopupModal(name: [*:0]const u8, popen: ?*bool, flags: WindowFlags) bool;
|
||||
extern fn zguiEndPopup() void;
|
||||
extern fn zguiOpenPopup(str_id: [*:0]const u8, flags: PopupFlags) void;
|
||||
@@ -3281,9 +3314,11 @@ pub const DrawList = *opaque {
|
||||
anti_aliased_fill: bool = false,
|
||||
allow_vtx_offset: bool = false,
|
||||
|
||||
_padding: u28,
|
||||
_padding: u28 = 0,
|
||||
};
|
||||
|
||||
pub const setDrawListFlags = zguiDrawList_SetFlags;
|
||||
extern fn zguiDrawList_SetFlags(draw_list: DrawList, flags: DrawListFlags) void;
|
||||
pub const getDrawListFlags = zguiDrawList_GetFlags;
|
||||
extern fn zguiDrawList_GetFlags(draw_list: DrawList) DrawListFlags;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// named parameters and Zig style text formatting.
|
||||
//
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
pub const version = @import("std").SemanticVersion{ .major = 0, .minor = 9, .patch = 4 };
|
||||
pub const version = @import("std").SemanticVersion{ .major = 0, .minor = 9, .patch = 5 };
|
||||
|
||||
pub usingnamespace @import("gui.zig");
|
||||
pub const plot = @import("plot.zig");
|
||||
|
||||
34
src/zgui.cpp
34
src/zgui.cpp
@@ -44,6 +44,10 @@ ZGUI_API void zguiSetNextWindowBgAlpha(float alpha) {
|
||||
ImGui::SetNextWindowBgAlpha(alpha);
|
||||
}
|
||||
|
||||
ZGUI_API void zguiSetKeyboardFocusHere(int offset) {
|
||||
ImGui::SetKeyboardFocusHere(offset);
|
||||
}
|
||||
|
||||
ZGUI_API bool zguiBegin(const char* name, bool* p_open, ImGuiWindowFlags flags) {
|
||||
return ImGui::Begin(name, p_open, flags);
|
||||
}
|
||||
@@ -186,6 +190,18 @@ ZGUI_API void zguiEndGroup(void) {
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
|
||||
ZGUI_API void zguiGetItemRectMax(float rect[2]) {
|
||||
const ImVec2 r = ImGui::GetItemRectMax();
|
||||
rect[0] = r.x;
|
||||
rect[1] = r.y;
|
||||
}
|
||||
|
||||
ZGUI_API void zguiGetItemRectMin(float rect[2]) {
|
||||
const ImVec2 r = ImGui::GetItemRectMin();
|
||||
rect[0] = r.x;
|
||||
rect[1] = r.y;
|
||||
}
|
||||
|
||||
ZGUI_API void zguiGetCursorPos(float pos[2]) {
|
||||
const ImVec2 p = ImGui::GetCursorPos();
|
||||
pos[0] = p.x;
|
||||
@@ -1244,6 +1260,10 @@ ZGUI_API void zguiIoAddKeyEvent(ImGuiKey key, bool down) {
|
||||
ImGui::GetIO().AddKeyEvent(key, down);
|
||||
}
|
||||
|
||||
ZGUI_API void zguiIoAddInputCharactersUTF8(const char* utf8_chars) {
|
||||
ImGui::GetIO().AddInputCharactersUTF8(utf8_chars);
|
||||
}
|
||||
|
||||
ZGUI_API void zguiIoSetKeyEventNativeData(ImGuiKey key, int keycode, int scancode) {
|
||||
ImGui::GetIO().SetKeyEventNativeData(key, keycode, scancode);
|
||||
}
|
||||
@@ -1269,6 +1289,10 @@ ZGUI_API bool zguiIsItemClicked(ImGuiMouseButton mouse_button) {
|
||||
return ImGui::IsItemClicked(mouse_button);
|
||||
}
|
||||
|
||||
ZGUI_API bool zguiIsMouseDoubleClicked(ImGuiMouseButton button) {
|
||||
return ImGui::IsMouseDoubleClicked(button);
|
||||
}
|
||||
|
||||
ZGUI_API bool zguiIsItemVisible(void) {
|
||||
return ImGui::IsItemVisible();
|
||||
}
|
||||
@@ -1389,6 +1413,10 @@ ZGUI_API void zguiEndTooltip(void) {
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
ZGUI_API bool zguiBeginPopupContextWindow(void) {
|
||||
return ImGui::BeginPopupContextWindow();
|
||||
}
|
||||
|
||||
ZGUI_API bool zguiBeginPopupModal(const char* name, bool* p_open, ImGuiWindowFlags flags) {
|
||||
return ImGui::BeginPopupModal(name, p_open, flags);
|
||||
}
|
||||
@@ -1413,7 +1441,7 @@ ZGUI_API void zguiBeginTable(
|
||||
const char* str_id,
|
||||
int column,
|
||||
ImGuiTableFlags flags,
|
||||
float outer_size[2],
|
||||
const float outer_size[2],
|
||||
float inner_width
|
||||
) {
|
||||
ImGui::BeginTable(str_id, column, flags, { outer_size[0], outer_size[1] }, inner_width);
|
||||
@@ -1564,6 +1592,10 @@ ZGUI_API int zguiDrawList_GetCmdBufferLength(ImDrawList *draw_list) {
|
||||
ZGUI_API ImDrawCmd *zguiDrawList_GetCmdBufferData(ImDrawList *draw_list) {
|
||||
return draw_list->CmdBuffer.begin();
|
||||
}
|
||||
|
||||
ZGUI_API void zguiDrawList_SetFlags(ImDrawList *draw_list, ImDrawListFlags flags) {
|
||||
draw_list->Flags = flags;
|
||||
}
|
||||
ZGUI_API ImDrawListFlags zguiDrawList_GetFlags(ImDrawList *draw_list) {
|
||||
return draw_list->Flags;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user