Replace example usage with the new macro

This commit is contained in:
Gwilym Inzani 2023-04-13 22:01:37 +01:00
parent 65877b1d32
commit eac350b391
4 changed files with 7 additions and 12 deletions

View file

@ -71,11 +71,11 @@ impl config::Image for BackgroundGfxOption {
impl Parse for BackgroundGfxOption { impl Parse for BackgroundGfxOption {
fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> { fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
let lookahead = input.lookahead1();
let module_name: syn::Ident = input.parse()?; let module_name: syn::Ident = input.parse()?;
let _: Token![=>] = input.parse()?; let _: Token![=>] = input.parse()?;
let lookahead = input.lookahead1();
let colours = if lookahead.peek(syn::LitInt) { let colours = if lookahead.peek(syn::LitInt) {
let num_colours: syn::LitInt = input.parse()?; let num_colours: syn::LitInt = input.parse()?;
@ -125,6 +125,7 @@ impl Parse for IncludeBackgroundGfxInput {
let module_name: syn::Ident = input.parse()?; let module_name: syn::Ident = input.parse()?;
let _: Token![,] = input.parse()?; let _: Token![,] = input.parse()?;
let lookahead = input.lookahead1();
let transparent_colour: Colour = if lookahead.peek(syn::LitStr) { let transparent_colour: Colour = if lookahead.peek(syn::LitStr) {
let colour_str: syn::LitStr = input.parse()?; let colour_str: syn::LitStr = input.parse()?;
let _: Token![,] = input.parse()?; let _: Token![,] = input.parse()?;

View file

@ -8,10 +8,10 @@ use agb::{
Priority, Priority,
}, },
fixnum::{num, Num}, 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] #[agb::entry]
fn main(mut gba: agb::Gba) -> ! { fn main(mut gba: agb::Gba) -> ! {

View file

@ -1,6 +0,0 @@
version = "1.0"
[image.water_tiles]
filename = "water_tiles.png"
tile_size = "8x8"
colours = 256

View file

@ -6,10 +6,10 @@ use agb::{
tiled::{RegularBackgroundSize, TileFormat, TileSet, TileSetting, TiledMap}, tiled::{RegularBackgroundSize, TileFormat, TileSet, TileSetting, TiledMap},
Priority, 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] #[agb::entry]
fn main(mut gba: agb::Gba) -> ! { fn main(mut gba: agb::Gba) -> ! {