diff --git a/src/app/gfx/bitmap.cc b/src/app/gfx/bitmap.cc index e1be16f4..db385954 100644 --- a/src/app/gfx/bitmap.cc +++ b/src/app/gfx/bitmap.cc @@ -107,6 +107,12 @@ void Bitmap::ApplyPalette(SNESPalette &palette) { surface_->format->palette = palette.GetSDL_Palette(); } +void Bitmap::SetPaletteColor(int id, gfx::snes_color color) { + surface_->format->palette->colors[id].r = color.red; + surface_->format->palette->colors[id].b = color.blue; + surface_->format->palette->colors[id].g = color.green; +} + // Creates a vector of bitmaps which are individual 8x8 tiles. absl::StatusOr> Bitmap::CreateTiles() { std::vector tiles; diff --git a/src/app/gfx/bitmap.h b/src/app/gfx/bitmap.h index 2afe5b8f..5ca40a6c 100644 --- a/src/app/gfx/bitmap.h +++ b/src/app/gfx/bitmap.h @@ -31,6 +31,7 @@ class Bitmap { void CreateTexture(std::shared_ptr renderer); void ApplyPalette(SNESPalette &palette); + void SetPaletteColor(int id, gfx::snes_color color); absl::StatusOr> CreateTiles(); absl::Status CreateFromTiles(const std::vector &tiles);