From eac350b3915cb18f29c24f9cd254ec2285bf4640 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Thu, 13 Apr 2023 22:01:37 +0100 Subject: [PATCH] Replace example usage with the new macro --- agb-image-converter/src/lib.rs | 5 +++-- agb/examples/affine_background.rs | 4 ++-- agb/examples/affine_tiles.toml | 6 ------ agb/examples/animated_background.rs | 4 ++-- 4 files changed, 7 insertions(+), 12 deletions(-) delete mode 100644 agb/examples/affine_tiles.toml diff --git a/agb-image-converter/src/lib.rs b/agb-image-converter/src/lib.rs index f4f03d87..dfb10a5c 100644 --- a/agb-image-converter/src/lib.rs +++ b/agb-image-converter/src/lib.rs @@ -71,11 +71,11 @@ impl config::Image for BackgroundGfxOption { impl Parse for BackgroundGfxOption { fn parse(input: syn::parse::ParseStream) -> syn::Result { - let lookahead = input.lookahead1(); - let module_name: syn::Ident = input.parse()?; let _: Token![=>] = input.parse()?; + let lookahead = input.lookahead1(); + let colours = if lookahead.peek(syn::LitInt) { let num_colours: syn::LitInt = input.parse()?; @@ -125,6 +125,7 @@ impl Parse for IncludeBackgroundGfxInput { let module_name: syn::Ident = input.parse()?; let _: Token![,] = input.parse()?; + let lookahead = input.lookahead1(); let transparent_colour: Colour = if lookahead.peek(syn::LitStr) { let colour_str: syn::LitStr = input.parse()?; let _: Token![,] = input.parse()?; diff --git a/agb/examples/affine_background.rs b/agb/examples/affine_background.rs index 69b63032..a0bdd1ab 100644 --- a/agb/examples/affine_background.rs +++ b/agb/examples/affine_background.rs @@ -8,10 +8,10 @@ use agb::{ Priority, }, fixnum::{num, Num}, - include_gfx, + include_background_gfx, }; -include_gfx!("examples/affine_tiles.toml"); +include_background_gfx!(affine_tiles, water_tiles => 256 "examples/water_tiles.png"); #[agb::entry] fn main(mut gba: agb::Gba) -> ! { diff --git a/agb/examples/affine_tiles.toml b/agb/examples/affine_tiles.toml deleted file mode 100644 index 65d608a2..00000000 --- a/agb/examples/affine_tiles.toml +++ /dev/null @@ -1,6 +0,0 @@ -version = "1.0" - -[image.water_tiles] -filename = "water_tiles.png" -tile_size = "8x8" -colours = 256 \ No newline at end of file diff --git a/agb/examples/animated_background.rs b/agb/examples/animated_background.rs index 8ae95c8d..31ef37b1 100644 --- a/agb/examples/animated_background.rs +++ b/agb/examples/animated_background.rs @@ -6,10 +6,10 @@ use agb::{ tiled::{RegularBackgroundSize, TileFormat, TileSet, TileSetting, TiledMap}, Priority, }, - include_gfx, + include_background_gfx, }; -include_gfx!("examples/water_tiles.toml"); +include_background_gfx!(water_tiles, water_tiles => "examples/water_tiles.png"); #[agb::entry] fn main(mut gba: agb::Gba) -> ! {