overworld editor tile selector/painter routines

This commit is contained in:
scawful
2022-12-31 13:53:07 -06:00
parent 95d69bcb92
commit a8729add01
6 changed files with 173 additions and 90 deletions

View File

@@ -96,6 +96,11 @@ void Bitmap::Create(int width, int height, int depth, Bytes data) {
GrayscalePalette(surface_->format->palette);
}
void Bitmap::Apply(Bytes data) {
pixel_data_ = data.data();
data_ = data;
}
// Creates the texture that will be displayed to the screen.
void Bitmap::CreateTexture(std::shared_ptr<SDL_Renderer> renderer) {
texture_ = std::shared_ptr<SDL_Texture>{

View File

@@ -28,10 +28,16 @@ class Bitmap {
void Create(int width, int height, int depth, uchar *data, int data_size);
void Create(int width, int height, int depth, Bytes data);
void Apply(Bytes data);
void CreateTexture(std::shared_ptr<SDL_Renderer> renderer);
void ApplyPalette(const SNESPalette &palette);
void WriteToPixel(int position, uchar value) {
this->pixel_data_[position] = value;
}
int GetWidth() const { return width_; }
int GetHeight() const { return height_; }
auto GetSize() const { return data_size_; }