Merge commit 'dff9f81e073bb994d5ce96a6eaa1bfa547f1fdf4'
Some checks are pending
Build / build (push) Waiting to run
Some checks are pending
Build / build (push) Waiting to run
This commit is contained in:
commit
e8a0ce88c5
@ -65,7 +65,7 @@ static void testKeyEventHandler(turbine::Context &tctx, turbine::Key key, bool d
|
|||||||
|
|
||||||
[[maybe_unused]]
|
[[maybe_unused]]
|
||||||
static ox::Error runTest(turbine::Context &tctx) {
|
static ox::Error runTest(turbine::Context &tctx) {
|
||||||
constexpr ox::StringView TileSheetAddr{"/TileSheets/Charset.ng"};
|
constexpr ox::StringView TileSheetAddr{"/TileSheets/Charset.nts"};
|
||||||
constexpr ox::StringView PaletteAddr{"/Palettes/Chester.npal"};
|
constexpr ox::StringView PaletteAddr{"/Palettes/Chester.npal"};
|
||||||
OX_REQUIRE_M(cctx, gfx::init(tctx));
|
OX_REQUIRE_M(cctx, gfx::init(tctx));
|
||||||
turbine::setApplicationData(tctx, cctx.get());
|
turbine::setApplicationData(tctx, cctx.get());
|
||||||
@ -91,10 +91,10 @@ static ox::Error runTileSheetSetTest(turbine::Context &tctx) {
|
|||||||
gfx::TileSheetSet const set{
|
gfx::TileSheetSet const set{
|
||||||
.bpp = 4,
|
.bpp = 4,
|
||||||
.entries = {
|
.entries = {
|
||||||
{ .tilesheet = ox::StringLiteral{"/TileSheets/Chester.ng"}, .sections{{.begin = 0, .tiles = 1}} },
|
{ .tilesheet = ox::StringLiteral{"/TileSheets/Chester.nts"}, .sections{{.begin = 0, .tiles = 1}} },
|
||||||
{ .tilesheet = ox::StringLiteral{"/TileSheets/AB.ng"}, .sections{{.begin = 0, .tiles = 2}} },
|
{ .tilesheet = ox::StringLiteral{"/TileSheets/AB.nts"}, .sections{{.begin = 0, .tiles = 2}} },
|
||||||
{ .tilesheet = ox::StringLiteral{"/TileSheets/CD.ng"}, .sections{{.begin = 0, .tiles = 2}} },
|
{ .tilesheet = ox::StringLiteral{"/TileSheets/CD.nts"}, .sections{{.begin = 0, .tiles = 2}} },
|
||||||
{ .tilesheet = ox::StringLiteral{"/TileSheets/AB.ng"}, .sections{{.begin = 1, .tiles = 1}} },
|
{ .tilesheet = ox::StringLiteral{"/TileSheets/AB.nts"}, .sections{{.begin = 1, .tiles = 1}} },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
constexpr auto bgPalBank = 1;
|
constexpr auto bgPalBank = 1;
|
||||||
|
@ -63,8 +63,11 @@ namespace detail {
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr auto makeLoader(Context &ctx) {
|
constexpr auto makeLoader(Context &ctx) {
|
||||||
return [&ctx](ox::StringViewCR assetId) -> ox::Result<T> {
|
return [&ctx](ox::StringViewCR assetId) -> ox::Result<T> {
|
||||||
OX_REQUIRE(p, ctx.uuidToPath.at(assetId));
|
auto const p = ctx.uuidToPath.at(assetId);
|
||||||
OX_REQUIRE(buff, ctx.rom->read(*p));
|
if (p.error) {
|
||||||
|
return ox::Error{1, "Asset ID not found"};
|
||||||
|
}
|
||||||
|
OX_REQUIRE(buff, ctx.rom->read(*p.value));
|
||||||
auto [obj, err] = readAsset<T>(buff);
|
auto [obj, err] = readAsset<T>(buff);
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err != ox::Error_ClawTypeVersionMismatch && err != ox::Error_ClawTypeMismatch) {
|
if (err != ox::Error_ClawTypeVersionMismatch && err != ox::Error_ClawTypeMismatch) {
|
||||||
|
@ -76,8 +76,11 @@ ox::Error buildUuidMap(Context &ctx) noexcept {
|
|||||||
|
|
||||||
ox::Result<ox::UUID> pathToUuid(Context &ctx, ox::StringViewCR path) noexcept {
|
ox::Result<ox::UUID> pathToUuid(Context &ctx, ox::StringViewCR path) noexcept {
|
||||||
#ifndef OX_BARE_METAL
|
#ifndef OX_BARE_METAL
|
||||||
OX_REQUIRE(out, ctx.pathToUuid.at(path));
|
auto const out = ctx.pathToUuid.at(path);
|
||||||
return *out;
|
if (out.error) {
|
||||||
|
return ox::Error{1, "Path not found"};
|
||||||
|
}
|
||||||
|
return *out.value;
|
||||||
#else
|
#else
|
||||||
return ox::Error(1, "UUID to path conversion not supported on this platform");
|
return ox::Error(1, "UUID to path conversion not supported on this platform");
|
||||||
#endif
|
#endif
|
||||||
|
@ -54,6 +54,7 @@ void NewMenu::draw(StudioContext &sctx) noexcept {
|
|||||||
case Stage::NewItemType:
|
case Stage::NewItemType:
|
||||||
drawNewItemType(sctx);
|
drawNewItemType(sctx);
|
||||||
break;
|
break;
|
||||||
|
case Stage::NewItemTransitioningToPath:
|
||||||
case Stage::NewItemPath:
|
case Stage::NewItemPath:
|
||||||
drawNewItemPath(sctx);
|
drawNewItemPath(sctx);
|
||||||
break;
|
break;
|
||||||
@ -91,8 +92,8 @@ void NewMenu::drawNewItemType(StudioContext const&sctx) noexcept {
|
|||||||
}, m_types.size(), m_selectedType, {200, 100});
|
}, m_types.size(), m_selectedType, {200, 100});
|
||||||
auto const&im = *m_types[m_selectedType];
|
auto const&im = *m_types[m_selectedType];
|
||||||
drawFirstPageButtons(im.itemTemplates().size() == 1 ?
|
drawFirstPageButtons(im.itemTemplates().size() == 1 ?
|
||||||
Stage::NewItemPath : Stage::NewItemTemplate);
|
Stage::NewItemTransitioningToPath : Stage::NewItemTemplate);
|
||||||
if (m_stage == Stage::NewItemPath || m_stage == Stage::NewItemTemplate) {
|
if (m_stage == Stage::NewItemTransitioningToPath || m_stage == Stage::NewItemTemplate) {
|
||||||
if (m_useDefaultPath) {
|
if (m_useDefaultPath) {
|
||||||
std::ignore = m_explorer.setSelectedPath(im.defaultPath());
|
std::ignore = m_explorer.setSelectedPath(im.defaultPath());
|
||||||
}
|
}
|
||||||
@ -108,16 +109,18 @@ void NewMenu::drawNewItemTemplate(StudioContext const&sctx) noexcept {
|
|||||||
ig::ListBox("Template", [&](size_t const i) -> ox::CStringView {
|
ig::ListBox("Template", [&](size_t const i) -> ox::CStringView {
|
||||||
return templates[i]->name();
|
return templates[i]->name();
|
||||||
}, templates.size(), m_selectedTemplate, {200, 100});
|
}, templates.size(), m_selectedTemplate, {200, 100});
|
||||||
drawButtons(Stage::NewItemPath);
|
drawButtons(Stage::NewItemTransitioningToPath);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewMenu::drawNewItemPath(StudioContext &sctx) noexcept {
|
void NewMenu::drawNewItemPath(StudioContext &sctx) noexcept {
|
||||||
setSize({380, 340});
|
setSize({380, 340});
|
||||||
drawWindow(sctx.tctx, m_open, [this, &sctx] {
|
drawWindow(sctx.tctx, m_open, [this, &sctx] {
|
||||||
if (m_selectedType < m_types.size()) {
|
if (m_stage == Stage::NewItemTransitioningToPath) [[unlikely]] {
|
||||||
ig::InputText("Name", m_itemName);
|
ImGui::SetKeyboardFocusHere();
|
||||||
|
m_stage = Stage::NewItemPath;
|
||||||
}
|
}
|
||||||
|
ig::InputText("Name", m_itemName);
|
||||||
ImGui::NewLine();
|
ImGui::NewLine();
|
||||||
ImGui::Text("Path");
|
ImGui::Text("Path");
|
||||||
auto const vp = ImGui::GetContentRegionAvail();
|
auto const vp = ImGui::GetContentRegionAvail();
|
||||||
|
@ -20,6 +20,7 @@ class NewMenu final: public Popup {
|
|||||||
Closed,
|
Closed,
|
||||||
Opening,
|
Opening,
|
||||||
NewItemType,
|
NewItemType,
|
||||||
|
NewItemTransitioningToPath,
|
||||||
NewItemPath,
|
NewItemPath,
|
||||||
NewItemTemplate,
|
NewItemTemplate,
|
||||||
};
|
};
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
* Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
|
|
||||||
#include "projectexplorer.hpp"
|
#include "projectexplorer.hpp"
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <ox/std/memory.hpp>
|
|
||||||
#include <ox/std/string.hpp>
|
|
||||||
|
|
||||||
#include <turbine/context.hpp>
|
|
||||||
|
|
||||||
#include <studio/filetreemodel.hpp>
|
|
||||||
|
|
||||||
namespace studio {
|
|
||||||
|
|
||||||
}
|
|
@ -2,7 +2,6 @@ add_library(
|
|||||||
Studio
|
Studio
|
||||||
configio.cpp
|
configio.cpp
|
||||||
editor.cpp
|
editor.cpp
|
||||||
projectfilepicker.cpp
|
|
||||||
filetreemodel.cpp
|
filetreemodel.cpp
|
||||||
imguiutil.cpp
|
imguiutil.cpp
|
||||||
module.cpp
|
module.cpp
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <studio/filetreemodel.hpp>
|
|
||||||
#include <studio/projectfilepicker.hpp>
|
|
||||||
|
|
||||||
namespace studio {
|
|
||||||
|
|
||||||
class ProjectFilePicker: public FileExplorer {
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit ProjectFilePicker(keel::Context &kctx) noexcept: FileExplorer{kctx} {}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user