[glutils,nostalgia,studio] Fix Xcode build errors

This commit is contained in:
Gary Talent 2023-06-06 00:18:13 -05:00
parent 7bccfc8a00
commit 13b2df57fe
6 changed files with 34 additions and 14 deletions

View File

@ -70,7 +70,10 @@ void bind(const FrameBuffer &fb) noexcept {
} }
static ox::Result<GLShader> buildShader(GLuint shaderType, const GLchar *src, ox::CRStringView shaderName) noexcept { static ox::Result<GLShader> buildShader(
GLuint shaderType,
const GLchar *src,
ox::CRStringView shaderName) noexcept {
GLShader shader(glCreateShader(shaderType)); GLShader shader(glCreateShader(shaderType));
glShaderSource(shader, 1, &src, nullptr); glShaderSource(shader, 1, &src, nullptr);
glCompileShader(shader); glCompileShader(shader);
@ -99,7 +102,10 @@ ox::Result<GLProgram> buildShaderProgram(const GLchar *vert, const GLchar *frag,
return prgm; return prgm;
} }
ox::Result<GLProgram> buildShaderProgram(const ox::String &vert, const ox::String &frag, const ox::String &geo) noexcept { ox::Result<GLProgram> 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()); return buildShaderProgram(vert.c_str(), frag.c_str(), geo.c_str());
} }

View File

@ -154,7 +154,14 @@ static void initBackgroundBufferObjects(Context *ctx, glutils::BufferSet *bg) no
const auto i = bgVertexRow(x, y); const auto i = bgVertexRow(x, y);
auto vbo = &bg->vertices[i * static_cast<std::size_t>(BgVertexVboLength)]; auto vbo = &bg->vertices[i * static_cast<std::size_t>(BgVertexVboLength)];
auto ebo = &bg->elements[i * static_cast<std::size_t>(BgVertexEboLength)]; auto ebo = &bg->elements[i * static_cast<std::size_t>(BgVertexEboLength)];
setTileBufferObject(ctx, i * BgVertexVboRows, static_cast<float>(x), static_cast<float>(y), 0, vbo, ebo); setTileBufferObject(
ctx,
static_cast<unsigned>(i * BgVertexVboRows),
static_cast<float>(x),
static_cast<float>(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<GlContext&>(*ctx); auto &gctx = static_cast<GlContext&>(*ctx);
auto &bg = gctx.cbbs[static_cast<std::size_t>(bgIdx)]; auto &bg = gctx.cbbs[static_cast<std::size_t>(bgIdx)];
initBackgroundBufferObjects(&gctx, &bg); 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 vbo = &bg.vertices[i * renderer::BgVertexVboLength];
auto ebo = &bg.elements[i * renderer::BgVertexEboLength]; auto ebo = &bg.elements[i * renderer::BgVertexEboLength];
renderer::setTileBufferObject( renderer::setTileBufferObject(
ctx, i * renderer::BgVertexVboRows, ctx,
static_cast<float>(x), static_cast<float>(y), static_cast<unsigned>(i * renderer::BgVertexVboRows),
tile, vbo, ebo); static_cast<float>(x),
static_cast<float>(y),
tile,
vbo,
ebo);
bg.updated = true; bg.updated = true;
} }

View File

@ -52,13 +52,14 @@ void PaletteEditorImGui::draw(turbine::Context*) noexcept {
{ {
const auto sz = ImVec2(70, 24); const auto sz = ImVec2(70, 24);
if (ImGui::Button("Add", sz)) { if (ImGui::Button("Add", sz)) {
undoStack()->push(ox::make<AddColorCommand>(&m_pal, 0, m_pal.colors.size())); const auto colorSz = static_cast<int>(m_pal.colors.size());
undoStack()->push(ox::make<AddColorCommand>(&m_pal, 0, colorSz));
} }
ImGui::SameLine(); ImGui::SameLine();
ImGui::BeginDisabled(m_selectedRow >= m_pal.colors.size()); ImGui::BeginDisabled(m_selectedRow >= m_pal.colors.size());
{ {
if (ImGui::Button("Remove", sz)) { if (ImGui::Button("Remove", sz)) {
undoStack()->push(ox::make<RemoveColorCommand>(&m_pal, m_pal.colors[static_cast<std::size_t>(m_selectedRow)], m_selectedRow)); undoStack()->push(ox::make<RemoveColorCommand>(&m_pal, m_pal.colors[static_cast<std::size_t>(m_selectedRow)], static_cast<int>(m_selectedRow)));
m_selectedRow = ox::min(m_pal.colors.size() - 1, m_selectedRow); m_selectedRow = ox::min(m_pal.colors.size() - 1, m_selectedRow);
} }
ImGui::SameLine(); ImGui::SameLine();
@ -134,7 +135,7 @@ void PaletteEditorImGui::draw(turbine::Context*) noexcept {
ImGui::InputInt("Blue", &b, 1, 5); ImGui::InputInt("Blue", &b, 1, 5);
const auto newColor = color16(r, g, b, a); const auto newColor = color16(r, g, b, a);
if (c != newColor) { if (c != newColor) {
undoStack()->push(ox::make<UpdateColorCommand>(&m_pal, m_selectedRow, c, newColor)); undoStack()->push(ox::make<UpdateColorCommand>(&m_pal, static_cast<int>(m_selectedRow), c, newColor));
} }
} }
ImGui::EndChild(); ImGui::EndChild();

View File

@ -279,7 +279,8 @@ struct TileSheet {
*/ */
[[nodiscard]] [[nodiscard]]
constexpr unsigned pixelCnt(int8_t pBpp) const noexcept { constexpr unsigned pixelCnt(int8_t pBpp) const noexcept {
return pBpp == 4 ? pixels.size() * 2 : pixels.size(); const auto pixelsSize = static_cast<unsigned>(pixels.size());
return pBpp == 4 ? pixelsSize * 2 : pixelsSize;
} }
/** /**

View File

@ -60,7 +60,7 @@ void NewMenu::drawNewItemType(turbine::Context *ctx) noexcept {
items[i] = im->name.c_str(); items[i] = im->name.c_str();
++i; ++i;
} }
ImGui::ListBox("Item Type", &m_selectedType, items.get(), m_types.size()); ImGui::ListBox("Item Type", &m_selectedType, items.get(), static_cast<int>(m_types.size()));
drawFirstPageButtons(); drawFirstPageButtons();
ImGui::EndPopup(); ImGui::EndPopup();
}); });

View File

@ -44,7 +44,8 @@ ox::Result<ox::String> saveFile(const ox::Vector<FDFilterItem> &filters) noexcep
filterItems[i].spec = f.spec.data(); filterItems[i].spec = f.spec.data();
++i; ++i;
} }
return toResult(NFD::SaveDialog(path, filterItems.data(), filterItems.size()), path); const auto filterItemsCnt = static_cast<nfdfiltersize_t>(filterItems.size());
return toResult(NFD::SaveDialog(path, filterItems.data(), filterItemsCnt), path);
} }
ox::Result<ox::String> chooseDirectory() noexcept { ox::Result<ox::String> chooseDirectory() noexcept {