palettes and overworld drawing

This commit is contained in:
scawful
2022-09-10 16:33:59 -05:00
parent 8cc9adf41a
commit 1244e6855c
14 changed files with 168 additions and 190 deletions

View File

@@ -103,15 +103,17 @@ void Bitmap::CreateTexture(std::shared_ptr<SDL_Renderer> renderer) {
}
// Convert SNESPalette to SDL_Palette for surface.
void Bitmap::ApplyPalette(SNESPalette palette) {
void Bitmap::ApplyPalette(const SNESPalette & palette) {
palette_ = palette;
surface_->format->palette = palette_.GetSDL_Palette();
SDL_SetPaletteColors(surface_->format->palette,
palette_.GetSDL_Palette()->colors,
0, 256);
}
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;
void Bitmap::SetPaletteColor(int id, gfx::SNESColor color) {
surface_->format->palette->colors[id].r = color.rgb.x;
surface_->format->palette->colors[id].g = color.rgb.y;
surface_->format->palette->colors[id].b = color.rgb.z;
}
// Creates a vector of bitmaps which are individual 8x8 tiles.