mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-11 17:41:33 +11:00
Fix the test logo and the example
This commit is contained in:
parent
8fcb9e607d
commit
06c988e952
|
@ -7,7 +7,10 @@ use agb::display::example_logo;
|
|||
fn main(mut gba: agb::Gba) -> ! {
|
||||
let mut gfx = gba.display.video.tiled0();
|
||||
|
||||
example_logo::display_logo(&mut gfx);
|
||||
let mut map = gfx.background();
|
||||
let mut vram = gfx.vram;
|
||||
|
||||
example_logo::display_logo(&mut map, &mut vram);
|
||||
|
||||
loop {}
|
||||
}
|
||||
|
|
|
@ -1,31 +1,32 @@
|
|||
use crate::display::background::Tiled0;
|
||||
|
||||
use super::background::{Tile, TileFormat, TileSet};
|
||||
use super::background::{RegularMap, TileFormat, TileSet, TileSetting, VRamManager};
|
||||
|
||||
crate::include_gfx!("gfx/agb_logo.toml");
|
||||
|
||||
pub fn display_logo(gfx: &mut Tiled0) {
|
||||
gfx.vram
|
||||
.set_background_palettes(agb_logo::test_logo.palettes);
|
||||
pub fn display_logo(map: &mut RegularMap, vram: &mut VRamManager) {
|
||||
vram.set_background_palettes(agb_logo::test_logo.palettes);
|
||||
|
||||
let background_tilemap = TileSet::new(agb_logo::test_logo.tiles, TileFormat::FourBpp);
|
||||
let background_tilemap_reference = gfx.vram.add_tileset(background_tilemap);
|
||||
|
||||
let mut back = gfx.background();
|
||||
let background_tilemap_reference = vram.add_tileset(background_tilemap);
|
||||
|
||||
for y in 0..20 {
|
||||
for x in 0..30 {
|
||||
let tile_id = y * 30 + x;
|
||||
|
||||
let palette_entry = agb_logo::test_logo.palette_assignments[tile_id as usize] as u16;
|
||||
let tile = gfx.vram.add_tile(background_tilemap_reference, tile_id);
|
||||
let palette_entry = agb_logo::test_logo.palette_assignments[tile_id as usize];
|
||||
let tile_setting = TileSetting::new(false, false, palette_entry);
|
||||
|
||||
back.set_tile(x, y, Tile::new(tile, false, false, palette_entry))
|
||||
map.set_tile(
|
||||
vram,
|
||||
(x, y).into(),
|
||||
background_tilemap_reference,
|
||||
tile_id,
|
||||
tile_setting,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
back.commit();
|
||||
back.show();
|
||||
map.commit();
|
||||
map.show();
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
@ -35,7 +36,9 @@ mod tests {
|
|||
fn logo_display(gba: &mut crate::Gba) {
|
||||
let mut gfx = gba.display.video.tiled0();
|
||||
|
||||
display_logo(&mut gfx);
|
||||
let mut map = gfx.background();
|
||||
|
||||
display_logo(&mut map, &mut gfx.vram);
|
||||
|
||||
crate::test_runner::assert_image_output("gfx/test_logo.png");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue