expand tile library, consolidate rom features, work on overworld tile16 selection

This commit is contained in:
Justin Scofield
2022-06-20 17:54:14 -04:00
parent f7d793ecc2
commit f11e8f2aac
17 changed files with 222 additions and 239 deletions

View File

@@ -10,6 +10,23 @@ namespace yaze {
namespace app {
namespace gfx {
Bitmap::Bitmap(int width, int height, int depth, char *data)
: width_(width), height_(height), depth_(depth), pixel_data_(data) {
surface_ = SDL_CreateRGBSurfaceWithFormat(0, width, height, depth,
SDL_PIXELFORMAT_INDEX8);
// Default grayscale palette
for (int i = 0; i < 8; i++) {
surface_->format->palette->colors[i].r = i * 31;
surface_->format->palette->colors[i].g = i * 31;
surface_->format->palette->colors[i].b = i * 31;
}
surface_->pixels = data;
}
SDL_Texture *Bitmap::CreateTexture(std::shared_ptr<SDL_Renderer> renderer) {
texture_ = SDL_CreateTextureFromSurface(renderer.get(), surface_);
}
int GetPCGfxAddress(char *romData, char id) {
char **info1 = new char *[255];
int gfxPointer1 =
@@ -30,7 +47,8 @@ int GetPCGfxAddress(char *romData, char id) {
char gfxGamePointer3 = romData[gfxPointer3 + id];
return lorom_snes_to_pc(
yaze::app::rom::AddressFromBytes(gfxGamePointer1, gfxGamePointer2, gfxGamePointer3),
yaze::app::rom::AddressFromBytes(gfxGamePointer1, gfxGamePointer2,
gfxGamePointer3),
info1);
}