From 34221f086cf1a3c34c359dd08444820f3e471047 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 12 Feb 2022 14:32:10 -0600 Subject: [PATCH] [nostalgia] Update for compatibility with Ox changes --- src/nostalgia/core/glfw/gfx.cpp | 8 ++++++-- src/nostalgia/core/studio/tilesheeteditor.cpp | 2 +- src/nostalgia/core/studio/tilesheeteditor.hpp | 2 +- src/nostalgia/studio/lib/configio.hpp | 16 ++++++++-------- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/nostalgia/core/glfw/gfx.cpp b/src/nostalgia/core/glfw/gfx.cpp index 7ce5f2c0..b88302f9 100644 --- a/src/nostalgia/core/glfw/gfx.cpp +++ b/src/nostalgia/core/glfw/gfx.cpp @@ -6,6 +6,8 @@ #include #include +#include + #include #include @@ -23,7 +25,9 @@ static void handleKeyPress(Context *ctx, int key) noexcept { switch (key) { case GLFW_KEY_ESCAPE: case GLFW_KEY_Q: - oxIgnoreError(shutdown(ctx)); + if constexpr(ox::defines::Debug) { + oxIgnoreError(shutdown(ctx)); + } break; default: break; @@ -47,7 +51,7 @@ ox::Error initGfx(Context *ctx) noexcept { glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); - if constexpr(ox::defines::OS == ox::defines::OS::Darwin) { + if constexpr(ox::defines::OS == ox::OS::Darwin) { glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); } glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); diff --git a/src/nostalgia/core/studio/tilesheeteditor.cpp b/src/nostalgia/core/studio/tilesheeteditor.cpp index 34d3677b..c67895db 100644 --- a/src/nostalgia/core/studio/tilesheeteditor.cpp +++ b/src/nostalgia/core/studio/tilesheeteditor.cpp @@ -69,7 +69,7 @@ void TileSheetEditor::draw(core::Context*) noexcept { const auto wheel = io.MouseWheel; const auto wheelh = io.MouseWheelH; if (wheel != 0) { - const auto zoomMod = ox::defines::OS == ox::defines::OS::Darwin ? io.KeySuper : io.KeyCtrl; + const auto zoomMod = ox::defines::OS == ox::OS::Darwin ? io.KeySuper : io.KeyCtrl; const auto pixelSize = m_pixelsDrawer.pixelSize(paneSize); const ImVec2 sheetSize(pixelSize.x * static_cast(m_img.columns) * TileWidth, pixelSize.y * static_cast(m_img.rows) * TileHeight); diff --git a/src/nostalgia/core/studio/tilesheeteditor.hpp b/src/nostalgia/core/studio/tilesheeteditor.hpp index 00dd5fda..7e3e7891 100644 --- a/src/nostalgia/core/studio/tilesheeteditor.hpp +++ b/src/nostalgia/core/studio/tilesheeteditor.hpp @@ -86,7 +86,7 @@ struct TileSheetClipboard { }; template -ox::Error model(T *io, TileSheetClipboard *b) { +constexpr ox::Error model(T *io, TileSheetClipboard *b) noexcept { io->template setTypeInfo(); oxReturnError(io->field("pixels", &b->m_pixels)); oxReturnError(io->field("p1", &b->m_p1)); diff --git a/src/nostalgia/studio/lib/configio.hpp b/src/nostalgia/studio/lib/configio.hpp index 5a3fcf22..65e53c40 100644 --- a/src/nostalgia/studio/lib/configio.hpp +++ b/src/nostalgia/studio/lib/configio.hpp @@ -21,16 +21,16 @@ namespace nostalgia::studio { constexpr auto ConfigDir = [] { switch (ox::defines::OS) { - case ox::defines::OS::Darwin: + case ox::OS::Darwin: return "{}/Library/Preferences/{}"; - case ox::defines::OS::DragonFlyBSD: - case ox::defines::OS::FreeBSD: - case ox::defines::OS::Linux: - case ox::defines::OS::NetBSD: - case ox::defines::OS::OpenBSD: + case ox::OS::DragonFlyBSD: + case ox::OS::FreeBSD: + case ox::OS::Linux: + case ox::OS::NetBSD: + case ox::OS::OpenBSD: return "{}/.config/{}"; - case ox::defines::OS::BareMetal: - case ox::defines::OS::Windows: + case ox::OS::BareMetal: + case ox::OS::Windows: return ""; } }();