Struct tiny_game_framework::EventHandler
source · pub struct EventHandler {
pub keys_pressed: HashMap<Key, usize>,
pub keys_pressed_last_frame: HashSet<Key>,
pub mouse_pos: Vec2,
pub scroll: Vec2,
pub width: f32,
pub height: f32,
pub lmb: bool,
pub rmb: bool,
}
Fields§
§keys_pressed: HashMap<Key, usize>
§keys_pressed_last_frame: HashSet<Key>
§mouse_pos: Vec2
§scroll: Vec2
§width: f32
§height: f32
§lmb: bool
§rmb: bool
Implementations§
source§impl EventHandler
impl EventHandler
pub fn new() -> Self
pub fn on_key_press(&mut self, key: Key)
pub fn on_key_release(&mut self, key: Key)
pub fn on_mouse_move(&mut self, x: f64, y: f64)
pub fn on_lmb_press(&mut self)
pub fn on_lmb_release(&mut self)
pub fn on_rmb_press(&mut self)
pub fn on_rmb_release(&mut self)
pub fn on_scroll_change(&mut self, change: Vec2)
pub fn on_window_resize(&mut self, w: i32, h: i32)
pub fn update(&mut self)
pub fn key_just_pressed(&self, key: Key) -> bool
Auto Trait Implementations§
impl Freeze for EventHandler
impl RefUnwindSafe for EventHandler
impl Send for EventHandler
impl Sync for EventHandler
impl Unpin for EventHandler
impl UnwindSafe for EventHandler
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more