Struct mini_gl_fb::breakout::BasicInput[][src]

pub struct BasicInput {
    pub mouse_pos: (f64, f64),
    pub mouse: HashMap<MouseButton, (bool, bool)>,
    pub keys: HashMap<VirtualKeyCode, (bool, bool)>,
    pub modifiers: ModifiersState,
    pub resized: bool,
}

Fields

The mouse position in buffer coordinates.

The bottom left of the window is (0, 0). Pixel centers are at multiples of (0.5, 0.5). If you want to use this to index into your buffer, in general the following is sufficient:

  • clamp each coordinate to the half-open range [0.0, buffer_size)
  • take the floor of each component
  • cast to usize and compute an index: let index = y * WIDTH + x

Stores whether a mouse button was down and is down, in that order.

If a button has not been pressed yet it will not be in the map.

Stores the previous and current "key down" states, in that order.

If a key has not been pressed yet it will not be in the map.

Methods

impl BasicInput
[src]

If the mouse was pressed this last frame.

If the mouse is currently down.

If the mouse was released this last frame.

If the key was pressed this last frame.

If the key is currently down.

If the key was released this last frame.

Auto Trait Implementations

impl Send for BasicInput

impl Sync for BasicInput