#pattern #drawing #parser #file #cybergrind #ultrakill #cygrind

cygrind-utils

A utility crate for handling, parsing, and drawing cybergrind patterns from ULTRAKILL

3 unstable releases

0.2.1 Nov 26, 2022
0.2.0 Nov 26, 2022
0.1.0 Nov 26, 2022

#73 in #drawing

MIT license

16KB
402 lines

cygrind-utils

A utility crate for handling, parsing, and drawing cybergrind patterns from ULTRAKILL

This crate can go from an unparsed .cgp file to a .png byte buffer in around a hundredth of a second

Usage

use cygrind_utils::cgp::*;

fn main() {
    // Make sure that this is a String and not an &str 
    // An &str is used for demonstrative purposes (i asked nicely don't worry)
    let src = include_str!("example.cgp");
    let data = drawing::draw(parser::parse(src.to_string()));

    // woo a png buffer
    let mut bytes = data.as_slice(); 
}

Bench comparisons

oh wait there are none

Times:

  • Parsing: 5.8 micros

  • Drawing: 100ms

Example

Example

Dependencies

~4MB
~43K SLoC