Dungeon Room load current graphics experiment

This commit is contained in:
Justin Scofield
2023-11-21 23:44:05 -05:00
parent 59e7dcc7f0
commit 7a842d4669
9 changed files with 249 additions and 120 deletions

View File

@@ -95,6 +95,7 @@ class Bitmap {
int width() const { return width_; }
int height() const { return height_; }
auto depth() const { return depth_; }
auto size() const { return data_size_; }
auto data() const { return pixel_data_; }
auto at(int i) const { return pixel_data_[i]; }
@@ -149,6 +150,14 @@ class BitmapManager {
return bitmap;
}
std::shared_ptr<gfx::Bitmap> CopyBitmap(std::shared_ptr<gfx::Bitmap> bitmap,
int id) {
auto copy = std::make_shared<gfx::Bitmap>(bitmap->width(), bitmap->height(),
bitmap->depth(), bitmap->data());
bitmap_cache_[id] = copy;
return copy;
}
std::shared_ptr<gfx::Bitmap> operator[](int id) {
auto it = bitmap_cache_.find(id);
if (it != bitmap_cache_.end()) {