profile
viewpoint

Ask questionsProper way to implement a custom widget?

This is not an issue but rather a question to ask.

What's the proper way to implement a custom widget? Says I want to create a rotating progress indicator, using drawing methods like AddArcTo etc...

After the widget is drawn, invoke SetCursorPos to move the drawing cursor to next line.

Everything works fine but when I tried to use the progress indicator with ImGui::SameLine, the X value of position of the indicator will become 0.

After read the imgui_widgets.cpp, I noticed there is a method called ImGui::ItemSize will do the trick by setting the CursorPosPrevLine, but it is not exposed to outside.

Should I not use it but to set the window->DC.CursorPosPrevLine manually ?

ocornut/imgui

Answer questions codecat

Sorry to bump this as I'm not sure if there's been any further developments in terms of examples and such. Is there a way to make it so that I can still drag the window when clicking & dragging an InvisibleButton? Or should I use the 2nd method described in this thread if I want to have this behavior?

useful!
source:https://uonfu.com/
answerer
Melissa codecat Nimble Tools Heiloo, The Netherlands https://codecat.nl/ Overworked Dutch gamedev and hacker girl who writes code and is secretly a cat.
Github User Rank List