update todo

This commit is contained in:
Reid 2023-10-06 15:54:44 -07:00
parent 4657c177b0
commit c03fc13b76
Signed by: reidlab
GPG key ID: 6C9EAA3364F962C8
3 changed files with 12 additions and 13 deletions

View file

@ -1,6 +1,6 @@
# gd-icon-renderer # gd-icon-renderer
rust geometryd ash icon redner!! shout out to [gd-icon-renderer](https://github.com/oatmealine/gd-icon-renderer) oat A rust Geometry Dash icon renderer. Shhout out to [gd-icon-renderer](https://github.com/oatmealine/gd-icon-renderer), this project is just a rewrite but not in libvips and crystal
## usage ## usage
@ -8,7 +8,7 @@ Provide your `GJ_GameSheet02-uhd`, `GJ_GameSheetGlow-uhd`, `Robot_AnimDesc2`, an
## todo ## todo
- use custom plist parser. current one takes like 5 seconds to parse an animation file - swap to a custom plist parser
- change zany anim to argument - change zany anim to argument
- trim empty alpha space (robtop didnt make the bounds correctly :sob:) - trim empty alpha space
- i think theres some slight shifting in the transform to do with rotation. investigate plz. really big on spider 16 for some reason???? - i think theres some weird shifting and offsets going on. investigate plz. really big on spider 16 for some reason???? related issue here: [issue #2, oatmealine/gd-icon-renderer](https://github.com/oatmealine/gd-icon-renderer/issues/2)

View file

@ -14,14 +14,14 @@ mod tests {
use std::time::Instant; use std::time::Instant;
#[test] #[test]
fn it_works() { fn render_test() {
let game_sheet_02 = load_spritesheet("assets/GJ_GameSheet02-uhd.plist"); let game_sheet_02 = load_spritesheet("assets/GJ_GameSheet02-uhd.plist");
let game_sheet_glow = load_spritesheet("assets/GJ_GameSheetGlow-uhd.plist"); let game_sheet_glow = load_spritesheet("assets/GJ_GameSheetGlow-uhd.plist");
let robot_sheet = load_animations("assets/Robot_AnimDesc2.plist"); let robot_sheet = load_animations("assets/Robot_AnimDesc2.plist");
let spider_sheet = load_animations("assets/Spider_AnimDesc2.plist"); let spider_sheet = load_animations("assets/Spider_AnimDesc2.plist");
let start = Instant::now(); let start = Instant::now();
let rendered_icon = render_icon("ship", 44, [0.0, 0.0, 0.0], [255.0/255.0, 125.0/255.0, 125.0/255.0], true, game_sheet_02, game_sheet_glow, robot_sheet, spider_sheet); let rendered_icon = render_icon("spider", 16, [0.0, 0.0, 0.0], [255.0/255.0, 125.0/255.0, 125.0/255.0], true, game_sheet_02, game_sheet_glow, robot_sheet, spider_sheet);
let end = start.elapsed(); let end = start.elapsed();
println!("time taken to render: {:?}", end); println!("time taken to render: {:?}", end);

View file

@ -90,14 +90,13 @@ pub fn render_layered(images: Vec<DynamicImage>, positions: Vec<Option<(f32, f32
let bounding_box = sizes let bounding_box = sizes
.iter() .iter()
.enumerate() .enumerate()
.fold((0, 0), |acc, (i, &size)| { .map(|(i, &size)| {
let (width, height) = size; let (width, height) = size;
let (x, y) = positions.get(i).cloned().unwrap_or((0.0, 0.0)); let (x, y) = positions.get(i).cloned().unwrap_or((0.0, 0.0));
((width as f32 + x.abs() * 2.0) as i32, (height as f32 + y.abs() * 2.0) as i32)
( })
cmp::max(acc.0, (width as f32 + x.abs() * 2.0) as i32), .fold((0, 0), |acc, size| {
cmp::max(acc.1, (height as f32 + y.abs() * 2.0) as i32) (cmp::max(acc.0, size.0), cmp::max(acc.1, size.1))
)
}); });
let mut canvas = ImageBuffer::new(bounding_box.0 as u32, bounding_box.1 as u32); let mut canvas = ImageBuffer::new(bounding_box.0 as u32, bounding_box.1 as u32);