diff options
author | metamuffin <metamuffin@disroot.org> | 2024-07-16 02:02:14 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-07-16 02:02:14 +0200 |
commit | 1ab54f3155eff431fb1bd65a0bcad71701e9d9b5 (patch) | |
tree | 8f58d6846a45db402cf167f62960ae6647ebd8d8 /light-client/tools/src/bin/tex_compose.rs | |
parent | 1671370f1e95b3ae0cdede6e16511fd91ea4feac (diff) | |
download | hurrycurry-1ab54f3155eff431fb1bd65a0bcad71701e9d9b5.tar hurrycurry-1ab54f3155eff431fb1bd65a0bcad71701e9d9b5.tar.bz2 hurrycurry-1ab54f3155eff431fb1bd65a0bcad71701e9d9b5.tar.zst |
render connected tiles
Diffstat (limited to 'light-client/tools/src/bin/tex_compose.rs')
-rw-r--r-- | light-client/tools/src/bin/tex_compose.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/light-client/tools/src/bin/tex_compose.rs b/light-client/tools/src/bin/tex_compose.rs index 77e69c45..19c9ed7c 100644 --- a/light-client/tools/src/bin/tex_compose.rs +++ b/light-client/tools/src/bin/tex_compose.rs @@ -45,7 +45,7 @@ fn main() { } let (name, rest) = line.split_once("=").unwrap(); - let (connects, rest) = rest.split_once(":").unwrap_or(("", rest)); + let (connects, rest) = rest.split_once(":").unwrap_or(("a", rest)); eprintln!(" compose {name:?} ({connects})"); let mut texels = HashMap::new(); @@ -108,19 +108,16 @@ fn main() { for (x, y) in texels.keys() { min_x = min_x.min(*x); min_y = min_y.min(*y); - max_x = max_x.max(*x); - max_y = max_y.max(*y); + max_x = max_x.max(*x + 1); + max_y = max_y.max(*y + 1); } let width = max_x - min_x; let height = max_y - min_y; - let mut name = name.to_string(); - if !connects.is_empty() { - name += "+"; - name += connects; - } - let outpath = output_dir.join(name).with_extension("ta"); + let outpath = output_dir + .join(format!("{name}+{connects}")) + .with_extension("ta"); let mut output = BufWriter::new(File::create(outpath).unwrap()); for y in 0..height { |