diff --git a/include/imgui_bindings.hpp b/include/imgui_bindings.hpp index 457b8ff..bbb04eb 100644 --- a/include/imgui_bindings.hpp +++ b/include/imgui_bindings.hpp @@ -176,6 +176,22 @@ struct PyImDrawList: OpaquePointer{ self->AddPolyline(pts.data(), pts.size(), ImColor(col), flags, thickness); return vm->None; }); + + vm->bind(type, "AddImageQuad(self, texture: Texture, p1: vec2, p2: vec2, p3: vec2, p4: vec2, uv1: vec2, uv2: vec2, uv3: vec2, uv4: vec2, col: vec4)", [](VM* vm, ArgsView args){ + PyImDrawList& self = _CAST(PyImDrawList&, args[0]); + Texture& texture = CAST(Texture&, args[1]); + ImVec2 p1 = py_cast(vm, args[2]); + ImVec2 p2 = py_cast(vm, args[3]); + ImVec2 p3 = py_cast(vm, args[4]); + ImVec2 p4 = py_cast(vm, args[5]); + ImVec2 uv1 = py_cast(vm, args[6]); + ImVec2 uv2 = py_cast(vm, args[7]); + ImVec2 uv3 = py_cast(vm, args[8]); + ImVec2 uv4 = py_cast(vm, args[9]); + ImVec4 col = py_cast(vm, args[10]); + self->AddImageQuad(texture.imgui_id(), p1, p2, p3, p4, uv1, uv2, uv3, uv4, ImColor(col)); + return vm->None; + }); } }; diff --git a/include/template/imgui_bindings.hpp b/include/template/imgui_bindings.hpp index 047b6ec..24197c0 100644 --- a/include/template/imgui_bindings.hpp +++ b/include/template/imgui_bindings.hpp @@ -176,6 +176,22 @@ struct PyImDrawList: OpaquePointer{ self->AddPolyline(pts.data(), pts.size(), ImColor(col), flags, thickness); return vm->None; }); + + vm->bind(type, "AddImageQuad(self, texture: Texture, p1: vec2, p2: vec2, p3: vec2, p4: vec2, uv1: vec2, uv2: vec2, uv3: vec2, uv4: vec2, col: vec4)", [](VM* vm, ArgsView args){ + PyImDrawList& self = _CAST(PyImDrawList&, args[0]); + Texture& texture = CAST(Texture&, args[1]); + ImVec2 p1 = py_cast(vm, args[2]); + ImVec2 p2 = py_cast(vm, args[3]); + ImVec2 p3 = py_cast(vm, args[4]); + ImVec2 p4 = py_cast(vm, args[5]); + ImVec2 uv1 = py_cast(vm, args[6]); + ImVec2 uv2 = py_cast(vm, args[7]); + ImVec2 uv3 = py_cast(vm, args[8]); + ImVec2 uv4 = py_cast(vm, args[9]); + ImVec4 col = py_cast(vm, args[10]); + self->AddImageQuad(texture.imgui_id(), p1, p2, p3, p4, uv1, uv2, uv3, uv4, ImColor(col)); + return vm->None; + }); } }; diff --git a/moc/gen_imgui_pyi.py b/moc/gen_imgui_pyi.py index 41de41a..efb28cf 100644 --- a/moc/gen_imgui_pyi.py +++ b/moc/gen_imgui_pyi.py @@ -24,6 +24,7 @@ def AddTriangleFilled(self, p1: vec2, p2: vec2, p3: vec2, col: vec4): ... def AddCircle(self, center: vec2, radius: float, col: vec4, num_segments: int = 0, thickness: float = 1.0): ... def AddCircleFilled(self, center: vec2, radius: float, col: vec4, num_segments: int = 0): ... def AddPolyline(self, points: list[vec2], col: vec4, flags: int = 0, thickness: float = 1.0): ... + def AddImageQuad(self, texture: Texture, p1: vec2, p2: vec2, p3: vec2, p4: vec2, uv1: vec2, uv2: vec2, uv3: vec2, uv4: vec2, col: vec4): ... ''') # structs diff --git a/workdir/ImGui.pyi b/workdir/ImGui.pyi index 4ee62ec..2033472 100644 --- a/workdir/ImGui.pyi +++ b/workdir/ImGui.pyi @@ -18,6 +18,7 @@ class ImDrawList: def AddCircle(self, center: vec2, radius: float, col: vec4, num_segments: int = 0, thickness: float = 1.0): ... def AddCircleFilled(self, center: vec2, radius: float, col: vec4, num_segments: int = 0): ... def AddPolyline(self, points: list[vec2], col: vec4, flags: int = 0, thickness: float = 1.0): ... + def AddImageQuad(self, texture: Texture, p1: vec2, p2: vec2, p3: vec2, p4: vec2, uv1: vec2, uv2: vec2, uv3: vec2, uv4: vec2, col: vec4): ... class ImDrawData: Valid: bool # bool