mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
Write some terrible documentation
This commit is contained in:
parent
eac350b391
commit
f53cd9b25a
|
@ -36,43 +36,28 @@
|
||||||
|
|
||||||
/// This macro is used to convert a png or bmp into a format usable by the Game Boy Advance.
|
/// 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
|
/// Suppose you have a file in `examples/water_tiles.png` which contains some tiles you'd like to use.
|
||||||
/// and a link to the png or bmp itself. See the examples below for a full definition of the format.
|
|
||||||
///
|
///
|
||||||
/// # The manifest file format
|
/// You import them using:
|
||||||
///
|
|
||||||
/// 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:
|
|
||||||
/// ```rust,no_run
|
/// ```rust,no_run
|
||||||
/// ##![no_std]
|
/// ##![no_std]
|
||||||
/// ##![no_main]
|
/// ##![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:
|
/// This will generate something along the lines of the following:
|
||||||
///
|
///
|
||||||
/// ```rust,ignore
|
/// ```rust,ignore
|
||||||
/// // module name comes from the name of the toml file, so `water_tiles` in this case because it is
|
/// // module name comes from the first argument, name of the constant from the arrow
|
||||||
/// // called `water_tiles.toml`
|
|
||||||
/// mod water_tiles {
|
/// mod water_tiles {
|
||||||
/// const tiles = /* ... */;
|
/// pub const tiles = /* ... */;
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// And tiles will be an instance of [`TileData`][crate::display::tile_data::TileData]
|
/// 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
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// Assume the tiles are loaded as above
|
/// Assume the tiles are loaded as above
|
||||||
|
@ -90,10 +75,10 @@
|
||||||
/// include_gfx,
|
/// 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) {
|
/// # 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);
|
/// vram.set_background_palettes(water_tiles::PALETTES);
|
||||||
///
|
///
|
||||||
|
@ -113,7 +98,7 @@
|
||||||
/// bg.show();
|
/// bg.show();
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
pub use agb_image_converter::include_gfx;
|
pub use agb_image_converter::include_background_gfx;
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use agb_image_converter::include_aseprite_inner;
|
pub use agb_image_converter::include_aseprite_inner;
|
||||||
|
@ -121,8 +106,6 @@ pub use agb_image_converter::include_aseprite_inner;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use agb_image_converter::include_font as include_font_inner;
|
pub use agb_image_converter::include_font as include_font_inner;
|
||||||
|
|
||||||
pub use agb_image_converter::include_background_gfx;
|
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! include_font {
|
macro_rules! include_font {
|
||||||
($font_path: literal, $font_size: literal) => {{
|
($font_path: literal, $font_size: literal) => {{
|
||||||
|
|
Loading…
Reference in a new issue