Add deprecation warning for each renamed variant.
However, it will just fail to compile if the deprecated variant is used
inside a match statement. It is not possible to make aliases of variants
in Rust.
There is no way I know of to make a deprecation warning in such a case.
Code that uses ImDrawList_AddPolyline or ImDrawList_AddConvexPolyFilled will
break.
This commit does not include deprecation warning.
Indeed, defining a `ImGuiTextBuffer_append` function with a deprecation
warning would require to write a variadic function in rust. However,
this is impossible, and the FFI rust doc says so:
https://doc.rust-lang.org/book/first-edition/ffi.html#variadic-functions
Dear ImGui did not deprecate `append()`, they simply renamed it too.
There is a small change of behaviour: previous height value is not
preserved when igSetNextWindowContentWidth is used. There is no way
around it unless we mess with imgui's internals.
Official Dear ImGui chose this easy solution as well:
static inline void SetNextWindowContentWidth(float w) { SetNextWindowContentSize(ImVec2(w, 0.0f)); }
429f48bb4f/imgui.h (L1132)
Update struct for ImGuiHoveredFlags.
NB: igIsWindowHovered, and thus igIsRootWindowOrAnyChildHovered, are
broken now because of a bug.
The fix is commited upstream, but not released yet.
baebcfcfaf
I guess nothing can be done but wait for the next cimgui release.
Update cimgui, fixing #97 and #88.
As a side note, the previous version has some compiler warning showing
up during build:
warning: third-party/cimgui/imgui/imgui.cpp: In function ‘void ImGui::RenderTriangle(ImVec2, ImGuiDir, float)’:
warning: third-party/cimgui/imgui/imgui.cpp:3136:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
warning: r = -r; // ...fall through, no break!
warning: ~~^~~~
The new version has no warning.
- gfx uses an sRGB framebuffer, which means it expects all vertex colors to be in linear space
- imgui provides vertex colors in sRGB space! This causes the appearance of washed out colors
- Fix the color space conflict by converting the imgui colors to linear space
Since there are no mutable borrows in the WindowDrawList API, we can remove all
draw functions from ChannelsSplit and just use the same `draw_list' all
the time, as shown in the `WindowDrawList::channels_split` example.
This approach makes the `DrawAPI` trait pointless so it can be removed, and
ChannelsSplit is reduced to a type with just one function:
`set_current`.
At run time, the environment checks that at most one instance of
WindowDrawList exists using a static boolean: WINDOW_DRAW_LIST_LOADED.
If two WindowDrawList could exist at the same time, there would be
several instances of the same `*mut ImDrawList`, which could lead
to unfathomable bad things.
When a WindowDrawList is created, WINDOW_DRAW_LIST_LOADED is set to
true. And when it is dropped, WINDOW_DRAW_LIST_LOADED is set to false.
Creating a new WindowDrawList while WINDOW_DRAW_LIST_LOADED is true
causes a panic.
AtomicBool could have been used instead of a bool for
WINDOW_DRAW_LIST_LOADED. Though it allows to avoid the use of `unsafe { }`,
the construct we are doing is already inherently unsafe.
WindowDrawList and Ui are !Send and !Sync, so they cannot anyway be shared
among threads.
So we'd better be explicit and use an unsafe block with a normal bool.
The test was failing because no `main` function was defined, as explained
in the rustdoc documentation [1].
Add the "no_run" flag. This way, there is no attempt to run the test
code. Only compile checks are done. Thus defining a `main` function is
unnecessary.
Moreover "export crate imgui" is implicit, so removed.
[1] https://doc.rust-lang.org/stable/rustdoc/documentation-tests.html#pre-processing-examples.
Include drawing canvas example into show_example_app_custom_rendering.
The example contains now everything included in the original C++ example
provided with dear imgui.
show_example_app_custom_rendering is implemented exactly as it is in the
original Dear ImGui in C++. The result should be the same.
The only difference is that `DragFloat`, used to control the size of the
drawings, is not implement as of now.
This example demonstrates how the custom drawing API can be used.
This commit defines a new enum: `ImMouseButton`, which is used in the
public-facing API of mouse-related methods.
The discriminant values of the ImMouseButton enum are the value used
internally by ImGui to represent the buttons of the mouse.
This commit adds two methods to the drawing APIs: with_clip_rect and
with_clip_rect_intersect.
Both wrap ImDrawList_PushClipRect and ImDrawList_PopClipRect.
However, with_clip_rect_intersect sets the `intersect` argument of
ImDrawList_PushClipRect to `true`.
As `add_rect_filled_multicolor` does not have any option, the `build`
pattern is not used and calling `add_rect_filled_multicolor` directly
draws the rectangle on the window.