diff --git a/CHANGELOG.md b/CHANGELOG.md index d9a85efc..dfaf9407 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - There is now a multiboot feature which you can use to easily make multiboot ROMs. +- Can now set palette on a TileSetting struct. ### Changed - You no longer need the gba.ld or gba_mb.ld files in your repository. You should delete these when upgrading. diff --git a/agb/src/display/tiled/mod.rs b/agb/src/display/tiled/mod.rs index e9f20881..c3b45c76 100644 --- a/agb/src/display/tiled/mod.rs +++ b/agb/src/display/tiled/mod.rs @@ -194,6 +194,11 @@ impl TileSetting { 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 { self.0 & ((1 << 10) - 1) }