Added macro doc

This commit is contained in:
Constantin 2024-02-03 13:40:59 +01:00
parent 3cd71b120f
commit b03268f363
2 changed files with 20 additions and 0 deletions

View file

@ -171,6 +171,15 @@ impl config::Config for IncludeBackgroundGfxInput {
} }
} }
/// Including from the out directory is supported through the `$OUT_DIR` token.
///
/// ```rust,ignore
/// # #![no_std]
/// # #![no_main]
/// # use agb::include_background_gfx;
/// include_background_gfx!(generated_background, "000000", DATA => "$OUT_DIR/generated_background.aseprite");
/// ```
///
#[proc_macro] #[proc_macro]
pub fn include_background_gfx(input: TokenStream) -> TokenStream { pub fn include_background_gfx(input: TokenStream) -> TokenStream {
let config = Box::new(parse_macro_input!(input as IncludeBackgroundGfxInput)); let config = Box::new(parse_macro_input!(input as IncludeBackgroundGfxInput));

View file

@ -91,6 +91,17 @@ macro_rules! align_bytes {
/// name in code. You should ensure tags are unique as this is not enforced by /// name in code. You should ensure tags are unique as this is not enforced by
/// aseprite. /// aseprite.
/// ///
/// Including from the out directory is supported through the `$OUT_DIR` token.
///
/// ```rust,ignore
/// # #![no_std]
/// # #![no_main]
/// # use agb::{display::object::Graphics, include_aseprite};
/// const GRAPHICS: &Graphics = include_aseprite!(
/// "$OUT_DIR/generated_sprite.aseprite"
/// );
/// ```
///
#[macro_export] #[macro_export]
macro_rules! include_aseprite { macro_rules! include_aseprite {
($($aseprite_path: expr),*) => {{ ($($aseprite_path: expr),*) => {{