flags for flipping (unimplemented)
This commit is contained in:
parent
e066025836
commit
970eb402a2
2 changed files with 25 additions and 14 deletions
|
@ -22,7 +22,8 @@ pub struct Rule {
|
|||
pub to: RulePattern,
|
||||
pub enabled: bool,
|
||||
// probability: u8
|
||||
// flip:
|
||||
pub flip_h: bool,
|
||||
pub flip_v: bool,
|
||||
// rotate:
|
||||
}
|
||||
|
||||
|
@ -42,6 +43,8 @@ impl Rule {
|
|||
enabled: false,
|
||||
from: RulePattern::new(),
|
||||
to: RulePattern::new(),
|
||||
flip_h: false,
|
||||
flip_v: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,6 +103,8 @@ impl Dish {
|
|||
height: 2,
|
||||
contents: vec![Some(Cell(0)), Some(Cell(1))],
|
||||
},
|
||||
flip_h: false,
|
||||
flip_v: false,
|
||||
},
|
||||
Rule {
|
||||
enabled: true,
|
||||
|
@ -113,19 +118,8 @@ impl Dish {
|
|||
height: 2,
|
||||
contents: vec![Some(Cell(0)), None, Some(Cell(1)), Some(Cell(1))],
|
||||
},
|
||||
},
|
||||
Rule {
|
||||
enabled: true,
|
||||
from: RulePattern {
|
||||
width: 2,
|
||||
height: 2,
|
||||
contents: vec![None, Some(Cell(1)), Some(Cell(0)), Some(Cell(1))],
|
||||
},
|
||||
to: RulePattern {
|
||||
width: 2,
|
||||
height: 2,
|
||||
contents: vec![None, Some(Cell(0)), Some(Cell(1)), Some(Cell(1))],
|
||||
},
|
||||
flip_h: true,
|
||||
flip_v: false,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
@ -270,3 +264,18 @@ impl Cell {
|
|||
self.0 as usize
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
enum Dir {
|
||||
Pos,
|
||||
Neg,
|
||||
}
|
||||
|
||||
impl Dir {
|
||||
fn sign(&self) -> isize {
|
||||
match self {
|
||||
Dir::Pos => 1,
|
||||
Dir::Neg => -1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,6 +125,8 @@ const CSIZE: f32 = 24.;
|
|||
const OUTLINE: (f32, Color32) = (3., Color32::GRAY);
|
||||
fn rule_editor(ui: &mut Ui, rule: &mut Rule, cells: &[CellData]) {
|
||||
ui.checkbox(&mut rule.enabled, "enable rule");
|
||||
ui.checkbox(&mut rule.flip_h, "flip H");
|
||||
ui.checkbox(&mut rule.flip_v, "flip V");
|
||||
|
||||
let cells_y = rule.from.height();
|
||||
let cells_x = rule.from.width();
|
||||
|
|
Loading…
Reference in a new issue