allow TileSetting palette to be set

This commit is contained in:
Brandon Atkinson 2023-10-16 22:25:11 -06:00
parent 1a468e7b55
commit 2f1ad07e43
2 changed files with 6 additions and 0 deletions

View file

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- There is now a multiboot feature which you can use to easily make multiboot ROMs. - There is now a multiboot feature which you can use to easily make multiboot ROMs.
- Can now set palette on a TileSetting struct.
### Changed ### Changed
- You no longer need the gba.ld or gba_mb.ld files in your repository. You should delete these when upgrading. - You no longer need the gba.ld or gba_mb.ld files in your repository. You should delete these when upgrading.

View file

@ -194,6 +194,11 @@ impl TileSetting {
Self(self.0 ^ ((should_flip as u16) << 11)) Self(self.0 ^ ((should_flip as u16) << 11))
} }
#[must_use]
pub const fn palette(self, palette_id: u8) -> Self {
Self(self.0 ^ ((palette_id as u16) << 12))
}
fn index(self) -> u16 { fn index(self) -> u16 {
self.0 & ((1 << 10) - 1) self.0 & ((1 << 10) - 1)
} }