Skip to content
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

Update Dear Imgui to v1.82 #471

Merged
merged 5 commits into from Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion CHANGELOG.markdown
Expand Up @@ -23,8 +23,15 @@

- BREAKING: `PopupModal`'s `new` was reworked so that it didn't take `Ui` until `build` was called. This is a breaking change if you were invoking it directly. Simply move your `ui` call to `build` or `begin`.

- Upgrade to [Dear ImGui v1.81](https://github.com/ocornut/imgui/releases/tag/v1.81)
- Upgrade to from v1.80 to [Dear ImGui v1.82](https://github.com/ocornut/imgui/releases/tag/v1.82) (see also the [Dear ImGui v1.81](https://github.com/ocornut/imgui/releases/tag/v1.81) release notes)
- BREAKING: `imgui::ListBox::calculate_size(items_count: ..., height_in_items: ...)` has been removed as the function backing it has been marked as obsolete. The recommended approach is to calculate the size yourself and use `.size(...)` (or use the default auto-calculated size)
- BREAKING: `draw_list::CornerFlags` has been renamed to `draw_list::DrawFlags` to match the upstream change, and refle. However, the only draw flags that are useful to Rust currently are still the ones reflecting corner rounding.
- Similarly, the flag names have been updated so that `CornerFlags::$WHERE` has become `DrawFlags::ROUND_CORNERS_$WHERE`, for ecample `CornerFlags::TOP_LEFT` => `DrawFlags::ROUND_CORNERS_TOP_LEFT`.
- Importantly, `CornerFlags::NONE` became `DrawFlags::ROUND_CORNERS_NONE` (following the patter) and **not** `DrawFlags::NONE` which does exist now, and is a separate value.
- BREAKING: `InputTextFlags::ALWAYS_INSERT_MODE` is renamed to `InputTextFlags::
- However, the `always_insert_mode` funcitons on the various input builders remain as a (non-deprecated) alias, as the C++ code has kept an equivalent inline stub.
- BREAKING: `Style::circle_segment_max_error` is no more. `Style::circle_tesselation_max_error` behaves very similarly, but `circle_segment_max_error` values are not equivalent to `circle_tesselation_max_error` values.
- For example, the default `circle_segment_max_error` was 1.6, but the default `circle_tesselation_max_error` is 0.3. In practice, it's unlikely to matter much either way, though.

- Restored methods to access keyboard based on backend-defined keyboard map indexes. These allow access to most keys, not just those defined in the small subset of `imgui::Keys` (note the available keys may be expanded in future by [imgui PR #2625](https://github.com/ocornut/imgui/pull/2625))
- The new methods on `imgui::Ui` are `is_key_index_down`, `is_key_index_pressed`, `is_key_index_pressed_no_repeat`, `is_key_index_released`, `is_key_index_released`
Expand Down
133 changes: 88 additions & 45 deletions imgui-sys/src/bindings.rs

Large diffs are not rendered by default.

137 changes: 92 additions & 45 deletions imgui-sys/src/wasm_bindings.rs

Large diffs are not rendered by default.

50 changes: 35 additions & 15 deletions imgui-sys/third-party/cimgui.cpp
@@ -1,5 +1,5 @@
//This file is automatically generated by generator.lua from https://github.com/cimgui/cimgui
//based on imgui.h file version "1.81" from Dear ImGui https://github.com/ocornut/imgui
//based on imgui.h file version "1.82" from Dear ImGui https://github.com/ocornut/imgui

#include "./imgui/imgui.h"
#ifdef CIMGUI_FREETYPE
Expand Down Expand Up @@ -1099,7 +1099,7 @@ CIMGUI_API bool igTableSetColumnIndex(int column_n)
{
return ImGui::TableSetColumnIndex(column_n);
}
CIMGUI_API void igTableSetupColumn(const char* label,ImGuiTableColumnFlags flags,float init_width_or_weight,ImU32 user_id)
CIMGUI_API void igTableSetupColumn(const char* label,ImGuiTableColumnFlags flags,float init_width_or_weight,ImGuiID user_id)
{
return ImGui::TableSetupColumn(label,flags,init_width_or_weight,user_id);
}
Expand Down Expand Up @@ -1219,6 +1219,10 @@ CIMGUI_API void igLogButtons()
{
return ImGui::LogButtons();
}
CIMGUI_API void igLogTextV(const char* fmt,va_list args)
{
return ImGui::LogTextV(fmt,args);
}
CIMGUI_API bool igBeginDragDropSource(ImGuiDragDropFlags flags)
{
return ImGui::BeginDragDropSource(flags);
Expand Down Expand Up @@ -1519,10 +1523,14 @@ CIMGUI_API bool igDebugCheckVersionAndDataLayout(const char* version_str,size_t
{
return ImGui::DebugCheckVersionAndDataLayout(version_str,sz_io,sz_style,sz_vec2,sz_vec4,sz_drawvert,sz_drawidx);
}
CIMGUI_API void igSetAllocatorFunctions(void*(*alloc_func)(size_t sz,void* user_data),void(*free_func)(void* ptr,void* user_data),void* user_data)
CIMGUI_API void igSetAllocatorFunctions(ImGuiMemAllocFunc alloc_func,ImGuiMemFreeFunc free_func,void* user_data)
{
return ImGui::SetAllocatorFunctions(alloc_func,free_func,user_data);
}
CIMGUI_API void igGetAllocatorFunctions(ImGuiMemAllocFunc* p_alloc_func,ImGuiMemFreeFunc* p_free_func,void** p_user_data)
{
return ImGui::GetAllocatorFunctions(p_alloc_func,p_free_func,p_user_data);
}
CIMGUI_API void* igMemAlloc(size_t size)
{
return ImGui::MemAlloc(size);
Expand Down Expand Up @@ -1939,13 +1947,13 @@ CIMGUI_API void ImDrawList_AddLine(ImDrawList* self,const ImVec2 p1,const ImVec2
{
return self->AddLine(p1,p2,col,thickness);
}
CIMGUI_API void ImDrawList_AddRect(ImDrawList* self,const ImVec2 p_min,const ImVec2 p_max,ImU32 col,float rounding,ImDrawCornerFlags rounding_corners,float thickness)
CIMGUI_API void ImDrawList_AddRect(ImDrawList* self,const ImVec2 p_min,const ImVec2 p_max,ImU32 col,float rounding,ImDrawFlags flags,float thickness)
{
return self->AddRect(p_min,p_max,col,rounding,rounding_corners,thickness);
return self->AddRect(p_min,p_max,col,rounding,flags,thickness);
}
CIMGUI_API void ImDrawList_AddRectFilled(ImDrawList* self,const ImVec2 p_min,const ImVec2 p_max,ImU32 col,float rounding,ImDrawCornerFlags rounding_corners)
CIMGUI_API void ImDrawList_AddRectFilled(ImDrawList* self,const ImVec2 p_min,const ImVec2 p_max,ImU32 col,float rounding,ImDrawFlags flags)
{
return self->AddRectFilled(p_min,p_max,col,rounding,rounding_corners);
return self->AddRectFilled(p_min,p_max,col,rounding,flags);
}
CIMGUI_API void ImDrawList_AddRectFilledMultiColor(ImDrawList* self,const ImVec2 p_min,const ImVec2 p_max,ImU32 col_upr_left,ImU32 col_upr_right,ImU32 col_bot_right,ImU32 col_bot_left)
{
Expand Down Expand Up @@ -1991,9 +1999,9 @@ CIMGUI_API void ImDrawList_AddTextFontPtr(ImDrawList* self,const ImFont* font,fl
{
return self->AddText(font,font_size,pos,col,text_begin,text_end,wrap_width,cpu_fine_clip_rect);
}
CIMGUI_API void ImDrawList_AddPolyline(ImDrawList* self,const ImVec2* points,int num_points,ImU32 col,bool closed,float thickness)
CIMGUI_API void ImDrawList_AddPolyline(ImDrawList* self,const ImVec2* points,int num_points,ImU32 col,ImDrawFlags flags,float thickness)
{
return self->AddPolyline(points,num_points,col,closed,thickness);
return self->AddPolyline(points,num_points,col,flags,thickness);
}
CIMGUI_API void ImDrawList_AddConvexPolyFilled(ImDrawList* self,const ImVec2* points,int num_points,ImU32 col)
{
Expand All @@ -2015,9 +2023,9 @@ CIMGUI_API void ImDrawList_AddImageQuad(ImDrawList* self,ImTextureID user_textur
{
return self->AddImageQuad(user_texture_id,p1,p2,p3,p4,uv1,uv2,uv3,uv4,col);
}
CIMGUI_API void ImDrawList_AddImageRounded(ImDrawList* self,ImTextureID user_texture_id,const ImVec2 p_min,const ImVec2 p_max,const ImVec2 uv_min,const ImVec2 uv_max,ImU32 col,float rounding,ImDrawCornerFlags rounding_corners)
CIMGUI_API void ImDrawList_AddImageRounded(ImDrawList* self,ImTextureID user_texture_id,const ImVec2 p_min,const ImVec2 p_max,const ImVec2 uv_min,const ImVec2 uv_max,ImU32 col,float rounding,ImDrawFlags flags)
{
return self->AddImageRounded(user_texture_id,p_min,p_max,uv_min,uv_max,col,rounding,rounding_corners);
return self->AddImageRounded(user_texture_id,p_min,p_max,uv_min,uv_max,col,rounding,flags);
}
CIMGUI_API void ImDrawList_PathClear(ImDrawList* self)
{
Expand All @@ -2035,9 +2043,9 @@ CIMGUI_API void ImDrawList_PathFillConvex(ImDrawList* self,ImU32 col)
{
return self->PathFillConvex(col);
}
CIMGUI_API void ImDrawList_PathStroke(ImDrawList* self,ImU32 col,bool closed,float thickness)
CIMGUI_API void ImDrawList_PathStroke(ImDrawList* self,ImU32 col,ImDrawFlags flags,float thickness)
{
return self->PathStroke(col,closed,thickness);
return self->PathStroke(col,flags,thickness);
}
CIMGUI_API void ImDrawList_PathArcTo(ImDrawList* self,const ImVec2 center,float radius,float a_min,float a_max,int num_segments)
{
Expand All @@ -2055,9 +2063,9 @@ CIMGUI_API void ImDrawList_PathBezierQuadraticCurveTo(ImDrawList* self,const ImV
{
return self->PathBezierQuadraticCurveTo(p2,p3,num_segments);
}
CIMGUI_API void ImDrawList_PathRect(ImDrawList* self,const ImVec2 rect_min,const ImVec2 rect_max,float rounding,ImDrawCornerFlags rounding_corners)
CIMGUI_API void ImDrawList_PathRect(ImDrawList* self,const ImVec2 rect_min,const ImVec2 rect_max,float rounding,ImDrawFlags flags)
{
return self->PathRect(rect_min,rect_max,rounding,rounding_corners);
return self->PathRect(rect_min,rect_max,rounding,flags);
}
CIMGUI_API void ImDrawList_AddCallback(ImDrawList* self,ImDrawCallback callback,void* callback_data)
{
Expand Down Expand Up @@ -2139,6 +2147,18 @@ CIMGUI_API void ImDrawList__OnChangedVtxOffset(ImDrawList* self)
{
return self->_OnChangedVtxOffset();
}
CIMGUI_API int ImDrawList__CalcCircleAutoSegmentCount(ImDrawList* self,float radius)
{
return self->_CalcCircleAutoSegmentCount(radius);
}
CIMGUI_API void ImDrawList__PathArcToFastEx(ImDrawList* self,const ImVec2 center,float radius,int a_min_sample,int a_max_sample,int a_step)
{
return self->_PathArcToFastEx(center,radius,a_min_sample,a_max_sample,a_step);
}
CIMGUI_API void ImDrawList__PathArcToN(ImDrawList* self,const ImVec2 center,float radius,float a_min,float a_max,int num_segments)
{
return self->_PathArcToN(center,radius,a_min,a_max,num_segments);
}
CIMGUI_API ImDrawData* ImDrawData_ImDrawData(void)
{
return IM_NEW(ImDrawData)();
Expand Down