Crate pxl_build

Source
Expand description

§pxl-build

A compile time resource-loader for pxl.

To use, add pxl-build to your build-dependencies, put all the resources you would like to use in your pxl program in a directory named resources in the root of your crate, and put the following into a file named build.rs, also in the root of your crate:

extern crate pxl_build;

fn main() -> Result<(), pxl_build::Error> {
  pxl_build::build("resources")
}

Then, in your program, you can do:

extern crate pxl;

include!(concat!(env!("OUT_DIR"), "/resources.rs"));

Your resources will be available as statics with uppercase names derived from their filenames, in modules according to the structure of the resources folder.

For example, if you put an image into resources/images/player.png, it will be available in your program as images::PLAYER.

Enums§

Error
Build errors

Functions§

build
Compile the resources in resource_directory into $OUT_DIR/resources.rs for inclusion in a pxl program.