mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-19 01:18:27 +00:00
Make DrawListMut::add_image doc example more concise
Longer example code in 'imgui-examples/examples/custom_textures.rs' shows more detailed usage
This commit is contained in:
parent
eccc537abe
commit
028ebf538f
@ -262,23 +262,13 @@ impl<'ui> DrawListMut<'ui> {
|
|||||||
/// ```
|
/// ```
|
||||||
/// # use imgui::*;
|
/// # use imgui::*;
|
||||||
/// fn custom_button(ui: &Ui, img_id: TextureId) {
|
/// fn custom_button(ui: &Ui, img_id: TextureId) {
|
||||||
/// // Tint image red
|
/// // Invisible button is good widget to customise with image
|
||||||
///
|
|
||||||
/// // Invisible button is good widget to customise with custom image
|
|
||||||
/// ui.invisible_button(im_str!("custom_button"), [100.0, 20.0]);
|
/// ui.invisible_button(im_str!("custom_button"), [100.0, 20.0]);
|
||||||
///
|
///
|
||||||
/// // Red tint when button is hovered, no tint otherwise
|
|
||||||
/// let overlay_color = if ui.is_item_hovered() {
|
|
||||||
/// [1.0, 0.6, 0.6, 1.0]
|
|
||||||
/// } else {
|
|
||||||
/// [1.0, 1.0, 1.0, 1.0]
|
|
||||||
/// };
|
|
||||||
///
|
|
||||||
/// // Get draw list and draw image over invisible button
|
/// // Get draw list and draw image over invisible button
|
||||||
/// let draw_list = ui.get_window_draw_list();
|
/// let draw_list = ui.get_window_draw_list();
|
||||||
/// draw_list
|
/// draw_list
|
||||||
/// .add_image(img_id, ui.item_rect_min(), ui.item_rect_max())
|
/// .add_image(img_id, ui.item_rect_min(), ui.item_rect_max())
|
||||||
/// .col(overlay_color)
|
|
||||||
/// .build();
|
/// .build();
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user