Skip to content

uros117/acegen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AceGen 🖌️

A Rust command-line tool for converting Aseprite sprite files into C header files with optimized bitmap data for embedded systems and retro game development.

Features ✨

  • Converts Aseprite .aseprite files to C header files with bitmap data
  • Generates 1-bit bitmap arrays from sprite frames
  • Extracts animation frame sequences from Aseprite tags
  • Optimized for embedded systems and retro displays
  • Automatic frame and animation array generation

Installation

Prerequisites

  • Rust (latest stable version)
  • Aseprite command-line tool (must be in PATH)

Building from Source

git clone https://github.com/your-username/acegen.git
cd acegen
cargo build --release

The binary will be available at target/release/acegen.

Usage

acegen <sprite_file.aseprite>

Example

acegen zivorad.aseprite

This will generate a zivorad.h file containing:

  • Individual frame bitmap arrays (zivorad_0_map[], zivorad_1_map[], etc.)
  • Frame pointer array (zivorad_frames[])
  • Animation sequences based on Aseprite tags (Idle_anim[], Walk_anim[], etc.)

Output Format

The generated C header file contains:

Frame Data

Each sprite frame is converted to a 1-bit bitmap array:

uint8_t zivorad_0_map[] = { 
    0x00, 0x3f, 0xf0, 0x00,
    0x00, 0xc0, 0x08, 0x00,
    // ... more bitmap data
};

Frame Array

A pointer array for easy frame access:

uint8_t* zivorad_frames[] = { 
    zivorad_0_map,
    zivorad_1_map,
    // ... more frames
};

Animation Sequences

Animation arrays based on Aseprite tags:

uint8_t Idle_anim[] = { 0, 1, 2, 3 };
uint8_t Walk_anim[] = { 4, 5 };

How It Works

  1. Sprite Processing: Uses Aseprite CLI to export sprite sheets as PNG + JSON
  2. Bitmap Conversion: Reads PNG data and converts alpha channel to 1-bit bitmap
  3. Data Packing: Packs 8 pixels per byte for memory efficiency
  4. Animation Extraction: Reads Aseprite frame tags to generate animation sequences
  5. C Header Generation: Outputs properly formatted C arrays

Project Structure

  • src/main.rs - CLI entry point and argument handling
  • src/lib.rs - Core sprite processing functionality
  • tests/ - Integration tests
  • Cargo.toml - Project dependencies and metadata

Dependencies

  • aseprite - For parsing Aseprite JSON export data
  • png - For reading PNG bitmap data
  • serde_json - For JSON parsing

Testing

Run the test suite:

cargo test

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Use Cases

  • Embedded Systems: Generate compact bitmap data for microcontroller displays
  • Retro Game Development: Create sprite data for 8-bit style games
  • Arduino Projects: Display animated sprites on OLED/LCD screens
  • Custom Display Drivers: Integrate sprite data into custom graphics systems

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors