add more tiles to gui, with controls to rotate between variants in a group
This commit is contained in:
parent
175d01cb03
commit
bf82d1455f
3 changed files with 195 additions and 72 deletions
|
@ -58,10 +58,6 @@ impl Machine {
|
|||
&self.input
|
||||
}
|
||||
|
||||
pub fn input_mut(&mut self) -> &mut Vec<u8> {
|
||||
&mut self.input
|
||||
}
|
||||
|
||||
pub fn set_input(&mut self, bytes: Vec<u8>) {
|
||||
self.input_index = self.input_index.min(bytes.len());
|
||||
self.input = bytes;
|
||||
|
@ -327,7 +323,7 @@ pub fn parse(source: &str) -> Board {
|
|||
width = width.max(line.len());
|
||||
let mut tiles = Vec::new();
|
||||
for char in line.chars() {
|
||||
tiles.push(tile_to_char(char));
|
||||
tiles.push(tile_from_char(char));
|
||||
}
|
||||
rows.push(tiles);
|
||||
}
|
||||
|
@ -338,7 +334,7 @@ pub fn parse(source: &str) -> Board {
|
|||
Board::new(rows)
|
||||
}
|
||||
|
||||
pub const fn tile_to_char(c: char) -> Tile {
|
||||
pub const fn tile_from_char(c: char) -> Tile {
|
||||
match c {
|
||||
'o' => Tile::Marble {
|
||||
value: 0,
|
||||
|
@ -367,7 +363,7 @@ pub const fn tile_to_char(c: char) -> Tile {
|
|||
'D' => Tile::Powerable(PTile::Math(MathOp::Div), false),
|
||||
'R' => Tile::Powerable(PTile::Math(MathOp::Rem), false),
|
||||
'B' => Tile::Powerable(PTile::Bag, false),
|
||||
d @ '0'..='9' => Tile::Digit(d as u8),
|
||||
d @ '0'..='9' => Tile::Digit(d as u8 - b'0'),
|
||||
'#' => Tile::Block,
|
||||
' ' => Tile::Blank,
|
||||
_ => Tile::Blank,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue