-
Notifications
You must be signed in to change notification settings - Fork 186
Upgrade to imgui 1.51 [WIP] #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hey, the amount of work you did is really impressive. For the tests I have used scripts in custom
Regarding Cython, I think that the "compilation" should be enough to provide type safety for mapped functions. Still some functions must be tested with unit tests or visual examples to ensure that we ensure correctness of the intended Python API. For instance one of tests failed in following way on Python 3:
It's because the function is now:
With above Cython will ensure that first argument to In above example it would be probably better to use following:
Note: the |
Side note: I wonder how/if we should provide some backwards compatibility for these changes. Some things like |
You're welcome! Oh! That's a cool way to do tests. I didn't realize that the visual docs work that way, I thought this repo was actually flying with no unit tests. I'll fix this tonight. I'll also going to add checkboxes for myself to add function stubs or fully port all of the functions added in 1.50 and 1.51. |
Closed in favour of #73 |
Hey @swistakm, this is my first pass on the breaking changes in 1.51. Migrating to 1.51 is needed for #52 and is probably just good to do in general. (I was able to install 1.50 and
make rebuild
with no compile errors at all, so I went on to 1.51)There are plenty of non-breaking changes (such as ColorEditFlags being added, and SetColumnWidth being added) that I didn't do.
What do you do to test this? Does the cython compilation step ensure enough typesafety that we can be sure it's good? Should I make a "1.51 demo" app?
Here's the checklist I was working off on. Sorry that my commits are in a semi-random order:
Breaking Changes
Renamed IsItemHoveredRect() to IsItemRectHovered(). Kept inline redirection function (will obsolete).
Renamed IsMouseHoveringWindow() to IsWindowRectHovered() for consistency. Kept inline redirection function (will obsolete).
Renamed IsMouseHoveringAnyWindow() to IsAnyWindowHovered() for consistency. Kept inline redirection function (will obsolete).
Renamed ImGuiCol_Columns*** enums to ImGuiCol_Separator***. Kept redirection enums (will obsolete). (Not relevant, because not implemented)
Renamed ImGuiSetCond*** types and enums to ImGuiCond***. Kept redirection enums (will obsolete).
Renamed GetStyleColName() to GetStyleColorName() for consistency. Unlikely to be used by end-user!
Added PushStyleColor(ImGuiCol idx, ImU32 col) overload, which might cause an "ambiguous call" compilation error if you are using ImColor() with implicit cast. Cast to ImU32 or ImVec4 explicily to fix.
Marked the weird IMGUI_ONCE_UPON_A_FRAME helper macro as obsolete. Prefer using the more explicit ImGuiOnceUponAFrame.
Changed ColorEdit4(const char* label, float col[4], bool show_alpha = true) signature to ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0), where flags 0x01 is a safe no-op (hello dodgy backward compatibility!). The new ColorEdit4/ColorPicker4 functions have lots of available flags! Check and run the demo window, under "Color/Picker Widgets", to understand the various new options.
Changed signature of ColorButton(ImVec4 col, bool small_height = false, bool outline_border = true) to ColorButton(const char* desc_id, ImVec4 col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0,0)). This function was rarely used and was very dodgy (no explicit ID!).
bool ColorButton( # ✓
const char*, ImVec4 col,
# note: optional
ImGuiColorEditFlags flags, ImVec2 size
) except +
Changed BeginPopupContextWindow(bool also_over_items=true, const char* str_id=NULL, int mouse_button=1) signature to (const char* str_id=NULL, int mouse_button=1, bool also_over_items=true). This is perhaps the most aggressive change in this update, but note that the majority of users relied on default parameters completely, so this will affect only a fraction of users of this already rarely used function.
Removed IsPosHoveringAnyWindow(), which was partly broken and misleading. In the vast majority of cases, people using that function wanted to use io.WantCaptureMouse flag. Replaced with IM_ASSERT + comment redirecting user to io.WantCaptureMouse. (#1237)
Removed the old ValueColor() helpers, they are equivalent to calling Text(label) + SameLine() + ColorButton().
Removed ColorEditMode() and ImGuiColorEditMode type in favor of ImGuiColorEditFlags and parameters to the various Color*() functions. The SetColorEditOptions() function allows to initialize default but the user can still change them with right-click context menu. Commenting out your old call to ColorEditMode() may just be fine!
Other changes to migrate or stub out
ImFontAtlas: Added GlyphRangesBuilder helper class, which makes it easier to build custom glyph ranges from your app/game localization data, or add into existing glyph ranges.