Compare commits
No commits in common. "ae40487990b462e9eb082e75f0ab4ed04ae94f62" and "0de428a2e588d3360b98aa7e00c2498d5a54019b" have entirely different histories.
ae40487990
...
0de428a2e5
2
deps/ox/src/ox/std/stringparam.hpp
vendored
2
deps/ox/src/ox/std/stringparam.hpp
vendored
@ -20,8 +20,6 @@ class StringParam {
|
|||||||
constexpr StringParam(StringParam &&o) noexcept: m_value{std::move(o.m_value)} {}
|
constexpr StringParam(StringParam &&o) noexcept: m_value{std::move(o.m_value)} {}
|
||||||
constexpr StringParam(char const*value) noexcept: m_value{value} {}
|
constexpr StringParam(char const*value) noexcept: m_value{value} {}
|
||||||
constexpr StringParam(detail::BaseStringView const&value) noexcept: m_value{value} {}
|
constexpr StringParam(detail::BaseStringView const&value) noexcept: m_value{value} {}
|
||||||
template<size_t sz>
|
|
||||||
constexpr StringParam(ox::IString<sz> const&value) noexcept: m_value{value} {}
|
|
||||||
constexpr StringParam(ox::String const&value) noexcept: m_value{value} {}
|
constexpr StringParam(ox::String const&value) noexcept: m_value{value} {}
|
||||||
constexpr StringParam(ox::String &&value) noexcept: m_value{std::move(value)} {}
|
constexpr StringParam(ox::String &&value) noexcept: m_value{std::move(value)} {}
|
||||||
constexpr operator ox::String() && noexcept { return std::move(m_value); }
|
constexpr operator ox::String() && noexcept { return std::move(m_value); }
|
||||||
|
@ -426,8 +426,6 @@ ox::Error resizeSubsheet(TileSheet::SubSheet &ss, ox::Size const&sz) noexcept;
|
|||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
TileSheet::SubSheetIdx validateSubSheetIdx(TileSheet const&ts, TileSheet::SubSheetIdx idx) noexcept;
|
TileSheet::SubSheetIdx validateSubSheetIdx(TileSheet const&ts, TileSheet::SubSheetIdx idx) noexcept;
|
||||||
|
|
||||||
ox::Result<TileSheet::SubSheetIdx> getSubSheetIdx(TileSheet const &ts, SubSheetId pId) noexcept;
|
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
TileSheet::SubSheet &getSubSheet(
|
TileSheet::SubSheet &getSubSheet(
|
||||||
ox::SpanView<uint32_t> const&idx,
|
ox::SpanView<uint32_t> const&idx,
|
||||||
|
@ -388,17 +388,6 @@ ox::Error TileSheetEditorImGui::saveItem() noexcept {
|
|||||||
return m_model.saveFile();
|
return m_model.saveFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditorImGui::navigateTo(ox::StringViewCR arg) noexcept {
|
|
||||||
auto const subSheetId = strToInt(arg);
|
|
||||||
if (subSheetId.error) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (auto const [val, err] = getSubSheetIdx(m_model.img(), subSheetId.value);
|
|
||||||
!err) {
|
|
||||||
setActiveSubsheet(val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TileSheetEditorImGui::showSubsheetEditor() noexcept {
|
void TileSheetEditorImGui::showSubsheetEditor() noexcept {
|
||||||
auto const&sheet = m_model.activeSubSheet();
|
auto const&sheet = m_model.activeSubSheet();
|
||||||
if (!sheet.subsheets.empty()) {
|
if (!sheet.subsheets.empty()) {
|
||||||
@ -462,7 +451,7 @@ void TileSheetEditorImGui::drawTileSheet(ox::Vec2 const&fbSize) noexcept {
|
|||||||
if (wheelh != 0) {
|
if (wheelh != 0) {
|
||||||
m_view.scrollH(fbSize, wheelh);
|
m_view.scrollH(fbSize, wheelh);
|
||||||
}
|
}
|
||||||
if (ImGui::IsMouseClicked(0) && m_prevMouseDownPos != mousePos) {
|
if (ImGui::IsMouseDown(0) && m_prevMouseDownPos != mousePos) {
|
||||||
m_prevMouseDownPos = mousePos;
|
m_prevMouseDownPos = mousePos;
|
||||||
switch (m_tool) {
|
switch (m_tool) {
|
||||||
case TileSheetTool::Draw:
|
case TileSheetTool::Draw:
|
||||||
|
@ -87,8 +87,6 @@ class TileSheetEditorImGui: public studio::Editor {
|
|||||||
protected:
|
protected:
|
||||||
ox::Error saveItem() noexcept override;
|
ox::Error saveItem() noexcept override;
|
||||||
|
|
||||||
void navigateTo(ox::StringViewCR arg) noexcept override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void showSubsheetEditor() noexcept;
|
void showSubsheetEditor() noexcept;
|
||||||
|
|
||||||
|
@ -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 "nostalgia/gfx/tilesheet.hpp"
|
|
||||||
|
|
||||||
#include <ox/std/size.hpp>
|
#include <ox/std/size.hpp>
|
||||||
#include <ox/std/vector.hpp>
|
#include <ox/std/vector.hpp>
|
||||||
|
|
||||||
@ -189,28 +187,6 @@ TileSheet::SubSheetIdx validateSubSheetIdx(TileSheet const&ts, TileSheet::SubShe
|
|||||||
return validateSubSheetIdx(std::move(idx), 0, ts.subsheet);
|
return validateSubSheetIdx(std::move(idx), 0, ts.subsheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ox::Error getSubSheetIdx(TileSheet::SubSheet const &ss, SubSheetId const pId, TileSheet::SubSheetIdx &idx) noexcept {
|
|
||||||
if (ss.id == pId) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
for (uint32_t i{}; auto const &sub : ss.subsheets) {
|
|
||||||
idx.emplace_back(i);
|
|
||||||
auto const err = getSubSheetIdx(sub, pId, idx);
|
|
||||||
if (!err) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
idx.pop_back();
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
return ox::Error{1, "SubSheet not found"};
|
|
||||||
}
|
|
||||||
|
|
||||||
ox::Result<TileSheet::SubSheetIdx> getSubSheetIdx(TileSheet const &ts, SubSheetId const pId) noexcept {
|
|
||||||
ox::Result<TileSheet::SubSheetIdx> out;
|
|
||||||
OX_RETURN_ERROR(getSubSheetIdx(ts.subsheet, pId, out.value));
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && __GNUC__ >= 13
|
#if defined(__GNUC__) && __GNUC__ >= 13
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wdangling-reference"
|
#pragma GCC diagnostic ignored "-Wdangling-reference"
|
||||||
|
@ -31,15 +31,7 @@ static bool shutdownHandler(turbine::Context &ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void navigateTo(Context &ctx, ox::StringParam filePath, ox::StringParam navArgs) noexcept {
|
void navigateTo(Context &ctx, ox::StringParam filePath, ox::StringParam navArgs) noexcept {
|
||||||
ox::String path = std::move(filePath);
|
ctx.ui.navigateTo(std::move(filePath), std::move(navArgs));
|
||||||
if (beginsWith(path, "uuid://")) {
|
|
||||||
auto [p, err] = keel::uuidUrlToPath(keelCtx(ctx), path);
|
|
||||||
if (err) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
path = p;
|
|
||||||
}
|
|
||||||
ctx.ui.navigateTo(std::move(path), std::move(navArgs));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ig {
|
namespace ig {
|
||||||
|
@ -27,6 +27,6 @@ inline keel::Context &keelCtx(Context &ctx) noexcept {
|
|||||||
return keelCtx(ctx.tctx);
|
return keelCtx(ctx.tctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void navigateTo(Context &ctx, ox::StringParam filePath, ox::StringParam navArgs = "") noexcept;
|
void navigateTo(Context &ctx, ox::StringParam filePath, ox::StringParam navArgs) noexcept;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user