mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-11 17:41:33 +11:00
Try to fix splash screen crackle
This commit is contained in:
parent
b61f774061
commit
983b56975c
|
@ -657,7 +657,7 @@ impl<'a, 'b, 'c> PlayingLevel<'a, 'b> {
|
||||||
|
|
||||||
fn hide_backgrounds(&mut self) {
|
fn hide_backgrounds(&mut self) {
|
||||||
self.background.background.hide();
|
self.background.background.hide();
|
||||||
self.background.background.hide();
|
self.background.foreground.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clear_backgrounds(&mut self, vram: &mut VRamManager) {
|
fn clear_backgrounds(&mut self, vram: &mut VRamManager) {
|
||||||
|
@ -775,12 +775,27 @@ fn main(mut agb: agb::Gba) -> ! {
|
||||||
let (tiled, mut vram) = agb.display.video.tiled0();
|
let (tiled, mut vram) = agb.display.video.tiled0();
|
||||||
vram.set_background_palettes(tile_sheet::background.palettes);
|
vram.set_background_palettes(tile_sheet::background.palettes);
|
||||||
let mut splash_screen = tiled.background(Priority::P0);
|
let mut splash_screen = tiled.background(Priority::P0);
|
||||||
|
let mut world_display = tiled.background(Priority::P0);
|
||||||
|
|
||||||
let tile_set_ref = vram.add_tileset(TileSet::new(
|
let tile_set_ref = vram.add_tileset(TileSet::new(
|
||||||
tile_sheet::background.tiles,
|
tile_sheet::background.tiles,
|
||||||
TileFormat::FourBpp,
|
TileFormat::FourBpp,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
for y in 0..32u16 {
|
||||||
|
for x in 0..32u16 {
|
||||||
|
world_display.set_tile(
|
||||||
|
&mut vram,
|
||||||
|
(x, y).into(),
|
||||||
|
tile_set_ref,
|
||||||
|
TileSetting::from_raw(level_display::BLANK),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
world_display.commit();
|
||||||
|
world_display.show();
|
||||||
|
|
||||||
splash_screen::show_splash_screen(
|
splash_screen::show_splash_screen(
|
||||||
splash_screen::SplashScreen::Start,
|
splash_screen::SplashScreen::Start,
|
||||||
None,
|
None,
|
||||||
|
@ -790,6 +805,8 @@ fn main(mut agb: agb::Gba) -> ! {
|
||||||
);
|
);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
vram.set_background_palettes(tile_sheet::background.palettes);
|
||||||
|
|
||||||
let mut object = agb.display.object.get();
|
let mut object = agb.display.object.get();
|
||||||
let mut timer_controller = agb.timers.timers();
|
let mut timer_controller = agb.timers.timers();
|
||||||
let mut mixer = agb.mixer.mixer(&mut timer_controller.timer0);
|
let mut mixer = agb.mixer.mixer(&mut timer_controller.timer0);
|
||||||
|
@ -797,20 +814,6 @@ fn main(mut agb: agb::Gba) -> ! {
|
||||||
object.set_sprite_palettes(object_sheet::object_sheet.palettes);
|
object.set_sprite_palettes(object_sheet::object_sheet.palettes);
|
||||||
object.set_sprite_tilemap(object_sheet::object_sheet.tiles);
|
object.set_sprite_tilemap(object_sheet::object_sheet.tiles);
|
||||||
|
|
||||||
for y in 0..32u16 {
|
|
||||||
for x in 0..32u16 {
|
|
||||||
splash_screen.set_tile(
|
|
||||||
&mut vram,
|
|
||||||
(x, y).into(),
|
|
||||||
tile_set_ref,
|
|
||||||
TileSetting::from_raw(level_display::BLANK),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
splash_screen.commit();
|
|
||||||
splash_screen.show();
|
|
||||||
|
|
||||||
object.enable();
|
object.enable();
|
||||||
|
|
||||||
mixer.enable();
|
mixer.enable();
|
||||||
|
@ -830,23 +833,21 @@ fn main(mut agb: agb::Gba) -> ! {
|
||||||
mixer.after_vblank();
|
mixer.after_vblank();
|
||||||
|
|
||||||
level_display::write_level(
|
level_display::write_level(
|
||||||
&mut splash_screen,
|
&mut world_display,
|
||||||
current_level / 8 + 1,
|
current_level / 8 + 1,
|
||||||
current_level % 8 + 1,
|
current_level % 8 + 1,
|
||||||
tile_set_ref,
|
tile_set_ref,
|
||||||
&mut vram,
|
&mut vram,
|
||||||
);
|
);
|
||||||
|
|
||||||
splash_screen.commit();
|
world_display.commit();
|
||||||
splash_screen.show();
|
world_display.show();
|
||||||
|
|
||||||
music_box.before_frame(&mut mixer);
|
music_box.before_frame(&mut mixer);
|
||||||
mixer.frame();
|
mixer.frame();
|
||||||
vblank.wait_for_vblank();
|
vblank.wait_for_vblank();
|
||||||
mixer.after_vblank();
|
mixer.after_vblank();
|
||||||
|
|
||||||
vram.set_background_palettes(tile_sheet::background.palettes);
|
|
||||||
|
|
||||||
let mut background = InfiniteScrolledMap::new(
|
let mut background = InfiniteScrolledMap::new(
|
||||||
tiled.background(Priority::P2),
|
tiled.background(Priority::P2),
|
||||||
Box::new(move |pos: Vector2D<i32>| {
|
Box::new(move |pos: Vector2D<i32>| {
|
||||||
|
@ -909,7 +910,7 @@ fn main(mut agb: agb::Gba) -> ! {
|
||||||
|
|
||||||
level.show_backgrounds();
|
level.show_backgrounds();
|
||||||
|
|
||||||
splash_screen.hide();
|
world_display.hide();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
match level
|
match level
|
||||||
|
|
|
@ -42,6 +42,19 @@ pub fn show_splash_screen(
|
||||||
|
|
||||||
let mut input = agb::input::ButtonController::new();
|
let mut input = agb::input::ButtonController::new();
|
||||||
|
|
||||||
|
if let Some(ref mut mixer) = mixer {
|
||||||
|
if let Some(ref mut music_box) = music_box {
|
||||||
|
music_box.before_frame(mixer);
|
||||||
|
}
|
||||||
|
mixer.frame();
|
||||||
|
}
|
||||||
|
|
||||||
|
vblank.wait_for_vblank();
|
||||||
|
|
||||||
|
if let Some(ref mut mixer) = mixer {
|
||||||
|
mixer.after_vblank();
|
||||||
|
}
|
||||||
|
|
||||||
for y in 0..20u16 {
|
for y in 0..20u16 {
|
||||||
for x in 0..30u16 {
|
for x in 0..30u16 {
|
||||||
map.set_tile(
|
map.set_tile(
|
||||||
|
|
Loading…
Reference in a new issue