6 stable releases

2.0.0 Oct 15, 2023
1.2.0 Oct 12, 2023

#1028 in Graphics APIs

37 downloads per month

Custom license

29KB
463 lines

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.

Dependencies

~18MB
~314K SLoC