pub struct Events {
pub keyboard: Input<VirtualKeyCode>,
pub mouse: Input<MouseButton>,
pub cursor: Cursor,
}
Expand description
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