From f53cd9b25ad6897ce6919ccba485d6a10f912f85 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Thu, 13 Apr 2023 22:06:06 +0100 Subject: [PATCH] Write some terrible documentation --- agb/src/lib.rs | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/agb/src/lib.rs b/agb/src/lib.rs index 7e3b680c..e4c37070 100644 --- a/agb/src/lib.rs +++ b/agb/src/lib.rs @@ -36,43 +36,28 @@ /// This macro is used to convert a png or bmp into a format usable by the Game Boy Advance. /// -/// The macro expects to be linked to a `toml` file which contains a metadata about the image -/// and a link to the png or bmp itself. See the examples below for a full definition of the format. +/// Suppose you have a file in `examples/water_tiles.png` which contains some tiles you'd like to use. /// -/// # The manifest file format -/// -/// The following is an example of the toml file you would need to create. Generally you will -/// find this in the `gfx` folder in the same level as the `src` folder (see the examples). -/// -/// Suppose that the following is in `examples/water_tiles.toml`. -/// -/// ```toml -/// version = "1.0" -/// -/// [image.tiles] -/// filename = "water_tiles.png" -/// tile_size = "8x8" -/// ``` -/// -/// You then import this using: +/// You import them using: /// ```rust,no_run /// ##![no_std] /// ##![no_main] -/// agb::include_gfx!("examples/water_tiles.toml"); +/// agb::include_background_gfx!(water_tiles, tiles => "examples/water_tiles.png"); /// ``` /// /// This will generate something along the lines of the following: /// /// ```rust,ignore -/// // module name comes from the name of the toml file, so `water_tiles` in this case because it is -/// // called `water_tiles.toml` +/// // module name comes from the first argument, name of the constant from the arrow /// mod water_tiles { -/// const tiles = /* ... */; +/// pub const tiles = /* ... */; /// } /// ``` /// /// And tiles will be an instance of [`TileData`][crate::display::tile_data::TileData] /// +/// You can import multiple files at once, and the palette data will be combined so they can all be visible. +/// /// # Examples /// /// Assume the tiles are loaded as above @@ -90,10 +75,10 @@ /// include_gfx, /// }; /// -/// agb::include_gfx!("examples/water_tiles.toml"); +/// agb::include_background_gfx!(water_tiles, tiles => "exmaples/water_tiles.png"); /// /// # fn load_tileset(mut gfx: Tiled0, mut vram: VRamManager) { -/// let tileset = TileSet::new(water_tiles::water_tiles.tiles, TileFormat::FourBpp); +/// let tileset = TileSet::new(water_tiles::tiles.tiles, TileFormat::FourBpp); /// /// vram.set_background_palettes(water_tiles::PALETTES); /// @@ -113,7 +98,7 @@ /// bg.show(); /// # } /// ``` -pub use agb_image_converter::include_gfx; +pub use agb_image_converter::include_background_gfx; #[doc(hidden)] pub use agb_image_converter::include_aseprite_inner; @@ -121,8 +106,6 @@ pub use agb_image_converter::include_aseprite_inner; #[doc(hidden)] pub use agb_image_converter::include_font as include_font_inner; -pub use agb_image_converter::include_background_gfx; - #[macro_export] macro_rules! include_font { ($font_path: literal, $font_size: literal) => {{