rust/landgen/src/wavefront_collapse/tile_image.rs
branchtransitional_engine
changeset 15913 c5684cc62de8
child 15915 8f093b1b18bc
equal deleted inserted replaced
15912:6e22f4390b7e 15913:c5684cc62de8
       
     1 use land2d::Land2D;
       
     2 use std::rc::Rc;
       
     3 
       
     4 pub struct TileImage {
       
     5     image: Rc<Land2D<u8>>,
       
     6     flip: bool,
       
     7     mirror: bool,
       
     8 }
       
     9 
       
    10 impl TileImage {
       
    11     pub fn new(flip: bool, mirror: bool) -> Self {
       
    12         Self {
       
    13             image: todo!(),
       
    14             flip,
       
    15             mirror,
       
    16         }
       
    17     }
       
    18 
       
    19     pub fn mirrored(&self) -> Self {
       
    20         Self {
       
    21             image: self.image.clone(),
       
    22             flip: self.flip,
       
    23             mirror: !self.mirror
       
    24         }
       
    25     }
       
    26 
       
    27     pub fn flipped(&self) -> Self {
       
    28         Self {
       
    29             image: self.image.clone(),
       
    30             flip: !self.flip,
       
    31             mirror: self.mirror
       
    32         }
       
    33     }
       
    34 }