Skip to content

Commit

Permalink
fix: lua reexport prefix + improved help (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
fgardt authored Mar 27, 2024
1 parent 20f2422 commit 15a6fc7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ Options:
-r, --recursive
Recursive search for images. Each folder will be a separate sprite sheet
-t, --tile-resolution <TILE_RESOLUTION>
Resolution in pixel per tile [default: 32]
Resolution of the input sprites in pixels / tile [default: 32]
--hr
Set when this is considered a high resolution texture
Set when the output file should be considered to be HR (8k x 8k resolution limit).
When set the tile resolution will be set to 64 unless specified otherwise.
--no-crop
Set when the sprites should not be cropped
-s, --scale <SCALE>
Expand Down
11 changes: 6 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,13 @@ struct SpritesheetArgs {
#[clap(short, long, action)]
pub recursive: bool,

/// Resolution in pixel per tile
/// Resolution of the input sprites in pixels / tile
#[clap(short, long, default_value_t = 32)]
pub tile_resolution: usize,

/// Set when this is considered a high resolution texture
#[clap(long, action)]
/// Set when the output file should be considered to be HR (8k x 8k resolution limit).
/// When set the tile resolution will be set to 64 unless specified otherwise.
#[clap(long, action, verbatim_doc_comment)]
pub hr: bool,

/// Set when the sprites should not be cropped
Expand Down Expand Up @@ -239,7 +240,7 @@ impl SpritesheetArgs {
let mut output = LuaOutput::new();

for name in res {
output = output.reexport(name);
output = output.reexport(format!("{}{name}", self.prefix));
}

output.save(out_path)?;
Expand All @@ -250,7 +251,7 @@ impl SpritesheetArgs {
}

fn tile_res(&self) -> usize {
let res = if self.hr {
let res = if self.hr && self.tile_resolution == 32 {
64.0
} else {
self.tile_resolution as f64
Expand Down

0 comments on commit 15a6fc7

Please sign in to comment.