Struct SharedDrawContext

Source
pub struct SharedDrawContext { /* private fields */ }
Expand description

A context shared between all draw contexts.

Implementations§

Source§

impl SharedDrawContext

Source

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.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.