Joonas Javanainen
bea73a8fde
Don't listen to clippy
2018-08-12 19:33:17 +03:00
Joonas Javanainen
da9ee9302b
Fixes recommended by clippy
2018-08-12 19:20:14 +03:00
Joonas Javanainen
329f24d221
Fix compilation errors
2018-08-12 14:22:08 +03:00
Joonas Javanainen
319f7aa4c6
Reformat everything
2018-08-12 14:16:56 +03:00
Joonas Javanainen
aa4ae70054
Make HiDPI rendering better
...
+ use linear filtering in both renderers. Nearest just won't work
anymore if we have a non-integer scaling factor (which winit can give
us on 1440p screens for example)
+ pass around FrameSize which has the necessary info with full f64
precision
+ extra care with conversions to/from f32 and u32 and rounding
2018-08-12 14:16:21 +03:00
OKAMURA, Yasunobu
1070ec5b7c
Merge remote-tracking branch 'upstream/master' into feature/multiline-text-input
2018-07-09 20:25:09 +09:00
OKAMURA, Yasunobu
72ef7f681e
fix conflict
2018-06-22 21:28:37 +09:00
Michael Fairley
972769a0f4
Allow setting flags on tree nodes
2018-06-08 14:48:36 -05:00
Joonas Javanainen
a8cd16ef90
Merge pull request #137 from Gekkio/feature/drawdata-renderer
...
Renderers take DrawData, not DrawList
2018-06-03 20:25:50 +03:00
Joonas Javanainen
d8676b90de
Merge pull request #133 from michaelfairley/pushid_overloads_take3
...
Allow using strings and pointers with push_id
2018-06-03 20:25:31 +03:00
Michael Fairley
3a070ff124
Remove use of rust feature newer than oldest supported version
2018-06-03 10:28:54 -05:00
Joonas Javanainen
9537fd83b3
Render callback should be FnOnce
...
The callback is no longer called multiple times
2018-06-03 11:27:10 +03:00
Joonas Javanainen
70370611e5
Renderers take DrawData, not DrawList
2018-06-03 11:21:13 +03:00
Malik Olivier Boussejra
216e97a2b2
Merge pull request #135 from malikolivier/mouse-helper-functions
...
Wrap mouse helper functions: is_mouse_double_clicked, is_mouse_released
2018-06-02 19:51:31 +09:00
Malik Olivier Boussejra
d42f789fef
Merge pull request #134 from malikolivier/105-get-keyboard-input
...
[ImGui] Add helper functions for keyboard keys
User still needs to use get_key_index to get the value of user_key_index for each key, similar to what is done in the original imgui.
This is not very convenient but it allows to be back-end independent.
Fix #105
2018-06-02 19:50:27 +09:00
Malik Olivier Boussejra
f0b3010684
Merge pull request #125 from malikolivier/draw_list_add_methods
...
window_draw_list: Add support for drawing text
2018-06-02 19:48:50 +09:00
Malik Olivier Boussejra
7b80950782
[ImGui] Add helper function "is_mouse_released"
2018-06-02 14:31:22 +09:00
Malik Olivier Boussejra
b62cd2eca8
[ImGui] Add helper function "is_mouse_double_clicked"
2018-06-02 14:31:05 +09:00
Malik Olivier Boussejra
91a2648740
[ImGui] Add helper functions for keyboard keys
...
Can check whether a keyboard key is pressed or not.
2018-06-02 14:14:14 +09:00
Michael Fairley
3655dfa081
Allow using strings and pointers with push_id
2018-05-31 11:25:51 -05:00
Malik Olivier Boussejra
9b0804f6be
window_draw_list: Use c_char instead of i8
...
Target expects a c_char, which happens to be an i8 on x86, but it may be
something else on other platforms (e.g. u8 on ARM).
2018-05-30 14:39:37 +09:00
Malik Olivier Boussejra
485c8a230e
window_draw_list: Use generic to add_text
...
This change allows to use `add_text` with any type that implements
`AsRef<str>`. This includes `String`, `&str`, `ImString` and `&ImStr`.
2018-05-30 14:23:43 +09:00
Joonas Javanainen
37d556ce3b
Merge pull request #131 from malikolivier/imgui-add-mouse-wheel
...
[ImGui] Add helper function to get mouse wheel delta
2018-05-30 08:03:56 +03:00
Joonas Javanainen
a08516a51d
Merge pull request #126 from malikolivier/draw_list_must_use
...
window_draw_list: Add #[must_use] to relevant types
2018-05-30 08:03:39 +03:00
Malik Olivier Boussejra
c2fd3561cb
[ImGui] Add helper function to get wheel delta
2018-05-29 13:40:02 +09:00
Malik Olivier Boussejra
17504fd723
window_draw_list: Add #[must_use] to relevant types
...
It is easy to forget to call .build() on these temporary types.
To avoid this kind of error, we emit a compiler warning when .build() is
forgotten.
2018-05-23 17:57:55 +09:00
Malik Olivier Boussejra
429073a29c
window_draw_list: Add support for drawing text
2018-05-23 11:33:11 +09:00
Malik Olivier Boussejra
6f2b1d76b4
Ui: Add safe wrapper "is_window_hovered"
2018-05-22 00:23:00 +09:00
Malik Olivier Boussejra
500e64d67e
[cimgui 1.53.1] StyleVar: Add missing WindowBorderSize
...
Use WindowBorderSize as replacement for border boolean in window.rs
2018-05-14 11:53:39 +09:00
Malik Olivier Boussejra
0e1ec3cb6a
fonts: Use ImFontConfig_DefaultConstructor to initialize sys::ImFontConfig
2018-05-05 12:13:28 +09:00
OKAMURA, Yasunobu
9b283bbad0
Add input_text_multiline
2018-04-30 15:14:31 +09:00
Malik Olivier Boussejra
abd39597ed
input: Add API to set read_only, password and no_undo_redo falgs
2018-04-30 12:46:18 +09:00
Malik Olivier Boussejra
112d21133b
[cimgui 1.53.1] Remove ImGuiWindowFlags::ShowBorders
2018-04-30 11:56:10 +09:00
Malik Olivier Boussejra
adfa447d2f
[cimgui 1.53.1] Style: Add PopupRounding, FrameBorderSize, WindowBorderSize, PopupBorderSize
2018-04-30 11:43:17 +09:00
Malik Olivier Boussejra
3b231d9838
[cimgui 1.53.1] Rename ChildWindowRounding to ChildRounding
...
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.
2018-04-30 11:28:17 +09:00
Malik Olivier Boussejra
cf15d49e36
[cimgui 1.53.1] Rename Ui::show_test_window to Ui::show_demo_window
2018-04-29 23:49:26 +09:00
Joonas Javanainen
99aeb18299
Merge pull request #116 from michaelfairley/master
...
Add drag widgets
2018-04-29 11:57:15 +03:00
Michael Fairley
90c096183c
Add drag widgets
2018-04-24 15:22:08 -05:00
Malik Olivier Boussejra
892fe558a3
WindowDrawList: Get rid of DrawApi trait
...
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`.
2018-04-24 13:23:39 +09:00
Malik Olivier Boussejra
9a9484ff21
ChannelsSplit: Rename channels_set_current to set_current
...
Fancier API
2018-04-24 13:23:08 +09:00
Malik Olivier Boussejra
454e98037e
Do not allow to create coexisting instances of WindowDrawList
...
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.
2018-04-16 15:14:04 +09:00
Malik Olivier Boussejra
082d5e47f9
window_draw_list: Fix awkward wording in doc
2018-04-16 15:14:04 +09:00
Malik Olivier Boussejra
734292fdab
imgui: Make ChannelsSplit struct visible outside the crate
2018-04-16 15:14:04 +09:00
Malik Olivier Boussejra
29b0d20fc1
ChannelsSplit: Panic when channel index overflows
2018-04-16 15:14:04 +09:00
Malik Olivier Boussejra
95577a0d8c
ui: Rename to with_window_draw_list ot get_window_draw_list
2018-04-16 15:14:04 +09:00
Malik Olivier Boussejra
9a65a64eca
WindowDrawList: Cannot use WindowDrawList::new outside of crate
2018-04-16 15:14:04 +09:00
Malik Olivier Boussejra
3aa807b173
DrawAPI: Remove unused lifetime
2018-04-16 15:14:04 +09:00
Malik Olivier Boussejra
7be9f15acb
window_draw_list: Fix typo in doc
2018-04-16 15:14:04 +09:00
Malik Olivier Boussejra
746bdc5ef3
ImColor: Derive Eq, PartialEq, Debug
2018-04-16 15:14:04 +09:00
Malik Olivier Boussejra
43a2484c22
ImMouseButton: Derive Copy, Clone, Eq, PartialEq, Debug
...
For convenience.
2018-04-16 15:14:04 +09:00