pub struct SharedDrawContext { /* private fields */ }
Expand description
A context shared between all draw contexts.
Implementations§
Sourcepub fn draw<'b, D: ?Sized + Draw + 'b>(
&self,
width: f32,
height: f32,
draw: &'b mut D,
cursor: Option<[f32; 2]>,
cursor_was_pressed: bool,
cursor_was_released: bool,
) -> DrawContext<'b, D>
pub fn draw<'b, D: ?Sized + Draw + 'b>( &self, width: f32, height: f32, draw: &'b mut D, cursor: Option<[f32; 2]>, cursor_was_pressed: bool, cursor_was_released: bool, ) -> DrawContext<'b, D>
The cursor coordinates, if any, must be in OpenGL viewport coordinates. In other words,
[-1.0, -1.0]
corresponds to the bottom-left hand corner of the screen, and [1.0, 1.0]
to the top-right hand corner.
Sourcepub fn cursor_hovered_widget(&self) -> bool
pub fn cursor_hovered_widget(&self) -> bool
Returns true if one of the elements that has been drawn by one of the draw contexts was under the mouse cursor.
This function can be used to determine whether the user is hovering some part of the UI. In other words, if this function returns false, then you know that the user is hovering what is under the UI.
When you create the context, this value is initally false. Each widget that you draw can
call set_cursor_hovered_widget
to pass this value to true.
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more