Skip to content

Commit

Permalink
progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
kecho committed Dec 27, 2023
1 parent 566d76a commit 338fbfb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
16 changes: 16 additions & 0 deletions Source/pymodules/gpu/ImguiBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,22 @@ PyObject* setNextFrameWantCaptureKeyboard(PyObject* self, PyObject* vargs, PyObj
Py_RETURN_NONE;
}

PyObject* progressBar(PyObject* self, PyObject* vargs, PyObject* kwds)
{
CHECK_IMGUI;
auto& imguiBuilder = *(ImguiBuilder*)self;
ModuleState& moduleState = parentModule(self);
static char* argnames[] = { "fraction", "size_arg", "overlay", nullptr };
float fraction = 0.0f;
ImVec2 size_arg = { -FLT_MIN, 0 };
char* overlay = nullptr;
if (!PyArg_ParseTupleAndKeywords(vargs, kwds, "f|(ff)s", argnames, &fraction, &size_arg.x, &size_arg.y, &overlay))
return nullptr;

ImGui::ProgressBar(fraction, size_arg, overlay);
Py_RETURN_NONE;
}

PyObject* setWindowDock(PyObject* self, PyObject* vargs, PyObject* kwds)
{
CHECK_IMGUI
Expand Down
9 changes: 8 additions & 1 deletion Source/pymodules/gpu/bindings/Imgui.inl
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ COALPY_FN(set_next_window_size, setNextWindowSize, R"(
condition_flags (optional) : see ImGuiCond
)")

COALPY_FN(set_next_window_pos, setNextFrameWantCaptureKeyboard, R"(
COALPY_FN(set_next_window_pos, setNextWindowPos, R"(
Parameters:
pos (with, height) : the width and height of next window size.
condition_flags (optional) : see ImGuiCond
Expand All @@ -529,6 +529,13 @@ COALPY_FN(set_next_frame_want_capture_keyboard, setNextFrameWantCaptureKeyboard,
want_capture_keyboard (bool)
)")

COALPY_FN(progress_bar, progressBar, R"(
Parameters:
fraction (float)
size_arg (tuple)(x, y)
overlay (str)
)")

COALPY_FN(dockspace, dockspace, R"(
Creates an explicit dockspace
Expand Down

0 comments on commit 338fbfb

Please sign in to comment.