Add access to pressed/just_pressed/just_released to Input<T> (#428)

Add access to pressed/just_pressed to Input<T>
This commit is contained in:
Marcel Müller 2020-09-04 02:32:17 +02:00 committed by GitHub
parent cc3e99388a
commit 08dc1c1936
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -51,4 +51,16 @@ where
self.just_pressed.clear(); self.just_pressed.clear();
self.just_released.clear(); self.just_released.clear();
} }
pub fn get_pressed(&self) -> impl ExactSizeIterator<Item = &T> {
self.pressed.iter()
}
pub fn get_just_pressed(&self) -> impl ExactSizeIterator<Item = &T> {
self.just_pressed.iter()
}
pub fn get_just_released(&self) -> impl ExactSizeIterator<Item = &T> {
self.just_released.iter()
}
} }