From 13b2df57fe51a5ce0483135f06fab2e63000ab37 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Tue, 6 Jun 2023 00:18:13 -0500 Subject: [PATCH] [glutils,nostalgia,studio] Fix Xcode build errors --- src/glutils/glutils.cpp | 10 +++++++-- src/nostalgia/core/opengl/gfx.cpp | 21 ++++++++++++++----- .../core/studio/paletteeditor-imgui.cpp | 7 ++++--- src/nostalgia/core/tilesheet.hpp | 3 ++- src/studio/applib/src/newmenu.cpp | 2 +- src/studio/modlib/src/filedialog_nfd.cpp | 5 +++-- 6 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/glutils/glutils.cpp b/src/glutils/glutils.cpp index bcdca14c..a3e322fc 100644 --- a/src/glutils/glutils.cpp +++ b/src/glutils/glutils.cpp @@ -70,7 +70,10 @@ void bind(const FrameBuffer &fb) noexcept { } -static ox::Result buildShader(GLuint shaderType, const GLchar *src, ox::CRStringView shaderName) noexcept { +static ox::Result buildShader( + GLuint shaderType, + const GLchar *src, + ox::CRStringView shaderName) noexcept { GLShader shader(glCreateShader(shaderType)); glShaderSource(shader, 1, &src, nullptr); glCompileShader(shader); @@ -99,7 +102,10 @@ ox::Result buildShaderProgram(const GLchar *vert, const GLchar *frag, return prgm; } -ox::Result buildShaderProgram(const ox::String &vert, const ox::String &frag, const ox::String &geo) noexcept { +ox::Result buildShaderProgram( + const ox::String &vert, + const ox::String &frag, + const ox::String &geo) noexcept { return buildShaderProgram(vert.c_str(), frag.c_str(), geo.c_str()); } diff --git a/src/nostalgia/core/opengl/gfx.cpp b/src/nostalgia/core/opengl/gfx.cpp index a21beadd..ba6b0201 100644 --- a/src/nostalgia/core/opengl/gfx.cpp +++ b/src/nostalgia/core/opengl/gfx.cpp @@ -154,7 +154,14 @@ static void initBackgroundBufferObjects(Context *ctx, glutils::BufferSet *bg) no const auto i = bgVertexRow(x, y); auto vbo = &bg->vertices[i * static_cast(BgVertexVboLength)]; auto ebo = &bg->elements[i * static_cast(BgVertexEboLength)]; - setTileBufferObject(ctx, i * BgVertexVboRows, static_cast(x), static_cast(y), 0, vbo, ebo); + setTileBufferObject( + ctx, + static_cast(i * BgVertexVboRows), + static_cast(x), + static_cast(y), + 0, + vbo, + ebo); } } } @@ -437,7 +444,7 @@ void setBgStatus(Context *ctx, unsigned bg, bool status) noexcept { } -void clearTileLayer(Context *ctx, unsigned bgIdx) noexcept { +void glearTileLayer(Context *ctx, unsigned bgIdx) noexcept { auto &gctx = static_cast(*ctx); auto &bg = gctx.cbbs[static_cast(bgIdx)]; initBackgroundBufferObjects(&gctx, &bg); @@ -526,9 +533,13 @@ void setTile(Context *ctx, unsigned bgIdx, int column, int row, uint8_t tile) no auto vbo = &bg.vertices[i * renderer::BgVertexVboLength]; auto ebo = &bg.elements[i * renderer::BgVertexEboLength]; renderer::setTileBufferObject( - ctx, i * renderer::BgVertexVboRows, - static_cast(x), static_cast(y), - tile, vbo, ebo); + ctx, + static_cast(i * renderer::BgVertexVboRows), + static_cast(x), + static_cast(y), + tile, + vbo, + ebo); bg.updated = true; } diff --git a/src/nostalgia/core/studio/paletteeditor-imgui.cpp b/src/nostalgia/core/studio/paletteeditor-imgui.cpp index a5425c5d..8abbd57d 100644 --- a/src/nostalgia/core/studio/paletteeditor-imgui.cpp +++ b/src/nostalgia/core/studio/paletteeditor-imgui.cpp @@ -52,13 +52,14 @@ void PaletteEditorImGui::draw(turbine::Context*) noexcept { { const auto sz = ImVec2(70, 24); if (ImGui::Button("Add", sz)) { - undoStack()->push(ox::make(&m_pal, 0, m_pal.colors.size())); + const auto colorSz = static_cast(m_pal.colors.size()); + undoStack()->push(ox::make(&m_pal, 0, colorSz)); } ImGui::SameLine(); ImGui::BeginDisabled(m_selectedRow >= m_pal.colors.size()); { if (ImGui::Button("Remove", sz)) { - undoStack()->push(ox::make(&m_pal, m_pal.colors[static_cast(m_selectedRow)], m_selectedRow)); + undoStack()->push(ox::make(&m_pal, m_pal.colors[static_cast(m_selectedRow)], static_cast(m_selectedRow))); m_selectedRow = ox::min(m_pal.colors.size() - 1, m_selectedRow); } ImGui::SameLine(); @@ -134,7 +135,7 @@ void PaletteEditorImGui::draw(turbine::Context*) noexcept { ImGui::InputInt("Blue", &b, 1, 5); const auto newColor = color16(r, g, b, a); if (c != newColor) { - undoStack()->push(ox::make(&m_pal, m_selectedRow, c, newColor)); + undoStack()->push(ox::make(&m_pal, static_cast(m_selectedRow), c, newColor)); } } ImGui::EndChild(); diff --git a/src/nostalgia/core/tilesheet.hpp b/src/nostalgia/core/tilesheet.hpp index ff1895f2..39e4a864 100644 --- a/src/nostalgia/core/tilesheet.hpp +++ b/src/nostalgia/core/tilesheet.hpp @@ -279,7 +279,8 @@ struct TileSheet { */ [[nodiscard]] constexpr unsigned pixelCnt(int8_t pBpp) const noexcept { - return pBpp == 4 ? pixels.size() * 2 : pixels.size(); + const auto pixelsSize = static_cast(pixels.size()); + return pBpp == 4 ? pixelsSize * 2 : pixelsSize; } /** diff --git a/src/studio/applib/src/newmenu.cpp b/src/studio/applib/src/newmenu.cpp index cc43951f..711573b0 100644 --- a/src/studio/applib/src/newmenu.cpp +++ b/src/studio/applib/src/newmenu.cpp @@ -60,7 +60,7 @@ void NewMenu::drawNewItemType(turbine::Context *ctx) noexcept { items[i] = im->name.c_str(); ++i; } - ImGui::ListBox("Item Type", &m_selectedType, items.get(), m_types.size()); + ImGui::ListBox("Item Type", &m_selectedType, items.get(), static_cast(m_types.size())); drawFirstPageButtons(); ImGui::EndPopup(); }); diff --git a/src/studio/modlib/src/filedialog_nfd.cpp b/src/studio/modlib/src/filedialog_nfd.cpp index 363cca2a..1727054a 100644 --- a/src/studio/modlib/src/filedialog_nfd.cpp +++ b/src/studio/modlib/src/filedialog_nfd.cpp @@ -44,7 +44,8 @@ ox::Result saveFile(const ox::Vector &filters) noexcep filterItems[i].spec = f.spec.data(); ++i; } - return toResult(NFD::SaveDialog(path, filterItems.data(), filterItems.size()), path); + const auto filterItemsCnt = static_cast(filterItems.size()); + return toResult(NFD::SaveDialog(path, filterItems.data(), filterItemsCnt), path); } ox::Result chooseDirectory() noexcept { @@ -53,4 +54,4 @@ ox::Result chooseDirectory() noexcept { return toResult(NFD::PickFolder(path), path); } -} \ No newline at end of file +}