[nostalgia/core] Get TileSheetEditor's palette view working
This commit is contained in:
@@ -14,15 +14,27 @@ TileSheetEditorModel::TileSheetEditorModel(Context *ctx, const ox::String &path)
|
||||
oxThrowError(readObj<NostalgiaPalette>(ctx, m_img.defaultPalette).moveTo(&m_pal));
|
||||
}
|
||||
|
||||
void TileSheetEditorModel::draw(const geo::Point &pt, std::size_t palIdx) noexcept {
|
||||
void TileSheetEditorModel::cut() {
|
||||
}
|
||||
|
||||
void TileSheetEditorModel::copy() {
|
||||
}
|
||||
|
||||
void TileSheetEditorModel::paste() {
|
||||
}
|
||||
|
||||
void TileSheetEditorModel::drawCommand(const geo::Point &pt, std::size_t palIdx) noexcept {
|
||||
if (m_ongoingDrawCommand) {
|
||||
m_updated = m_ongoingDrawCommand->append(ptToIdx(pt, m_img.columns));
|
||||
} else {
|
||||
pushCommand(new DrawCommand(&m_img, ptToIdx(pt, m_img.columns), palIdx));
|
||||
const auto idx = ptToIdx(pt, m_img.columns);
|
||||
if (m_img.getPixel(idx) != palIdx) {
|
||||
pushCommand(new DrawCommand(&m_img, idx, palIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TileSheetEditorModel::endDraw() noexcept {
|
||||
void TileSheetEditorModel::endDrawCommand() noexcept {
|
||||
m_ongoingDrawCommand = nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user