[nostalgia/core] Get TileSheetEditor's palette view working

This commit is contained in:
2022-02-16 02:34:43 -06:00
parent c1a374ca04
commit b7f726f4fd
6 changed files with 58 additions and 31 deletions
@@ -9,7 +9,6 @@
#include <nostalgia/core/gfx.hpp>
#include <nostalgia/geo/point.hpp>
#include <nostalgia/geo/vec.hpp>
#include <nostalgia/glutils/glutils.hpp>
#include <nostalgia/studio/studio.hpp>
namespace nostalgia::core {
@@ -55,13 +54,14 @@ struct DrawCommand: public studio::UndoCommand {
return false;
}
void redo() noexcept override {
void redo() noexcept final {
for (const auto &c : m_changes) {
oxDebugf("{} to {}", c.idx, m_palIdx);
m_img->setPixel(c.idx, m_palIdx);
}
}
void undo() noexcept override {
void undo() noexcept final {
for (const auto &c : m_changes) {
m_img->setPixel(c.idx, c.oldPalIdx);
}
@@ -137,9 +137,9 @@ class TileSheetEditorModel {
[[nodiscard]]
constexpr const NostalgiaPalette &pal() const noexcept;
void draw(const geo::Point &pt, std::size_t palIdx) noexcept;
void drawCommand(const geo::Point &pt, std::size_t palIdx) noexcept;
void endDraw() noexcept;
void endDrawCommand() noexcept;
[[nodiscard]]
bool updated() const noexcept;