Squashed 'deps/nostalgia/' changes from 84205879..0c0ccd1a
0c0ccd1a [nostalgia/core/studio] Cleanup scratchpad code 1b629da8 [ox/std] Make Vector::contains always noexcept 32e4702d [ox] Improve hasing and MaybeView 6b47133c [nostalgia] Cleanup StudioModules 0764720f [nostalgia,olympic] Update for Ox changes 78955376 [glutils] Update for Ox changes a00a0bd2 [ox] Rename BString to IString ed4f0e1f [nostalgia,olympic] Replace oxIgnoreError with std::ignore ea1feb72 [ox] Remove oxIgnoreError e9a6a096 [ox] Run liccor d7f30975 Merge commit 'c0baf7efca0e4c3a86a018ad2564d9df7b07c133' eeb2a5a1 [olympic/studio] Add new ImGui util functions 453f2750 [nostalgia/core/studio] Cleanup context types 189ba4c5 [olympic/studio] Make studio::run static 05773808 [olympic] Change TypeId building to use constexpr globals 272eabc7 [nostalgia/core/opengl] Unbind vertex arrays when done with them a0256669 [glutils] Remove trailing whitespace 6808adc8 [ox/std] Replace ox::ignore with std::ignore abc076d6 [ox/std] Cleanup 1b790a34 [ox/std] Fix Signed_c and Unsigned_c 92202716 [nostalgia/core] Update pack transforms to use ModelTypeId_v 7941a514 [ox/model] Add constexpr ModelTypeId_v 0c09c530 [ox/std] Fix sfmt constexpr problems 3ff91af8 [ox/std] Sort of fix custom assert 79b42e1d [ox/std] Fix some Vector constexpr problems 5eec9085 [ox/std] Add nodiscard to some string functions af7c8956 [ox/std] Add ox::ignore git-subtree-dir: deps/nostalgia git-subtree-split: 0c0ccd1a692169d99beb8c238b8b2c466e81a13d
This commit is contained in:
@ -28,11 +28,11 @@ void panic(const char *file, int line, const char *panicMsg, ox::Error const&err
|
||||
ox::heapmgr::initHeap(HEAP_BEGIN, HEAP_END);
|
||||
auto tctx = turbine::init(keel::loadRomFs("").unwrap(), "Nostalgia").unwrap();
|
||||
auto ctx = init(*tctx).unwrap();
|
||||
oxIgnoreError(initGfx(*ctx, {}));
|
||||
oxIgnoreError(initConsole(*ctx));
|
||||
std::ignore = initGfx(*ctx, {});
|
||||
std::ignore = initConsole(*ctx);
|
||||
setBgStatus(*ctx, 0, true);
|
||||
clearBg(*ctx, 0);
|
||||
ox::BString<23> serr = "Error code: ";
|
||||
ox::IString<23> serr = "Error code: ";
|
||||
serr += static_cast<int64_t>(err);
|
||||
puts(*ctx, 32 + 1, 1, "SADNESS...");
|
||||
puts(*ctx, 32 + 1, 4, "UNEXPECTED STATE:");
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
class KeelModule: public keel::Module {
|
||||
static class: public keel::Module {
|
||||
private:
|
||||
NostalgiaPaletteToPaletteV1Converter m_nostalgiaPaletteToPaletteV1Converter;
|
||||
PaletteV1ToPaletteV2Converter m_paletteV1ToPaletteV2Converter;
|
||||
@ -62,11 +62,11 @@ class KeelModule: public keel::Module {
|
||||
oxRequire(hdr, keel::readAssetHeader(buff));
|
||||
auto const typeId = ox::buildTypeId(
|
||||
hdr.clawHdr.typeName, hdr.clawHdr.typeVersion, hdr.clawHdr.typeParams);
|
||||
if (typeId == ox::buildTypeId<TileSheetV1>() ||
|
||||
typeId == ox::buildTypeId<TileSheetV2>() ||
|
||||
typeId == ox::buildTypeId<TileSheetV3>() ||
|
||||
typeId == ox::buildTypeId<TileSheetV4>()) {
|
||||
oxReturnError(keel::convertBuffToBuff<core::CompactTileSheet>(
|
||||
if (typeId == ox::ModelTypeId_v<TileSheetV1> ||
|
||||
typeId == ox::ModelTypeId_v<TileSheetV2> ||
|
||||
typeId == ox::ModelTypeId_v<TileSheetV3> ||
|
||||
typeId == ox::ModelTypeId_v<TileSheetV4>) {
|
||||
oxReturnError(keel::convertBuffToBuff<CompactTileSheet>(
|
||||
ctx, buff, ox::ClawFormat::Metal).moveTo(buff));
|
||||
}
|
||||
return {};
|
||||
@ -75,19 +75,18 @@ class KeelModule: public keel::Module {
|
||||
oxRequire(hdr, keel::readAssetHeader(buff));
|
||||
auto const typeId = ox::buildTypeId(
|
||||
hdr.clawHdr.typeName, hdr.clawHdr.typeVersion, hdr.clawHdr.typeParams);
|
||||
if (typeId == ox::buildTypeId<NostalgiaPalette>() ||
|
||||
typeId == ox::buildTypeId<PaletteV1>()) {
|
||||
oxReturnError(keel::convertBuffToBuff<core::Palette>(
|
||||
if (typeId == ox::ModelTypeId_v<NostalgiaPalette> ||
|
||||
typeId == ox::ModelTypeId_v<PaletteV1>) {
|
||||
oxReturnError(keel::convertBuffToBuff<Palette>(
|
||||
ctx, buff, ox::ClawFormat::Metal).moveTo(buff));
|
||||
}
|
||||
return {};
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
} mod;
|
||||
|
||||
static const KeelModule mod;
|
||||
const keel::Module *keelModule() noexcept {
|
||||
keel::Module const*keelModule() noexcept {
|
||||
return &mod;
|
||||
}
|
||||
|
||||
|
@ -239,6 +239,7 @@ static void initSpritesBufferset(Context &ctx) noexcept {
|
||||
glEnableVertexAttribArray(texCoordAttr);
|
||||
glVertexAttribPointer(texCoordAttr, 2, GL_FLOAT, GL_FALSE, SpriteVertexVboRowLength * sizeof(float),
|
||||
std::bit_cast<void*>(uintptr_t{4 * sizeof(float)}));
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
static void initBackgroundBufferset(
|
||||
@ -272,6 +273,7 @@ static void initBackgroundBufferset(
|
||||
glVertexAttribPointer(
|
||||
palBankAttr, 1, GL_FLOAT, GL_FALSE, BgVertexVboRowLength * sizeof(float),
|
||||
std::bit_cast<void*>(uintptr_t{6 * sizeof(float)}));
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
static glutils::GLTexture createTexture(
|
||||
@ -301,6 +303,7 @@ static void drawBackground(CBB &cbb) noexcept {
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, cbb.tex);
|
||||
glDrawElements(GL_TRIANGLES, static_cast<GLsizei>(cbb.elements.size()), GL_UNSIGNED_INT, nullptr);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
static void drawBackgrounds(
|
||||
@ -354,6 +357,7 @@ static void drawSprites(Context &ctx, ox::Size const&renderSz) noexcept {
|
||||
// draw
|
||||
glBindTexture(GL_TEXTURE_2D, sb.tex);
|
||||
glDrawElements(GL_TRIANGLES, static_cast<GLsizei>(sb.elements.size()), GL_UNSIGNED_INT, nullptr);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
static void loadPalette(
|
||||
|
@ -19,7 +19,7 @@ void AddPageCommand::redo() noexcept {
|
||||
}
|
||||
|
||||
void AddPageCommand::undo() noexcept {
|
||||
oxIgnoreError(m_pal.pages.erase(static_cast<std::size_t>(m_pal.pages.size() - 1)));
|
||||
std::ignore = m_pal.pages.erase(static_cast<std::size_t>(m_pal.pages.size() - 1));
|
||||
}
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ void DuplicatePageCommand::redo() noexcept {
|
||||
|
||||
void DuplicatePageCommand::undo() noexcept {
|
||||
m_page = std::move(m_pal.pages[m_dstIdx]);
|
||||
oxIgnoreError(m_pal.pages.erase(static_cast<std::size_t>(m_dstIdx)));
|
||||
std::ignore = m_pal.pages.erase(static_cast<std::size_t>(m_dstIdx));
|
||||
}
|
||||
|
||||
size_t DuplicatePageCommand::insertIdx() const noexcept {
|
||||
@ -62,7 +62,7 @@ int RemovePageCommand::commandId() const noexcept {
|
||||
|
||||
void RemovePageCommand::redo() noexcept {
|
||||
m_page = std::move(m_pal.pages[m_idx]);
|
||||
oxIgnoreError(m_pal.pages.erase(static_cast<std::size_t>(m_idx)));
|
||||
std::ignore = m_pal.pages.erase(static_cast<std::size_t>(m_idx));
|
||||
}
|
||||
|
||||
void RemovePageCommand::undo() noexcept {
|
||||
@ -86,7 +86,7 @@ void AddColorCommand::redo() noexcept {
|
||||
}
|
||||
|
||||
void AddColorCommand::undo() noexcept {
|
||||
oxIgnoreError(m_pal->pages[m_page].erase(static_cast<std::size_t>(m_idx)));
|
||||
std::ignore = m_pal->pages[m_page].erase(static_cast<std::size_t>(m_idx));
|
||||
}
|
||||
|
||||
|
||||
@ -102,7 +102,7 @@ int RemoveColorCommand::commandId() const noexcept {
|
||||
}
|
||||
|
||||
void RemoveColorCommand::redo() noexcept {
|
||||
oxIgnoreError(m_pal->pages[m_page].erase(static_cast<std::size_t>(m_idx)));
|
||||
std::ignore = m_pal->pages[m_page].erase(static_cast<std::size_t>(m_idx));
|
||||
}
|
||||
|
||||
void RemoveColorCommand::undo() noexcept {
|
||||
@ -171,8 +171,8 @@ void MoveColorCommand::undo() noexcept {
|
||||
|
||||
void MoveColorCommand::moveColor(int idx, int offset) noexcept {
|
||||
const auto c = m_pal->pages[m_page][static_cast<std::size_t>(idx)];
|
||||
oxIgnoreError(m_pal->pages[m_page].erase(static_cast<std::size_t>(idx)));
|
||||
std::ignore = m_pal->pages[m_page].erase(static_cast<std::size_t>(idx));
|
||||
m_pal->pages[m_page].insert(static_cast<std::size_t>(idx + offset), c);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
class StudioModule: public studio::Module {
|
||||
static class: public studio::Module {
|
||||
ox::Vector<studio::EditorMaker> editors(studio::StudioContext &ctx) const noexcept final {
|
||||
return {
|
||||
studio::editorMaker<TileSheetEditorImGui>(ctx, FileExt_ng),
|
||||
@ -25,9 +25,8 @@ class StudioModule: public studio::Module {
|
||||
out.emplace_back(ox::make<studio::ItemMakerT<core::Palette>>("Palette", "Palettes", FileExt_npal));
|
||||
return out;
|
||||
}
|
||||
};
|
||||
} mod;
|
||||
|
||||
static StudioModule mod;
|
||||
const studio::Module *studioModule() noexcept {
|
||||
return &mod;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ core::PaletteChangeCommand::PaletteChangeCommand(
|
||||
m_img(img),
|
||||
m_idx(std::move(idx)),
|
||||
m_oldPalette(m_img.defaultPalette),
|
||||
m_newPalette(ox::FileAddress(ox::sfmt<ox::BString<43>>("uuid://{}", newPalette))) {
|
||||
m_newPalette(ox::FileAddress(ox::sfmt<ox::IString<43>>("uuid://{}", newPalette))) {
|
||||
}
|
||||
|
||||
void PaletteChangeCommand::redo() noexcept {
|
||||
|
@ -81,7 +81,7 @@ TileSheetEditorImGui::TileSheetEditorImGui(studio::StudioContext &sctx, ox::CRSt
|
||||
m_tctx(m_sctx.tctx),
|
||||
m_view(m_sctx, path, *undoStack()),
|
||||
m_model(m_view.model()) {
|
||||
oxIgnoreError(setPaletteSelection());
|
||||
std::ignore = setPaletteSelection();
|
||||
// connect signal/slots
|
||||
undoStack()->changeTriggered.connect(this, &TileSheetEditorImGui::markUnsavedChanges);
|
||||
m_subsheetEditor.inputSubmitted.connect(this, &TileSheetEditorImGui::updateActiveSubsheet);
|
||||
@ -342,13 +342,14 @@ void TileSheetEditorImGui::drawTileSheet(ox::Vec2 const&fbSize) noexcept {
|
||||
} else if (m_view.updated()) {
|
||||
m_view.ackUpdate();
|
||||
}
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_framebuffer);
|
||||
// clear screen and draw
|
||||
glViewport(0, 0, fbSizei.width, fbSizei.height);
|
||||
m_view.draw();
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
{
|
||||
glutils::FrameBufferBind const frameBufferBind(m_framebuffer);
|
||||
// clear screen and draw
|
||||
glViewport(0, 0, fbSizei.width, fbSizei.height);
|
||||
m_view.draw();
|
||||
}
|
||||
ImGui::Image(
|
||||
std::bit_cast<ImTextureID>(uintptr_t{m_framebuffer.color.id}),
|
||||
ig::toImTextureID(m_framebuffer.color.id),
|
||||
static_cast<ImVec2>(fbSize),
|
||||
ImVec2(0, 1),
|
||||
ImVec2(1, 0));
|
||||
@ -439,7 +440,7 @@ void TileSheetEditorImGui::drawPaletteSelector() noexcept {
|
||||
ImGui::PushID(static_cast<int>(i));
|
||||
// Column: color idx
|
||||
ImGui::TableNextColumn();
|
||||
auto const label = ox::BString<8>() + (i + 1);
|
||||
auto const label = ox::IString<8>() + (i + 1);
|
||||
auto const rowSelected = i == m_view.palIdx();
|
||||
if (ImGui::Selectable(label.c_str(), rowSelected, ImGuiSelectableFlags_SpanAllColumns)) {
|
||||
m_view.setPalIdx(i);
|
||||
|
@ -28,7 +28,7 @@ class TileSheetEditorImGui: public studio::Editor {
|
||||
private:
|
||||
class SubSheetEditor {
|
||||
private:
|
||||
ox::BString<100> m_name;
|
||||
ox::IString<100> m_name;
|
||||
int m_cols = 0;
|
||||
int m_rows = 0;
|
||||
bool m_show = false;
|
||||
|
@ -14,6 +14,7 @@ namespace nostalgia::core {
|
||||
TileSheetEditorView::TileSheetEditorView(studio::StudioContext &sctx, ox::StringView path, studio::UndoStack &undoStack):
|
||||
m_model(sctx, path, undoStack),
|
||||
m_pixelsDrawer(m_model) {
|
||||
glBindVertexArray(0);
|
||||
// build shaders
|
||||
oxThrowError(m_pixelsDrawer.buildShader());
|
||||
oxThrowError(m_pixelGridDrawer.buildShader());
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
namespace nostalgia::scene {
|
||||
|
||||
class SceneModule: public keel::Module {
|
||||
static class: public keel::Module {
|
||||
private:
|
||||
SceneDocToSceneStaticConverter m_sceneDocToSceneStaticConverter;
|
||||
|
||||
@ -42,9 +42,8 @@ class SceneModule: public keel::Module {
|
||||
};
|
||||
}
|
||||
|
||||
};
|
||||
} mod;
|
||||
|
||||
static const SceneModule mod;
|
||||
const keel::Module *keelModule() noexcept {
|
||||
return &mod;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace nostalgia::scene {
|
||||
|
||||
constexpr ox::StringLiteral FileExt_nscn("nscn");
|
||||
|
||||
class StudioModule: public studio::Module {
|
||||
static class: public studio::Module {
|
||||
public:
|
||||
ox::Vector<studio::EditorMaker> editors(studio::StudioContext &ctx) const noexcept override {
|
||||
return {
|
||||
@ -21,9 +21,8 @@ class StudioModule: public studio::Module {
|
||||
ox::Vector<ox::UPtr<studio::ItemMaker>> out;
|
||||
return out;
|
||||
}
|
||||
};
|
||||
} mod;
|
||||
|
||||
static StudioModule const mod;
|
||||
const studio::Module *studioModule() noexcept {
|
||||
return &mod;
|
||||
}
|
||||
|
Reference in New Issue
Block a user