diff --git a/README.md b/README.md index 942964e3..8a6b0a03 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![completion](https://img.shields.io/badge/completion-72%25%20%28326%20of%20450%29-blue.svg)](https://github.com/swistakm/pyimgui) +[![completion](https://img.shields.io/badge/completion-73%25%20%28330%20of%20452%29-blue.svg)](https://github.com/swistakm/pyimgui) [![Coverage Status](https://coveralls.io/repos/github/swistakm/pyimgui/badge.svg?branch=master)](https://coveralls.io/github/swistakm/pyimgui?branch=master) [![Documentation Status](https://readthedocs.org/projects/pyimgui/badge/?version=latest)](https://pyimgui.readthedocs.io/en/latest/?badge=latest) diff --git a/imgui/cimgui.pxd b/imgui/cimgui.pxd index f9cea5f2..330b9d27 100644 --- a/imgui/cimgui.pxd +++ b/imgui/cimgui.pxd @@ -237,6 +237,23 @@ cdef extern from "imgui.h": float rounding, # = 0.0f int rounding_corners_flags # = ImDrawCornerFlags_All ) except + # ✓ + + void AddCircle( + const ImVec2& centre, + float radius, + ImU32 col, + # note: optional + int num_segments, # = 12 + float thickness # = 1.0f + ) except + # ✓ + + void AddCircleFilled( + const ImVec2& centre, + float radius, + ImU32 col, + # note: optional + int num_segments # = 12 + ) except + # ✓ void ChannelsSplit(int channels_count) except + # ✓ @@ -550,11 +567,11 @@ cdef extern from "imgui.h" namespace "ImGui": # ==== # ID scopes - void PushID(const char* str_id) except + # ✗ + void PushID(const char* str_id) except + # ✓ void PushID(const char* str_id_begin, const char* str_id_end) except + # ✗ void PushID(const void* ptr_id) except + # ✗ void PushID(int int_id) except + # ✗ - void PopID() except + # ✗ + void PopID() except + # ✓ ImGuiID GetID(const char* str_id) except + # ✗ ImGuiID GetID(const char* str_id_begin, const char* str_id_end) except + # ✗ ImGuiID GetID(const void* ptr_id) except + # ✗ diff --git a/imgui/core.pyx b/imgui/core.pyx index 6b005f3e..2b912c8b 100644 --- a/imgui/core.pyx +++ b/imgui/core.pyx @@ -494,6 +494,76 @@ cdef class _DrawList(object): thickness, ) + def add_circle( + self, + float center_x, float center_y, + float radius, + cimgui.ImU32 col, + # note: optional + int num_segments = 12, + float thickness = 1.0 + ): + """Add a circle outline to the draw list. + + Args: + center_x (float): X coordinate of center + center_y (float): Y coordinate of center + radius (float): radius + col (ImU32): RGBA color specification + # note: optional + num_segments (int): Number of line segments used to draw the circle, defaults to 12 + thickness (float): Line thickness, defaults to 1.0 + + .. wraps:: + void ImDrawList::AddCircle( + const ImVec2& center, + float radius, + ImU32 col, + int num_segments = 12, + float thickness = 1.0f + ) + """ + self._ptr.AddCircle( + _cast_args_ImVec2(center_x, center_y), + radius, + col, + num_segments, + thickness + ) + + def add_circle_filled( + self, + float center_x, float center_y, + float radius, + cimgui.ImU32 col, + # note: optional + int num_segments = 12 + ): + """Add a circle outline to the draw list. + + Args: + center_x (float): X coordinate of center + center_y (float): Y coordinate of center + radius (float): radius + col (ImU32): RGBA color specification + # note: optional + num_segments (int): Number of line segments used to draw the circle, defaults to 12 + + .. wraps:: + void ImDrawList::AddCircleFilled( + const ImVec2& center, + float radius, + ImU32 col, + int num_segments = 12 + ) + """ + self._ptr.AddCircleFilled( + _cast_args_ImVec2(center_x, center_y), + radius, + col, + num_segments + ) + # channels @@ -6715,6 +6785,25 @@ def set_current_context(_ImGuiContext ctx): """ cimgui.SetCurrentContext(ctx._ptr) +def push_id(str str_id): + """Push an ID into the ID stack + + Args: + id (str): ID to push + + wraps:: + PushID(const char* str_id) + """ + cimgui.PushID(_bytes(str_id)) + +def pop_id(): + """Pop from the ID stack + + wraps:: + PopID() + """ + cimgui.PopID() + # === Python/C++ cross API for error handling === from cpython.exc cimport PyErr_NewException