You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
680 B
20 lines
680 B
mod ingame_input;
|
|
|
|
use sdl2::{
|
|
keyboard::{Keycode, Mod},
|
|
mouse::MouseState,
|
|
};
|
|
|
|
// More methods to be added for other forms of input
|
|
pub trait InputHandler {
|
|
// Handle keys which are meant to be held down and repeated every frame, ex movement keys
|
|
fn handle_cont_key(&mut self, keycode: Keycode) {}
|
|
|
|
// Handle single keypresses or keys held down after the repear delay
|
|
fn handle_keydown(&mut self, keycode: Keycode, modifier: Mod, repeat: bool) {}
|
|
fn handle_keyup(&mut self, keycode: Keycode, modifier: Mod, repeat: bool) {}
|
|
|
|
// Handle mouse movements
|
|
fn handle_mouse_motion(&mut self, state: MouseState, abs: (i32, i32), rel: (i32, i32)) {}
|
|
}
|