#How to nest custom asset formats?

5 messages · Page 1 of 1 (latest)

fierce granite
#

I have a requirement for custom assets. I have a file that contains an image and some strings. How can I parse it into the following structure?
This looks like the Image is nested inside

#[derive(Asset, TypePath, Debug)]
pub struct CustomAsset {
    img: Handle<Image>,
    name: String,
}

This file will be a custom format file, and its binary data will be arranged according to a set of rules I preset. For example, strings are saved from 0 to 255, and the rest is image data encoded in PNG format. I can parse the character string from the binary data of this file, and the binary data of the image can be parsed into vec<u8>format. However, how can vec<u8>be further converted into Handle<Image>so that the sprite component can use it?

rancid wyvern
#

you can do this

#

so

#
#

@fierce granite hope that helps