diff --git a/CMakeLists.txt b/CMakeLists.txt index 08706381..b49d469e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,11 +51,13 @@ if(BUILDCORE_TARGET STREQUAL "gba") else() include_directories( SYSTEM + deps/glfw/deps deps/glfw/include deps/imgui deps/imgui/backends deps/nfde/src/include ) + add_subdirectory(deps/glad) add_subdirectory(deps/glfw) add_subdirectory(deps/imgui) add_subdirectory(deps/lodepng) diff --git a/src/nostalgia/core/CMakeLists.txt b/src/nostalgia/core/CMakeLists.txt index 884de654..c840b7f6 100644 --- a/src/nostalgia/core/CMakeLists.txt +++ b/src/nostalgia/core/CMakeLists.txt @@ -1,9 +1,4 @@ if(NOT NOSTALGIA_BUILD_TYPE STREQUAL "GBA") - if(APPLE) - find_package(OpenGL REQUIRED) - else() - set(OPENGL_gl_LIBRARY GL) - endif() set( NOSTALGIA_CORE_IMPL_SRC glfw/clipboard.cpp @@ -15,7 +10,7 @@ if(NOT NOSTALGIA_BUILD_TYPE STREQUAL "GBA") ) set( NOSTALGIA_CORE_IMPL_LIBS - ${OPENGL_gl_LIBRARY} + glad glfw imgui OxEvent diff --git a/src/nostalgia/core/studio/tilesheeteditormodel.cpp b/src/nostalgia/core/studio/tilesheeteditormodel.cpp index 7d73b706..f74e8a0e 100644 --- a/src/nostalgia/core/studio/tilesheeteditormodel.cpp +++ b/src/nostalgia/core/studio/tilesheeteditormodel.cpp @@ -2,14 +2,15 @@ * Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved. */ -#include -#include -#include +#include #include #include #include +#include +#include + #include "tilesheeteditormodel.hpp" namespace nostalgia::core { @@ -102,7 +103,7 @@ class DrawCommand: public TileSheetCommand { m_img = img; auto &subsheet = m_img->getSubSheet(subSheetIdx); m_subSheetIdx = subSheetIdx; - m_changes.emplace_back(idx, subsheet.getPixel(m_img->bpp, idx)); + m_changes.emplace_back(static_cast(idx), subsheet.getPixel(m_img->bpp, idx)); m_palIdx = palIdx; } @@ -111,7 +112,7 @@ class DrawCommand: public TileSheetCommand { auto &subsheet = m_img->getSubSheet(subSheetIdx); m_subSheetIdx = subSheetIdx; for (const auto idx : idxList) { - m_changes.emplace_back(idx, subsheet.getPixel(m_img->bpp, idx)); + m_changes.emplace_back(static_cast(idx), subsheet.getPixel(m_img->bpp, idx)); } m_palIdx = palIdx; } @@ -124,7 +125,7 @@ class DrawCommand: public TileSheetCommand { return c.idx == idx; }); if (existing == m_changes.cend()) { - m_changes.emplace_back(idx, subsheet.getPixel(m_img->bpp, idx)); + m_changes.emplace_back(static_cast(idx), subsheet.getPixel(m_img->bpp, idx)); subsheet.setPixel(m_img->bpp, idx, m_palIdx); return true; } @@ -192,7 +193,7 @@ class CutPasteCommand: public TileSheetCommand { const auto dstPt = p.pt + dstStart; if (dstPt.x <= dstEnd.x && dstPt.y <= dstEnd.y) { const auto idx = subsheet.idx(dstPt); - m_changes.emplace_back(idx, p.colorIdx, subsheet.getPixel(m_img->bpp, idx)); + m_changes.emplace_back(static_cast(idx), p.colorIdx, subsheet.getPixel(m_img->bpp, idx)); } } } @@ -240,7 +241,7 @@ class AddSubSheetCommand: public TileSheetCommand { m_addedSheets.push_back(idx); } else { auto idx = m_parentIdx; - idx.emplace_back(0); + idx.emplace_back(0u); m_addedSheets.push_back(idx); idx.back().value = 1; m_addedSheets.push_back(idx); @@ -562,7 +563,7 @@ void TileSheetEditorModel::cut() { } void TileSheetEditorModel::copy() { - auto cb = ox::make_unique();; + auto cb = ox::make_unique(); for (int y = m_selectionBounds.y; y <= m_selectionBounds.y2(); ++y) { for (int x = m_selectionBounds.x; x <= m_selectionBounds.x2(); ++x) { auto pt = geo::Point(x, y); @@ -608,7 +609,7 @@ void TileSheetEditorModel::drawCommand(const geo::Point &pt, std::size_t palIdx) if (m_ongoingDrawCommand) { m_updated = m_updated || m_ongoingDrawCommand->append(idx); } else if (activeSubSheet.getPixel(m_img.bpp, idx) != palIdx) { - pushCommand(new DrawCommand(&m_img, m_activeSubsSheetIdx, idx, palIdx)); + pushCommand(new DrawCommand(&m_img, m_activeSubsSheetIdx, idx, static_cast(palIdx))); } } @@ -729,7 +730,7 @@ ox::Error TileSheetEditorModel::saveFile() noexcept { bool TileSheetEditorModel::pixelSelected(std::size_t idx) const noexcept { const auto s = activeSubSheet(); - const auto pt = idxToPt(idx, s->columns); + const auto pt = idxToPt(static_cast(idx), s->columns); return m_selectionBounds.contains(pt); } diff --git a/src/nostalgia/glutils/CMakeLists.txt b/src/nostalgia/glutils/CMakeLists.txt index 7f7f15f6..f89b12f2 100644 --- a/src/nostalgia/glutils/CMakeLists.txt +++ b/src/nostalgia/glutils/CMakeLists.txt @@ -7,17 +7,10 @@ if(NOT MSVC) target_compile_options(NostalgiaGlUtils PRIVATE -Wsign-conversion) endif() -if(APPLE) - find_package(OpenGL REQUIRED) -else() - set(OPENGL_gl_LIBRARY GL) -endif() -find_package(glad REQUIRED) - target_link_libraries( NostalgiaGlUtils PUBLIC OxStd - glad::glad + glad ) install( diff --git a/src/nostalgia/glutils/glutils.hpp b/src/nostalgia/glutils/glutils.hpp index ee142542..942ac514 100644 --- a/src/nostalgia/glutils/glutils.hpp +++ b/src/nostalgia/glutils/glutils.hpp @@ -14,7 +14,6 @@ #include #else #include -#include #endif #include