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.
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 patch makes the basic structure for a wrapper around Dear ImGui's
drawing API.
1. Implement `with_window_draw_list` method on Ui. Call this method to
get access to the `WindowDrawList` object. This object holds the methods
to access ImGui's drawing API.
2. Dear ImGui uses the ImU32 (an unsigned c_int) to represent colors in
the drawing API. This commit wraps this type with ImColor for
convenience. Any color representation (3or4-tuples, 3or4-arrays, ImU32
or ImVec4) can be converted into ImColor for convenience.
3. Difference between WindowDrawList and ChannelsSplit: Most drawing
functions can be called on WindowDrawList and ChannelsSplit objects.
However for safety, some functions can only be called on WindowDrawList
or ChannelsSplit instance. For example `channels_set_current` can only
be called after channels have been split. To avoid code duplication,
functions common to WindowDrawList and ChannelsSplit are implemented
within the `impl_draw_list_methods` macro.
4. Implement drawing functions (in this commit, add_line only). Calling
`add_line` returns a default representation of the line to be drawn, but
does not draw it. Then parameters, such as thickness, can be set. You
must call `build` to draw the line. All drawing functions will be
implemented following this pattern.
This reverts commit 0d10358942409cf8fad6fcb730dbedfbd7149df7.
`get_window_size` already exists and it's very easy to get just one
of the dimentions. As a result, delete get_window_width and
get_window_height.