[nostalgia/core/studio] Add ability to select pixels for copy/paste

This commit is contained in:
2022-03-10 02:39:22 -06:00
parent 3486734b50
commit b502b8cc30
9 changed files with 147 additions and 33 deletions
@@ -8,6 +8,7 @@
#include <ox/std/string.hpp>
#include <nostalgia/core/gfx.hpp>
#include <nostalgia/geo/bounds.hpp>
#include <nostalgia/geo/point.hpp>
#include <nostalgia/geo/vec.hpp>
#include <nostalgia/studio/studio.hpp>
@@ -279,6 +280,11 @@ class TileSheetEditorModel: public ox::SignalHandler {
bool m_updated = false;
Context *m_ctx = nullptr;
ox::String m_path;
ox::Vector<std::size_t> m_selectedPixels; // pixel idx values
bool m_selectionOngoing = false;
geo::Point m_selectionPt1 = {-1, -1};
geo::Point m_selectionPt2 = {-1, -1};
geo::Bounds m_selectionBounds;
public:
TileSheetEditorModel(Context *ctx, const ox::String &path);
@@ -326,6 +332,12 @@ class TileSheetEditorModel: public ox::SignalHandler {
return m_activeSubsSheetIdx;
}
void select(const geo::Point &pt) noexcept;
void completeSelection() noexcept;
void clearSelection() noexcept;
[[nodiscard]]
bool updated() const noexcept;
@@ -337,6 +349,8 @@ class TileSheetEditorModel: public ox::SignalHandler {
constexpr studio::UndoStack *undoStack() noexcept;
bool pixelSelected(std::size_t idx) const noexcept;
protected:
void saveItem();