Refactor editor manager and dungeon editor for improved clarity and performance

- Removed unused functions and streamlined shortcut registration in EditorManager for better readability.
- Updated lambda captures to use 'this' pointer for consistency and clarity.
- Refactored DungeonEditor to utilize ranges for sorting and filling operations, enhancing performance and readability.
- Simplified table setup in DungeonEditor by using a static array for tool names, improving maintainability.
This commit is contained in:
scawful
2025-08-03 17:53:34 -04:00
parent fdda77c172
commit c9921c91bf
5 changed files with 75 additions and 116 deletions

View File

@@ -4,12 +4,10 @@
#include <cstdint>
#include <vector>
#include "absl/log/log.h"
#include "app/gfx/bitmap.h"
#include "app/gfx/snes_tile.h"
namespace yaze {
namespace gfx {
namespace yaze::gfx {
BackgroundBuffer::BackgroundBuffer(int width, int height)
: width_(width), height_(height) {
@@ -31,9 +29,7 @@ uint16_t BackgroundBuffer::GetTileAt(int x, int y) const {
return 0;
}
void BackgroundBuffer::ClearBuffer() {
std::fill(buffer_.begin(), buffer_.end(), 0);
}
void BackgroundBuffer::ClearBuffer() { std::ranges::fill(buffer_, 0); }
void BackgroundBuffer::DrawTile(const TileInfo& tile, uint8_t* canvas,
const uint8_t* tiledata, int indexoffset) {
@@ -78,7 +74,7 @@ void BackgroundBuffer::DrawBackground(std::span<uint8_t> gfx16_data) {
void BackgroundBuffer::DrawFloor(const std::vector<uint8_t>& rom_data,
int tile_address, int tile_address_floor,
uint8_t floor_graphics) {
uint8_t f = (uint8_t)(floor_graphics << 4);
auto f = (uint8_t)(floor_graphics << 4);
// Create floor tiles from ROM data
gfx::TileInfo floorTile1(rom_data[tile_address + f],
@@ -115,5 +111,4 @@ void BackgroundBuffer::DrawFloor(const std::vector<uint8_t>& rom_data,
}
}
} // namespace gfx
} // namespace yaze
} // namespace yaze::gfx