[nostalgia,studio] Cleanup Studio

This commit is contained in:
2023-11-30 00:57:47 -06:00
parent c085c50b30
commit e543131f0d
9 changed files with 75 additions and 47 deletions

View File

@@ -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");
}

View File

@@ -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);
}
}

View File

@@ -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),
};
}

View File

@@ -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 {

View File

@@ -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 {};
}