mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 00:31:34 +11:00
Add an enum for tracking background size of regular tiles
This commit is contained in:
parent
06f701af75
commit
288fa0c85e
|
@ -8,6 +8,42 @@ pub use map::{MapLoan, RegularMap};
|
|||
pub use tiled0::Tiled0;
|
||||
pub use vram_manager::{DynamicTile, TileFormat, TileIndex, TileSet, VRamManager};
|
||||
|
||||
pub enum RegularBackgroundSize {
|
||||
Background32x32,
|
||||
Background64x32,
|
||||
Background32x64,
|
||||
Background64x64,
|
||||
}
|
||||
|
||||
impl RegularBackgroundSize {
|
||||
pub fn width(&self) -> u32 {
|
||||
match self {
|
||||
RegularBackgroundSize::Background32x32 => 32,
|
||||
RegularBackgroundSize::Background64x32 => 64,
|
||||
RegularBackgroundSize::Background32x64 => 32,
|
||||
RegularBackgroundSize::Background64x64 => 64,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn height(&self) -> u32 {
|
||||
match self {
|
||||
RegularBackgroundSize::Background32x32 => 32,
|
||||
RegularBackgroundSize::Background64x32 => 32,
|
||||
RegularBackgroundSize::Background32x64 => 64,
|
||||
RegularBackgroundSize::Background64x64 => 64,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn size_flag(&self) -> u16 {
|
||||
match self {
|
||||
RegularBackgroundSize::Background32x32 => 0,
|
||||
RegularBackgroundSize::Background64x32 => 1,
|
||||
RegularBackgroundSize::Background32x64 => 2,
|
||||
RegularBackgroundSize::Background64x64 => 3,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
#[repr(transparent)]
|
||||
struct Tile(u16);
|
||||
|
|
Loading…
Reference in a new issue