[nostalgia/core] Move most TileSheet functions to cpp file

This commit is contained in:
2023-10-21 01:18:46 -05:00
parent 5eaa86a934
commit 4ab710b155
4 changed files with 416 additions and 304 deletions

View File

@@ -103,7 +103,7 @@ class DrawCommand: public TileSheetCommand {
int m_palIdx = 0;
public:
constexpr DrawCommand(
DrawCommand(
TileSheet &img,
TileSheet::SubSheetIdx subSheetIdx,
std::size_t idx,
@@ -115,7 +115,7 @@ class DrawCommand: public TileSheetCommand {
m_palIdx = palIdx;
}
constexpr DrawCommand(
DrawCommand(
TileSheet &img,
TileSheet::SubSheetIdx subSheetIdx,
const ox::Vector<std::size_t> &idxList,
@@ -129,7 +129,7 @@ class DrawCommand: public TileSheetCommand {
m_palIdx = palIdx;
}
constexpr auto append(std::size_t idx) noexcept {
auto append(std::size_t idx) noexcept {
auto &subsheet = m_img.getSubSheet(m_subSheetIdx);
if (m_changes.back().value->idx != idx && subsheet.getPixel(m_img.bpp, idx) != m_palIdx) {
// duplicate entries are bad
@@ -248,7 +248,7 @@ class AddSubSheetCommand: public TileSheetCommand {
ox::Vector<TileSheet::SubSheetIdx, 2> m_addedSheets;
public:
constexpr AddSubSheetCommand(TileSheet &img, TileSheet::SubSheetIdx parentIdx) noexcept:
AddSubSheetCommand(TileSheet &img, TileSheet::SubSheetIdx parentIdx) noexcept:
m_img(img),
m_parentIdx(std::move(parentIdx)) {
auto &parent = m_img.getSubSheet(m_parentIdx);
@@ -313,7 +313,7 @@ class RmSubSheetCommand: public TileSheetCommand {
TileSheet::SubSheet m_sheet;
public:
constexpr RmSubSheetCommand(TileSheet &img, TileSheet::SubSheetIdx idx) noexcept:
RmSubSheetCommand(TileSheet &img, TileSheet::SubSheetIdx idx) noexcept:
m_img(img),
m_idx(std::move(idx)) {
m_parentIdx = idx;
@@ -354,7 +354,7 @@ class InsertTilesCommand: public TileSheetCommand {
ox::Vector<uint8_t> m_deletedPixels = {};
public:
constexpr InsertTilesCommand(
InsertTilesCommand(
TileSheet &img,
TileSheet::SubSheetIdx idx,
std::size_t tileIdx,
@@ -419,7 +419,7 @@ class DeleteTilesCommand: public TileSheetCommand {
ox::Vector<uint8_t> m_deletedPixels = {};
public:
constexpr DeleteTilesCommand(
DeleteTilesCommand(
TileSheet &img,
TileSheet::SubSheetIdx idx,
std::size_t tileIdx,
@@ -485,7 +485,7 @@ class UpdateSubSheetCommand: public TileSheetCommand {
int m_newRows = 0;
public:
constexpr UpdateSubSheetCommand(
UpdateSubSheetCommand(
TileSheet &img,
TileSheet::SubSheetIdx idx,
const ox::String &name,

View File

@@ -76,13 +76,13 @@ class TileSheetEditorModel: public ox::SignalHandler {
void setActiveSubsheet(const TileSheet::SubSheetIdx&) noexcept;
[[nodiscard]]
constexpr const TileSheet::SubSheet *activeSubSheet() const noexcept {
const TileSheet::SubSheet *activeSubSheet() const noexcept {
auto &activeSubSheet = m_img.getSubSheet(m_activeSubsSheetIdx);
return &activeSubSheet;
}
[[nodiscard]]
constexpr TileSheet::SubSheet *activeSubSheet() noexcept {
TileSheet::SubSheet *activeSubSheet() noexcept {
auto &activeSubSheet = m_img.getSubSheet(m_activeSubsSheetIdx);
return &activeSubSheet;
}