/* * Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved. */ #pragma once #include #include #include #include #include #include #include "tilesheetpixelgrid.hpp" #include "tilesheetpixels.hpp" #include "tilesheeteditor.hpp" namespace nostalgia::core { class TileSheetEditorImGui: public studio::Editor { private: ox::String m_itemPath; ox::String m_itemName; glutils::FrameBuffer m_framebuffer; TileSheetEditor m_tileSheetEditor; float m_palViewWidth = 200; geo::Vec2 m_prevMouseDownPos; public: TileSheetEditorImGui(Context *ctx, const ox::String &path); ~TileSheetEditorImGui() override = default; ox::String itemName() const noexcept override; ox::String itemDisplayName() const noexcept override; void exportFile() override; void cut() override; void copy() override; void paste() override; void draw(core::Context*) noexcept override; studio::UndoStack *undoStack() noexcept final; protected: void saveItem() override; private: void setPalette(); void saveState(); void restoreState(); [[nodiscard]] ox::String paletteName(const ox::String &palettePath) const; [[nodiscard]] ox::String palettePath(const ox::String &palettePath) const; void drawTileSheet(const geo::Vec2 &fbSize) noexcept; void drawPalettePicker() noexcept; // slots public: ox::Error colorSelected() noexcept; ox::Error setColorTable() noexcept; // slots private: ox::Error updateAfterClicked() noexcept; }; }