gd-icon-renderer

Crates.iogd-icon-renderer
lib.rsgd-icon-renderer
version2.0.0
sourcesrc
created_at2023-10-06 23:37:17.567145
updated_at2023-10-15 08:53:11.274937
descriptionA tool to render Geometry Dash icons.
homepage
repositoryhttps://git.reidlab.online/reidlab/gd-icon-renderer
max_upload_size
id995701
size32,086
reidlab (reidlabwastaken)

documentation

README

gd-icon-renderer

A rust Geometry Dash icon renderer. Shout out to gd-icon-renderer, this project is just a rewrite but not in libvips and crystal-lang for mostly personal use.

Docs Version

Usage

Provide your GJ_GameSheet02-uhd, GJ_GameSheetGlow-uhd, Robot_AnimDesc2, and Spider_AnimDesc2 files along with their corresponding *.plist files. Rendering an icon is as follows:

  1. Import the library:

    use gd_icon_renderer;
    
  2. Load your spritesheets:

    // Replace filepaths for whatever you need for your usecase
    let game_sheet_02 = gd_icon_renderer::assets::load_spritesheet("assets/GJ_GameSheet02-uhd.plist");
    let game_sheet_glow = gd_icon_renderer::assets::load_spritesheet("assets/GJ_GameSheetGlow-uhd.plist");
    let robot_sheet = gd_icon_renderer::assets::load_animations("assets/Robot_AnimDesc2.plist");
    let spider_sheet = gd_icon_renderer::assets::load_animations("assets/Spider_AnimDesc2.plist");
    
  3. Render the icon out:

    let icon_img = gd_icon_renderer::renderer::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).expect("failed to render image");
    

    You'll now be given a DynamicImage

  4. You'll most likely want to save the resulting image somewhere:

    icon_img.save("icon_rendered.png").unwrap();
    

Todo

  • Improve gamemode selection
  • Add examples to the repo.
  • I think theres some weird shifting and offsets going on, please investigate 🥺. Really big on spider_16 for some reason?? Related issue on the inspired project here.
Commit count: 0

cargo fmt