[nostalgia/core/studio] Decouple core TileSheetEditor from ImGui
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ox/model/def.hpp>
|
||||
|
||||
#include <nostalgia/common/bounds.hpp>
|
||||
#include <nostalgia/common/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 common::Vec2 &fbSize) noexcept;
|
||||
|
||||
void drawPalettePicker() noexcept;
|
||||
|
||||
// slots
|
||||
public:
|
||||
ox::Error colorSelected() noexcept;
|
||||
|
||||
ox::Error setColorTable() noexcept;
|
||||
|
||||
// slots
|
||||
private:
|
||||
ox::Error updateAfterClicked() noexcept;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user