flip/mirror/rotate functions for tiles
This commit is contained in:
26
src/tile.rs
26
src/tile.rs
@@ -40,6 +40,32 @@ impl Tile {
|
||||
"".to_string()
|
||||
}
|
||||
}
|
||||
|
||||
// todo refactor
|
||||
|
||||
pub fn flip(&mut self) {
|
||||
self.animation_frames = self.animation_frames.iter().map(|frame: &Image| {
|
||||
let mut image = frame.clone();
|
||||
image.flip();
|
||||
image
|
||||
}).collect()
|
||||
}
|
||||
|
||||
pub fn mirror(&mut self) {
|
||||
self.animation_frames = self.animation_frames.iter().map(|frame: &Image| {
|
||||
let mut image = frame.clone();
|
||||
image.mirror();
|
||||
image
|
||||
}).collect()
|
||||
}
|
||||
|
||||
pub fn rotate(&mut self) {
|
||||
self.animation_frames = self.animation_frames.iter().map(|frame: &Image| {
|
||||
let mut image = frame.clone();
|
||||
image.rotate();
|
||||
image
|
||||
}).collect()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<String> for Tile {
|
||||
|
||||
Reference in New Issue
Block a user