[nostalgia/core/studio] Decouple core TileSheetEditor from ImGui

This commit is contained in:
2022-02-13 03:14:28 -06:00
parent 7370b23c9d
commit 0aa71f1dbb
6 changed files with 282 additions and 147 deletions
+19 -25
View File
@@ -95,12 +95,9 @@ constexpr ox::Error model(T *io, TileSheetClipboard *b) noexcept {
return OxError(0);
}
class TileSheetEditor: public studio::Editor {
class TileSheetEditor {
private:
ox::String m_itemPath;
ox::String m_itemName;
glutils::FrameBuffer m_framebuffer;
TileSheetGrid m_pixelGridDrawer;
TileSheetPixels m_pixelsDrawer;
bool m_updated = false;
@@ -108,31 +105,38 @@ class TileSheetEditor: public studio::Editor {
AssetRef<NostalgiaPalette> m_pal;
float m_pixelSizeMod = 1;
common::Vec2 m_scrollOffset;
float m_palViewWidth = 200;
public:
TileSheetEditor(Context *ctx, const ox::String &path);
~TileSheetEditor() override = default;
~TileSheetEditor() = default;
ox::String itemName() const noexcept override;
void cut();
ox::String itemDisplayName() const noexcept override;
void copy();
void exportFile() override;
void paste();
void cut() override;
void draw() noexcept;
void copy() override;
void clickPixel(const common::Vec2 &paneSize, const common::Vec2 &clickPos) noexcept;
void paste() override;
void scrollV(const common::Vec2 paneSz, float wheel, bool zoomMod) noexcept;
void draw(core::Context*) noexcept override;
void scrollH(const common::Vec2 paneSz, float wheel) noexcept;
void glDraw() noexcept;
void resize(const common::Vec2 &sz) noexcept;
const NostalgiaGraphic &img() const;
const NostalgiaPalette &pal() const;
bool updated() const noexcept;
void ackUpdate() noexcept;
protected:
void saveItem() override;
void saveItem();
void getFillPixels(bool *pixels, common::Point pt, int oldColor) const;
@@ -149,22 +153,12 @@ class TileSheetEditor: public studio::Editor {
[[nodiscard]]
ox::String palettePath(const ox::String &palettePath) const;
void drawTileSheet(const common::Vec2 &fbSize) noexcept;
void drawPalettePicker() noexcept;
void clickPixel(const common::Vec2 &paneSize, const common::Vec2 &clickPos) noexcept;
// slots
public:
ox::Error colorSelected() noexcept;
ox::Error setColorTable() noexcept;
// slots
private:
ox::Error updateAfterClicked() noexcept;
};
}