housekeeping

This commit is contained in:
scawful
2023-11-11 20:17:34 -05:00
parent 61d235c342
commit c1ad23284e
7 changed files with 14 additions and 11 deletions

View File

@@ -83,11 +83,11 @@ void ButtonPipe(absl::string_view button_text, std::function<void()> callback) {
}
}
void BitmapCanvasPipeline(gui::Canvas& canvas, gfx::Bitmap& bitmap, int width,
int height, int tile_size, bool is_loaded,
void BitmapCanvasPipeline(gui::Canvas& canvas, const gfx::Bitmap& bitmap,
int width, int height, int tile_size, bool is_loaded,
bool scrollbar, int canvas_id) {
auto draw_canvas = [](gui::Canvas& canvas, gfx::Bitmap& bitmap, int width,
int height, int tile_size, bool is_loaded) {
auto draw_canvas = [](gui::Canvas& canvas, const gfx::Bitmap& bitmap,
int width, int height, int tile_size, bool is_loaded) {
canvas.DrawBackground(ImVec2(width + 1, height + 1));
canvas.DrawContextMenu();
canvas.DrawBitmap(bitmap, 2, is_loaded);

View File

@@ -29,7 +29,7 @@ void GraphicsBinCanvasPipeline(int width, int height, int tile_size,
void ButtonPipe(absl::string_view button_text, std::function<void()> callback);
void BitmapCanvasPipeline(gui::Canvas& canvas, gfx::Bitmap& bitmap, int width,
void BitmapCanvasPipeline(gui::Canvas& canvas, const gfx::Bitmap& bitmap, int width,
int height, int tile_size, bool is_loaded,
bool scrollbar, int canvas_id);

View File

@@ -33,8 +33,7 @@ absl::Status OverworldEditor::Update() {
if (rom()->isLoaded() && !all_gfx_loaded_) {
RETURN_IF_ERROR(LoadGraphics())
tile16_editor_.InitBlockset(tile16_blockset_bmp_);
gfx_group_editor_.InitBlockset(tile16_blockset_bmp_, graphics_bin_,
palette_);
gfx_group_editor_.InitBlockset(tile16_blockset_bmp_);
all_gfx_loaded_ = true;
}

View File

@@ -6,10 +6,12 @@
namespace yaze {
namespace app {
namespace editor {
class SpriteEditor {
public:
absl::Status Update();
};
} // namespace editor
} // namespace app
} // namespace yaze

View File

@@ -6,12 +6,14 @@
#include <cstdint>
#include <memory>
#include "absl/container/flat_hash_map.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
#include "app/core/constants.h"
#include "app/gfx/snes_palette.h"
namespace yaze {
namespace app {
namespace gfx {
@@ -113,7 +115,7 @@ class Bitmap {
std::shared_ptr<SDL_Surface> surface_ = nullptr;
};
using BitmapTable = std::unordered_map<int, gfx::Bitmap>;
using BitmapTable = absl::flat_hash_map<int, gfx::Bitmap>;
} // namespace gfx
} // namespace app

View File

@@ -11,8 +11,8 @@ Sprite::Sprite() {
}
}
void Sprite::InitSprite(Bytes& src, uchar mapid, uchar id, uchar x, uchar y,
int map_x, int map_y) {
void Sprite::InitSprite(const Bytes& src, uchar mapid, uchar id, uchar x,
uchar y, int map_x, int map_y) {
current_gfx_ = src;
overworld_ = true;
map_id_ = mapid;

View File

@@ -23,7 +23,7 @@ class Sprite {
Sprite();
Sprite(Bytes src, uchar mapid, uchar id, uchar x, uchar y, int map_x,
int map_y);
void InitSprite(Bytes& src, uchar mapid, uchar id, uchar x, uchar y,
void InitSprite(const Bytes& src, uchar mapid, uchar id, uchar x, uchar y,
int map_x, int map_y);
void updateBBox();