Added get_keys() function

This commit is contained in:
Daniel Collin 2015-12-15 14:20:04 +01:00
parent 03e8075157
commit 0c2e4cee7c

View file

@ -297,6 +297,23 @@ impl Window {
}
}
pub fn get_keys(&self) -> Option<Vec<Key>> {
let mut index: u16 = 0;
let mut keys: Vec<Key> = Vec::new();
for i in self.keys.iter() {
if *i {
unsafe {
keys.push(mem::transmute(index as u8));
}
}
index += 1;
}
Some(keys)
}
#[inline]
pub fn is_key_down(&self, key: Key) -> bool {
return self.keys[key as usize];