[][src]Struct glerminal::Events

pub struct Events {
    pub keyboard: Input<VirtualKeyCode>,
    pub mouse: Input<MouseButton>,
    pub cursor: Cursor,
}

Represents all the events that happen in glerminal, such as keyboard events, mouse events, resize, and close events.

Example usage:

use glerminal::{TerminalBuilder, VirtualKeyCode, TextBuffer};

let terminal = TerminalBuilder::new()
    .with_title("Hello GLerminal!")
    .with_dimensions((1280, 720))
    .build();

let mut text_buffer;
match TextBuffer::new(&terminal, (80, 24)) {
    Ok(buffer) => text_buffer = buffer,
    Err(error) => panic!(format!("Failed to initialize text buffer: {}", error)),
}

let events = terminal.get_current_events();
println!("Was A just pressed: {}", events.keyboard.was_just_pressed(VirtualKeyCode::A));
println!("Cursor position: {:?}", events.cursor.get_location(&text_buffer));

Fields

keyboard: Input<VirtualKeyCode>

Represents keyboard events.

mouse: Input<MouseButton>

Represents mouse events.

cursor: Cursor

Allows getting information related to cursor position

Trait Implementations

impl Clone for Events
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for Events

impl Sync for Events

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]