Skip to content

Commit

Permalink
Put the blend stuff in the top level display
Browse files Browse the repository at this point in the history
  • Loading branch information
gwilymk committed Feb 5, 2025
1 parent a8aacf6 commit 891ccfc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
11 changes: 6 additions & 5 deletions agb/examples/windows.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#![no_std]
#![no_main]

use agb::display::blend::Layer;
use agb::display::tiled::{RegularBackgroundTiles, TileFormat};
use agb::display::{example_logo, tiled::RegularBackgroundSize, window::WinIn};
use agb::display::{HEIGHT, WIDTH};
use agb::display::{BlendLayer, HEIGHT, WIDTH};
use agb::fixnum::{num, Num, Rect, Vector2D};
use agb::interrupt::VBlank;

Expand Down Expand Up @@ -59,9 +58,11 @@ fn main(mut gba: agb::Gba) -> ! {
let blend = frame.blend();
blend
.alpha()
.set_layer_alpha(Layer::Top, blend_amount.try_change_base().unwrap());
blend.layer(Layer::Top).enable_background(background_id);
blend.layer(Layer::Bottom).enable_backdrop();
.set_layer_alpha(BlendLayer::Top, blend_amount.try_change_base().unwrap());
blend
.layer(BlendLayer::Top)
.enable_background(background_id);
blend.layer(BlendLayer::Bottom).enable_backdrop();

vblank.wait_for_vblank();

Expand Down
7 changes: 5 additions & 2 deletions agb/src/display/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::memory_mapped::MemoryMapped;

use bilge::prelude::*;

use blend::Blend;
use tiled::{BackgroundFrame, DisplayControlRegister, TiledBackground};

use self::{
Expand All @@ -23,7 +22,7 @@ pub mod tile_data;
pub mod tiled;

pub mod affine;
pub mod blend;
mod blend;
pub mod window;

pub mod font;
Expand All @@ -34,6 +33,10 @@ const DISPLAY_CONTROL: MemoryMapped<DisplayControlRegister> =
pub(crate) const DISPLAY_STATUS: MemoryMapped<u16> = unsafe { MemoryMapped::new(0x0400_0004) };
const VCOUNT: MemoryMapped<u16> = unsafe { MemoryMapped::new(0x0400_0006) };

pub use blend::{
Blend, BlendAlphaEffect, BlendFadeEffect, BlendObjectTransparency, Layer as BlendLayer,
};

/// Width of the Gameboy advance screen in pixels
pub const WIDTH: i32 = 240;
/// Height of the Gameboy advance screen in pixels
Expand Down

0 comments on commit 891ccfc

Please sign in to comment.