Trait lux::interactive::Interactive
[−]
[src]
pub trait Interactive { fn is_open(&mut self) -> bool; fn was_open(&self) -> bool; fn title(&self) -> &str; fn set_title(&mut self, title: &str); fn set_size(&mut self, width: u32, height: u32); fn get_size_u(&self) -> (u32, u32); fn is_focused(&self) -> bool; fn is_mouse_down(&self) -> bool; fn mouse_pos(&self) -> (Float, Float); fn mouse_pos_i(&self) -> (i32, i32); fn is_key_pressed<K: AbstractKey>(&self, k: K) -> bool; fn events(&mut self) -> EventIterator; fn get_size(&self) -> (f32, f32) { ... } fn width(&self) -> f32 { ... } fn height(&self) -> f32 { ... } fn width_u(&self) -> u32 { ... } fn height_u(&self) -> u32 { ... } fn mouse_x(&self) -> Float { ... } fn mouse_x_i(&self) -> i32 { ... } fn mouse_y(&self) -> Float { ... } fn mouse_y_i(&self) -> i32 { ... } }
A trait for objects that are interactive to the user. The only known impelementation for this trait is the glutin Window.
Required Methods
fn is_open(&mut self) -> bool
Returns true if the window is not yet closed.
This function borrows self as &mut because it must process events before determining if it has closed before.
was_open
is a similar function, but without the event processing.
However, you should prefer is_open if at all possible.
fn was_open(&self) -> bool
Returns true if the window wasn't closed the last time that input was polled.
fn title(&self) -> &str
Returns the title of the object.
fn set_title(&mut self, title: &str)
Sets the title of the object. If the object is a window, this title will be used to decorate the window.
fn set_size(&mut self, width: u32, height: u32)
Sets the size of the window if possible.
fn get_size_u(&self) -> (u32, u32)
Returns the size of the window as an unsigned integer.
fn is_focused(&self) -> bool
Returns true if the operating system has given this object focus.
fn is_mouse_down(&self) -> bool
Returns true if any mouse button is down.
fn mouse_pos(&self) -> (Float, Float)
Returns the current position of the mouse.
This function returns the position in floating point units
for usability. Use mouse_pos_int
if you want integer units.
fn mouse_pos_i(&self) -> (i32, i32)
Returns the current position of the mouse in integer units.
fn is_key_pressed<K: AbstractKey>(&self, k: K) -> bool
Returns true if a given key is currently being pressed.
fn events(&mut self) -> EventIterator
Consumes all unseen events and returns them in an iterator.
Provided Methods
fn get_size(&self) -> (f32, f32)
Returns the size of the window.
fn width(&self) -> f32
Returns the width of the window.
fn height(&self) -> f32
Returns the height of the window.
fn width_u(&self) -> u32
Returns the width of the window as an unsigned integer.
fn height_u(&self) -> u32
Returns the height of the window as an unsigned integer.
fn mouse_x(&self) -> Float
Returns the x coordinate of the mouse.
fn mouse_x_i(&self) -> i32
Returns the x coordinate of the mouse in integer units.
fn mouse_y(&self) -> Float
Returns the y coordinate of the mouse.
fn mouse_y_i(&self) -> i32
Returns the y coordinate of the mouse in integer units.
Implementors
impl Interactive for Window