chore: update upstream
This commit is contained in:
116
src/gui.zig
116
src/gui.zig
@@ -252,6 +252,16 @@ pub const io = struct {
|
||||
pub const addCharacterEvent = zguiIoAddCharacterEvent;
|
||||
extern fn zguiIoAddCharacterEvent(char: i32) void;
|
||||
};
|
||||
|
||||
pub fn setClipboardText(value: [:0]const u8) void {
|
||||
zguiSetClipboardText(value.ptr);
|
||||
}
|
||||
pub fn getClipboardText() [:0]const u8 {
|
||||
const value = zguiGetClipboardText();
|
||||
return std.mem.span(value);
|
||||
}
|
||||
extern fn zguiSetClipboardText(text: [*:0]const u8) void;
|
||||
extern fn zguiGetClipboardText() [*:0]const u8;
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const Context = *opaque {};
|
||||
pub const DrawData = *extern struct {
|
||||
@@ -943,9 +953,12 @@ pub const pushItemWidth = zguiPushItemWidth;
|
||||
pub const popItemWidth = zguiPopItemWidth;
|
||||
/// `void setNextItemWidth(item_width: f32) void`
|
||||
pub const setNextItemWidth = zguiSetNextItemWidth;
|
||||
/// `void setItemDefaultFocus() void`
|
||||
pub const setItemDefaultFocus = zguiSetItemDefaultFocus;
|
||||
extern fn zguiPushItemWidth(item_width: f32) void;
|
||||
extern fn zguiPopItemWidth() void;
|
||||
extern fn zguiSetNextItemWidth(item_width: f32) void;
|
||||
extern fn zguiSetItemDefaultFocus() void;
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// `pub fn getFont() Font`
|
||||
pub const getFont = zguiGetFont;
|
||||
@@ -3292,6 +3305,14 @@ pub const DrawList = *opaque {
|
||||
}
|
||||
extern fn zguiDrawList_ResetForNewFrame(draw_list: DrawList) void;
|
||||
|
||||
pub fn clearMemory(draw_list: DrawList) void {
|
||||
if (draw_list.getOwnerName()) |owner| {
|
||||
@panic(format("zgui: illegally clearing memory DrawList of {s}", .{owner}));
|
||||
}
|
||||
zguiDrawList_ClearFreeMemory(draw_list);
|
||||
}
|
||||
extern fn zguiDrawList_ClearFreeMemory(draw_list: DrawList) void;
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
pub const getVertexBufferLength = zguiDrawList_GetVertexBufferLength;
|
||||
extern fn zguiDrawList_GetVertexBufferLength(draw_list: DrawList) i32;
|
||||
@@ -3829,7 +3850,7 @@ pub const DrawList = *opaque {
|
||||
uvmax: *const [2]f32,
|
||||
col: u32,
|
||||
rounding: f32,
|
||||
flags: u32,
|
||||
flags: DrawFlags,
|
||||
) void;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
pub const pathClear = zguiDrawList_PathClear;
|
||||
@@ -3923,7 +3944,7 @@ pub const DrawList = *opaque {
|
||||
p3: [2]f32,
|
||||
num_segments: u32 = 0,
|
||||
};
|
||||
pub fn pathPathBezierQuadraticCurveTo(draw_list: DrawList, args: PathBezierQuadraticCurveTo) void {
|
||||
pub fn pathBezierQuadraticCurveTo(draw_list: DrawList, args: PathBezierQuadraticCurveTo) void {
|
||||
zguiDrawList_PathBezierQuadraticCurveTo(draw_list, &args.p2, &args.p3, args.num_segments);
|
||||
}
|
||||
extern fn zguiDrawList_PathBezierQuadraticCurveTo(
|
||||
@@ -3950,4 +3971,95 @@ pub const DrawList = *opaque {
|
||||
flags: DrawFlags,
|
||||
) void;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
pub const primReserve = zguiDrawList_PrimReserve;
|
||||
pub const primUnreserve = zguiDrawList_PrimUnreserve;
|
||||
pub fn primRect(
|
||||
draw_list: DrawList,
|
||||
a: [2]f32,
|
||||
b: [2]f32,
|
||||
col: u32,
|
||||
) void {
|
||||
return zguiDrawList_PrimRect(draw_list, &a, &b, col);
|
||||
}
|
||||
pub fn primRectUV(
|
||||
draw_list: DrawList,
|
||||
a: [2]f32,
|
||||
b: [2]f32,
|
||||
uv_a: [2]f32,
|
||||
uv_b: [2]f32,
|
||||
col: u32,
|
||||
) void {
|
||||
return zguiDrawList_PrimRectUV(draw_list, &a, &b, &uv_a, &uv_b, col);
|
||||
}
|
||||
pub fn primQuadUV(
|
||||
draw_list: DrawList,
|
||||
a: [2]f32,
|
||||
b: [2]f32,
|
||||
c: [2]f32,
|
||||
d: [2]f32,
|
||||
uv_a: [2]f32,
|
||||
uv_b: [2]f32,
|
||||
uv_c: [2]f32,
|
||||
uv_d: [2]f32,
|
||||
col: u32,
|
||||
) void {
|
||||
return zguiDrawList_PrimQuadUV(draw_list, &a, &b, &c, &d, &uv_a, &uv_b, &uv_c, &uv_d, col);
|
||||
}
|
||||
pub fn primWriteVtx(
|
||||
draw_list: DrawList,
|
||||
pos: [2]f32,
|
||||
uv: [2]f32,
|
||||
col: u32,
|
||||
) void {
|
||||
return zguiDrawList_PrimWriteVtx(draw_list, &pos, &uv, col);
|
||||
}
|
||||
pub const primWriteIdx = zguiDrawList_PrimWriteIdx;
|
||||
|
||||
extern fn zguiDrawList_PrimReserve(
|
||||
draw_list: DrawList,
|
||||
idx_count: i32,
|
||||
vtx_count: i32,
|
||||
) void;
|
||||
extern fn zguiDrawList_PrimUnreserve(
|
||||
draw_list: DrawList,
|
||||
idx_count: i32,
|
||||
vtx_count: i32,
|
||||
) void;
|
||||
extern fn zguiDrawList_PrimRect(
|
||||
draw_list: DrawList,
|
||||
a: *const [2]f32,
|
||||
b: *const [2]f32,
|
||||
col: u32,
|
||||
) void;
|
||||
extern fn zguiDrawList_PrimRectUV(
|
||||
draw_list: DrawList,
|
||||
a: *const [2]f32,
|
||||
b: *const [2]f32,
|
||||
uv_a: *const [2]f32,
|
||||
uv_b: *const [2]f32,
|
||||
col: u32,
|
||||
) void;
|
||||
extern fn zguiDrawList_PrimQuadUV(
|
||||
draw_list: DrawList,
|
||||
a: *const [2]f32,
|
||||
b: *const [2]f32,
|
||||
c: *const [2]f32,
|
||||
d: *const [2]f32,
|
||||
uv_a: *const [2]f32,
|
||||
uv_b: *const [2]f32,
|
||||
uv_c: *const [2]f32,
|
||||
uv_d: *const [2]f32,
|
||||
col: u32,
|
||||
) void;
|
||||
extern fn zguiDrawList_PrimWriteVtx(
|
||||
draw_list: DrawList,
|
||||
pos: *const [2]f32,
|
||||
uv: *const [2]f32,
|
||||
col: u32,
|
||||
) void;
|
||||
extern fn zguiDrawList_PrimWriteIdx(
|
||||
draw_list: DrawList,
|
||||
idx: DrawIdx,
|
||||
) void;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
};
|
||||
|
||||
76
src/zgui.cpp
76
src/zgui.cpp
@@ -1040,6 +1040,10 @@ ZGUI_API void zguiSetNextItemWidth(float item_width) {
|
||||
ImGui::SetNextItemWidth(item_width);
|
||||
}
|
||||
|
||||
ZGUI_API void zguiSetItemDefaultFocus(void) {
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
|
||||
ZGUI_API ImFont* zguiGetFont(void) {
|
||||
return ImGui::GetFont();
|
||||
}
|
||||
@@ -1148,6 +1152,14 @@ ZGUI_API ImGuiID zguiGetPtrId(const void* ptr_id) {
|
||||
return ImGui::GetID(ptr_id);
|
||||
}
|
||||
|
||||
ZGUI_API void zguiSetClipboardText(const char* text) {
|
||||
ImGui::SetClipboardText(text);
|
||||
}
|
||||
|
||||
ZGUI_API const char* zguiGetClipboardText(void) {
|
||||
return ImGui::GetClipboardText();
|
||||
}
|
||||
|
||||
ZGUI_API ImFont* zguiIoAddFontFromFileWithConfig(
|
||||
const char* filename,
|
||||
float size_pixels,
|
||||
@@ -1572,6 +1584,10 @@ ZGUI_API void zguiDrawList_ResetForNewFrame(ImDrawList *draw_list) {
|
||||
draw_list->_ResetForNewFrame();
|
||||
}
|
||||
|
||||
ZGUI_API void zguiDrawList_ClearFreeMemory(ImDrawList *draw_list) {
|
||||
draw_list->_ClearFreeMemory();
|
||||
}
|
||||
|
||||
ZGUI_API int zguiDrawList_GetVertexBufferLength(ImDrawList *draw_list) {
|
||||
return draw_list->VtxBuffer.size();
|
||||
}
|
||||
@@ -1976,6 +1992,66 @@ ZGUI_API void zguiDrawList_PathRect(
|
||||
) {
|
||||
draw_list->PathRect({ rect_min[0], rect_min[1] }, { rect_max[0], rect_max[1] }, rounding, flags);
|
||||
}
|
||||
|
||||
ZGUI_API void zguiDrawList_PrimReserve( ImDrawList* draw_list, int idx_count, int vtx_count) {
|
||||
draw_list->PrimReserve(idx_count, vtx_count);
|
||||
}
|
||||
|
||||
ZGUI_API void zguiDrawList_PrimUnreserve( ImDrawList* draw_list, int idx_count, int vtx_count) {
|
||||
draw_list->PrimUnreserve(idx_count, vtx_count);
|
||||
}
|
||||
|
||||
ZGUI_API void zguiDrawList_PrimRect(
|
||||
ImDrawList* draw_list,
|
||||
const float a[2],
|
||||
const float b[2],
|
||||
unsigned int col
|
||||
) {
|
||||
draw_list->PrimRect({ a[0], a[1] }, { b[0], b[1] }, col);
|
||||
}
|
||||
|
||||
ZGUI_API void zguiDrawList_PrimRectUV(
|
||||
ImDrawList* draw_list,
|
||||
const float a[2],
|
||||
const float b[2],
|
||||
const float uv_a[2],
|
||||
const float uv_b[2],
|
||||
unsigned int col
|
||||
) {
|
||||
draw_list->PrimRectUV({ a[0], a[1] }, { b[0], b[1] }, { uv_a[0], uv_a[1] }, { uv_b[0], uv_b[1] }, col);
|
||||
}
|
||||
|
||||
ZGUI_API void zguiDrawList_PrimQuadUV(
|
||||
ImDrawList* draw_list,
|
||||
const float a[2],
|
||||
const float b[2],
|
||||
const float c[2],
|
||||
const float d[2],
|
||||
const float uv_a[2],
|
||||
const float uv_b[2],
|
||||
const float uv_c[2],
|
||||
const float uv_d[2],
|
||||
unsigned int col
|
||||
) {
|
||||
draw_list->PrimQuadUV(
|
||||
{ a[0], a[1] }, { b[0], b[1] }, { c[0], c[1] }, { d[0], d[1] },
|
||||
{ uv_a[0], uv_a[1] }, { uv_b[0], uv_b[1] }, { uv_c[0], uv_c[1] }, { uv_d[0], uv_d[1] },
|
||||
col
|
||||
);
|
||||
}
|
||||
|
||||
ZGUI_API void zguiDrawList_PrimWriteVtx(
|
||||
ImDrawList* draw_list,
|
||||
const float pos[2],
|
||||
const float uv[2],
|
||||
unsigned int col
|
||||
) {
|
||||
draw_list->PrimWriteVtx({ pos[0], pos[1] }, { uv[0], uv[1] }, col);
|
||||
}
|
||||
|
||||
ZGUI_API void zguiDrawList_PrimWriteIdx( ImDrawList* draw_list, ImDrawIdx idx) {
|
||||
draw_list->PrimWriteIdx(idx);
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Viewport
|
||||
|
||||
Reference in New Issue
Block a user