82 lines
1.5 KiB
C++
82 lines
1.5 KiB
C++
/*
|
|
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <ox/model/def.hpp>
|
|
|
|
#include <nostalgia/geo/bounds.hpp>
|
|
#include <nostalgia/geo/vec.hpp>
|
|
#include <nostalgia/core/gfx.hpp>
|
|
#include <nostalgia/glutils/glutils.hpp>
|
|
#include <nostalgia/studio/studio.hpp>
|
|
|
|
#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;
|
|
|
|
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;
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|