[nostalgia,studio] Cleanup Studio
This commit is contained in:
@@ -4,13 +4,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ox/std/stringliteral.hpp>
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
constexpr auto TileWidth = 8;
|
||||
constexpr auto TileHeight = 8;
|
||||
constexpr auto PixelsPerTile = TileWidth * TileHeight;
|
||||
|
||||
constexpr auto FileExt_ng = "ng";
|
||||
constexpr auto FileExt_npal = "npal";
|
||||
constexpr ox::StringLiteral FileExt_ng("ng");
|
||||
constexpr ox::StringLiteral FileExt_npal("npal");
|
||||
|
||||
}
|
||||
|
@@ -140,7 +140,7 @@ void PaletteEditorImGui::draw(turbine::Context*) noexcept {
|
||||
|
||||
ox::Error PaletteEditorImGui::saveItem() noexcept {
|
||||
const auto sctx = applicationData<studio::StudioContext>(*m_ctx);
|
||||
return sctx->project->writeObj(m_itemPath, &m_pal);
|
||||
return sctx->project->writeObj(m_itemPath, m_pal);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -14,18 +14,8 @@ namespace nostalgia::core {
|
||||
class StudioModule: public studio::Module {
|
||||
ox::Vector<studio::EditorMaker> editors(turbine::Context *ctx) const noexcept final {
|
||||
return {
|
||||
{
|
||||
{FileExt_ng},
|
||||
[ctx](ox::CRStringView path) -> ox::Result<studio::BaseEditor*> {
|
||||
return ox::makeCatch<TileSheetEditorImGui>(ctx, ox::String(path));
|
||||
}
|
||||
},
|
||||
{
|
||||
{FileExt_npal},
|
||||
[ctx](ox::CRStringView path) -> ox::Result<studio::BaseEditor*> {
|
||||
return ox::makeCatch<PaletteEditorImGui>(ctx, ox::String(path));
|
||||
}
|
||||
}
|
||||
studio::editorMaker<TileSheetEditorImGui>(ctx, FileExt_ng),
|
||||
studio::editorMaker<PaletteEditorImGui>(ctx, FileExt_npal),
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -773,7 +773,7 @@ void TileSheetEditorModel::ackUpdate() noexcept {
|
||||
|
||||
ox::Error TileSheetEditorModel::saveFile() noexcept {
|
||||
const auto sctx = applicationData<studio::StudioContext>(*m_ctx);
|
||||
return sctx->project->writeObj(m_path, &m_img);
|
||||
return sctx->project->writeObj(m_path, m_img);
|
||||
}
|
||||
|
||||
bool TileSheetEditorModel::pixelSelected(std::size_t idx) const noexcept {
|
||||
|
@@ -49,7 +49,7 @@ void SceneEditorImGui::onActivated() noexcept {
|
||||
|
||||
ox::Error SceneEditorImGui::saveItem() noexcept {
|
||||
const auto sctx = applicationData<studio::StudioContext>(m_ctx);
|
||||
oxReturnError(sctx->project->writeObj(m_itemPath, &m_editor.scene()));
|
||||
oxReturnError(sctx->project->writeObj(m_itemPath, m_editor.scene()));
|
||||
oxReturnError(m_ctx.keelCtx.assetManager.setAsset(m_itemPath, m_editor.scene()));
|
||||
return {};
|
||||
}
|
||||
|
Reference in New Issue
Block a user