diff --git a/src/nostalgia/modules/gfx/include/nostalgia/gfx/color.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/color.hpp index f59dc82c..6c4ade33 100644 --- a/src/nostalgia/modules/gfx/include/nostalgia/gfx/color.hpp +++ b/src/nostalgia/modules/gfx/include/nostalgia/gfx/color.hpp @@ -19,10 +19,10 @@ using Color32 = uint32_t; [[nodiscard]] constexpr Color32 toColor32(Color16 nc) noexcept { - const auto r = static_cast(((nc & 0b0000000000011111) >> 0) * 8); - const auto g = static_cast(((nc & 0b0000001111100000) >> 5) * 8); - const auto b = static_cast(((nc & 0b0111110000000000) >> 10) * 8); - const auto a = static_cast(255); + auto const r = static_cast(((nc & 0b0000000000011111) >> 0) * 8); + auto const g = static_cast(((nc & 0b0000001111100000) >> 5) * 8); + auto const b = static_cast(((nc & 0b0111110000000000) >> 10) * 8); + auto const a = static_cast(255); return r | (g << 8) | (b << 16) | (a << 24); } diff --git a/src/nostalgia/modules/gfx/include/nostalgia/gfx/gfx.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/gfx.hpp index ccde7b09..e80d3ba9 100644 --- a/src/nostalgia/modules/gfx/include/nostalgia/gfx/gfx.hpp +++ b/src/nostalgia/modules/gfx/include/nostalgia/gfx/gfx.hpp @@ -111,7 +111,7 @@ struct InitParams { uint_t glBlocksPerSprite = 64; }; -ox::Result> init(turbine::Context &tctx, InitParams const¶ms = {}) noexcept; +ox::Result> init(turbine::Context &tctx, InitParams const ¶ms = {}) noexcept; [[nodiscard]] int tileColumns(Context&) noexcept; @@ -122,12 +122,12 @@ int tileRows(Context&) noexcept; ox::Error loadBgPalette( Context &ctx, size_t palBank, - CompactPalette const&palette, + CompactPalette const &palette, size_t page = 0) noexcept; ox::Error loadSpritePalette( Context &ctx, - CompactPalette const&palette, + CompactPalette const &palette, size_t page = 0) noexcept; ox::Error loadBgPalette( @@ -138,7 +138,7 @@ ox::Error loadBgPalette( ox::Error loadBgPalette( Context &ctx, size_t palBank, - ox::FileAddress const&paletteAddr) noexcept; + ox::FileAddress const &paletteAddr) noexcept; ox::Error loadSpritePalette( Context &ctx, @@ -146,12 +146,12 @@ ox::Error loadSpritePalette( ox::Error loadSpritePalette( Context &ctx, - ox::FileAddress const&paletteAddr) noexcept; + ox::FileAddress const &paletteAddr) noexcept; ox::Error loadBgTileSheet( Context &ctx, unsigned cbb, - TileSheetSet const&set) noexcept; + TileSheetSet const &set) noexcept; void clearCbb(Context &ctx, unsigned cbb) noexcept; @@ -160,7 +160,7 @@ void clearCbbs(Context &ctx) noexcept; ox::Error loadBgTileSheet( Context &ctx, unsigned cbb, - CompactTileSheet const&ts, + CompactTileSheet const &ts, size_t dstTileIdx, size_t srcTileIdx, size_t tileCnt) noexcept; @@ -176,7 +176,7 @@ ox::Error loadBgTileSheet( ox::Error loadBgTileSheet( Context &ctx, unsigned cbb, - ox::FileAddress const&tsAddr, + ox::FileAddress const &tsAddr, size_t dstTileIdx, size_t srcTileIdx, size_t tileCnt) noexcept; @@ -184,24 +184,24 @@ ox::Error loadBgTileSheet( ox::Error loadBgTileSheet( Context &ctx, unsigned cbb, - CompactTileSheet const&ts, - ox::Optional const&paletteBank = {}) noexcept; + CompactTileSheet const &ts, + ox::Optional const &paletteBank = {}) noexcept; ox::Error loadBgTileSheet( Context &ctx, unsigned cbb, ox::StringViewCR tilesheetPath, - ox::Optional const&paletteBank) noexcept; + ox::Optional const &paletteBank) noexcept; ox::Error loadBgTileSheet( Context &ctx, unsigned cbb, - ox::FileAddress const&tilesheetAddr, - ox::Optional const&paletteBank = {}) noexcept; + ox::FileAddress const &tilesheetAddr, + ox::Optional const &paletteBank = {}) noexcept; ox::Error loadSpriteTileSheet( Context &ctx, - CompactTileSheet const&ts, + CompactTileSheet const &ts, bool loadDefaultPalette) noexcept; ox::Error loadSpriteTileSheet( @@ -211,16 +211,16 @@ ox::Error loadSpriteTileSheet( ox::Error loadSpriteTileSheet( Context &ctx, - ox::FileAddress const&tilesheetAddr, + ox::FileAddress const &tilesheetAddr, bool loadDefaultPalette = false) noexcept; ox::Error loadSpriteTileSheet( Context &ctx, - TileSheetSet const&set) noexcept; + TileSheetSet const &set) noexcept; void setBgTile(Context &ctx, uint_t bgIdx, int column, int row, unsigned tile, unsigned palBank = 0) noexcept; -void setBgTile(Context &ctx, uint_t bgIdx, int column, int row, BgTile const&tile) noexcept; +void setBgTile(Context &ctx, uint_t bgIdx, int column, int row, BgTile const &tile) noexcept; void clearBg(Context &ctx, uint_t bgIdx) noexcept; @@ -242,7 +242,7 @@ void hideSprite(Context &ctx, unsigned) noexcept; void showSprite(Context &ctx, unsigned) noexcept; -void setSprite(Context &ctx, uint_t idx, Sprite const&sprite) noexcept; +void setSprite(Context &ctx, uint_t idx, Sprite const &sprite) noexcept; [[nodiscard]] uint_t spriteCount(Context const &ctx) noexcept; @@ -260,7 +260,7 @@ constexpr ox::CStringView GlslVersion = "#version 330"; [[nodiscard]] ox::Size drawSize(int scale = 5) noexcept; -void draw(gfx::Context &ctx, ox::Size const&renderSz) noexcept; +void draw(gfx::Context &ctx, ox::Size const &renderSz) noexcept; void draw(gfx::Context&, int scale = 5) noexcept; diff --git a/src/nostalgia/modules/gfx/include/nostalgia/gfx/ptidxconv.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/ptidxconv.hpp index 8e2548ce..3ec062a5 100644 --- a/src/nostalgia/modules/gfx/include/nostalgia/gfx/ptidxconv.hpp +++ b/src/nostalgia/modules/gfx/include/nostalgia/gfx/ptidxconv.hpp @@ -12,15 +12,15 @@ namespace nostalgia::gfx { [[nodiscard]] constexpr std::size_t ptToIdx(int x, int y, int c, int scale = 1) noexcept { - const auto tileWidth = TileWidth * scale; - const auto tileHeight = TileHeight * scale; - const auto pixelsPerTile = tileWidth * tileHeight; - const auto colLength = static_cast(pixelsPerTile); - const auto rowLength = static_cast(static_cast(c / tileWidth) * colLength); - const auto colStart = static_cast(colLength * static_cast(x / tileWidth)); - const auto rowStart = static_cast(rowLength * static_cast(y / tileHeight)); - const auto colOffset = static_cast(x % tileWidth); - const auto rowOffset = static_cast((y % tileHeight) * tileHeight); + auto const tileWidth = TileWidth * scale; + auto const tileHeight = TileHeight * scale; + auto const pixelsPerTile = tileWidth * tileHeight; + auto const colLength = static_cast(pixelsPerTile); + auto const rowLength = static_cast(static_cast(c / tileWidth) * colLength); + auto const colStart = static_cast(colLength * static_cast(x / tileWidth)); + auto const rowStart = static_cast(rowLength * static_cast(y / tileHeight)); + auto const colOffset = static_cast(x % tileWidth); + auto const rowOffset = static_cast((y % tileHeight) * tileHeight); return static_cast(colStart + colOffset + rowStart + rowOffset); } @@ -31,19 +31,19 @@ constexpr std::size_t ptToIdx(const ox::Point &pt, int c, int scale = 1) noexcep [[nodiscard]] constexpr ox::Point idxToPt(int i, int c, int scale = 1) noexcept { - const auto tileWidth = TileWidth * scale; - const auto tileHeight = TileHeight * scale; - const auto pixelsPerTile = tileWidth * tileHeight; + auto const tileWidth = TileWidth * scale; + auto const tileHeight = TileHeight * scale; + auto const pixelsPerTile = tileWidth * tileHeight; // prevent divide by zeros if (!c) { ++c; } - const auto t = i / pixelsPerTile; // tile number - const auto iti = i % pixelsPerTile; // in tile index - const auto tc = t % c; // tile column - const auto tr = t / c; // tile row - const auto itx = iti % tileWidth; // in tile x - const auto ity = iti / tileHeight; // in tile y + auto const t = i / pixelsPerTile; // tile number + auto const iti = i % pixelsPerTile; // in tile index + auto const tc = t % c; // tile column + auto const tr = t / c; // tile row + auto const itx = iti % tileWidth; // in tile x + auto const ity = iti / tileHeight; // in tile y return { itx + tc * tileWidth, ity + tr * tileHeight, diff --git a/src/nostalgia/modules/gfx/src/gfx-gba.cpp b/src/nostalgia/modules/gfx/src/gfx-gba.cpp index ceea7d41..faea11bd 100644 --- a/src/nostalgia/modules/gfx/src/gfx-gba.cpp +++ b/src/nostalgia/modules/gfx/src/gfx-gba.cpp @@ -246,7 +246,11 @@ ox::Error loadSpriteTileSheet( } void setBgTile( - Context &ctx, uint_t const bgIdx, int const column, int const row, BgTile const &tile) noexcept { + Context &ctx, + uint_t const bgIdx, + int const column, + int const row, + BgTile const &tile) noexcept { auto const tileIdx = static_cast(row * tileColumns(ctx) + column); // see Tonc 9.3 MEM_BG_MAP[bgIdx][tileIdx] = @@ -286,7 +290,7 @@ void setBgBpp(Context&, unsigned const bgIdx, unsigned const bpp) noexcept { void setBgCbb(Context &ctx, unsigned const bgIdx, unsigned const cbbIdx) noexcept { auto &bgCtl = regBgCtl(bgIdx); - const auto &cbbData = ctx.cbbData[cbbIdx]; + auto const &cbbData = ctx.cbbData[cbbIdx]; teagba::bgSetBpp(bgCtl, cbbData.bpp); teagba::bgSetCbb(bgCtl, cbbIdx); } @@ -341,13 +345,13 @@ uint_t spriteCount(Context const &) noexcept { namespace ox { -void panic(const char *file, int line, const char *panicMsg, ox::Error const &err) noexcept { +void panic(char const *file, int line, char const *panicMsg, ox::Error const &err) noexcept { using namespace nostalgia::gfx; // reset heap to make sure we have enough memory to allocate context data OX_ALLOW_UNSAFE_BUFFERS_BEGIN - const auto heapBegin = reinterpret_cast(MEM_EWRAM_BEGIN); - const auto heapSz = (MEM_EWRAM_END - MEM_EWRAM_BEGIN) / 2; - const auto heapEnd = reinterpret_cast(MEM_EWRAM_BEGIN + heapSz); + auto const heapBegin = reinterpret_cast(MEM_EWRAM_BEGIN); + auto const heapSz = (MEM_EWRAM_END - MEM_EWRAM_BEGIN) / 2; + auto const heapEnd = reinterpret_cast(MEM_EWRAM_BEGIN + heapSz); ox::heapmgr::initHeap(heapBegin, heapEnd); OX_ALLOW_UNSAFE_BUFFERS_END auto tctx = turbine::init(keel::loadRomFs("").unwrap(), "Nostalgia").unwrap(); diff --git a/src/nostalgia/modules/gfx/src/gfx-opengl.cpp b/src/nostalgia/modules/gfx/src/gfx-opengl.cpp index 182d09bc..a3a17f31 100644 --- a/src/nostalgia/modules/gfx/src/gfx-opengl.cpp +++ b/src/nostalgia/modules/gfx/src/gfx-opengl.cpp @@ -287,7 +287,7 @@ static void initSpriteBufferObjects(Context const &ctx, glutils::BufferSet &bs) static void initBackgroundBufferObjects(glutils::BufferSet &bs) noexcept { for (auto x = 0u; x < TileColumns; ++x) { for (auto y = 0u; y < TileRows; ++y) { - const auto i = bgVertexRow(x, y); + auto const i = bgVertexRow(x, y); auto const vbo = ox::Span{bs.vertices} + i * static_cast(BgVertexVboLength); auto const ebo = ox::Span{bs.elements} @@ -387,7 +387,7 @@ static void initBackgroundBufferset( static glutils::GLTexture createTexture( GLsizei const w, GLsizei const h, - void const*pixels) noexcept { + void const *pixels) noexcept { GLuint texId = 0; glGenTextures(1, &texId); glutils::GLTexture tex(texId); @@ -425,22 +425,22 @@ static void drawBackground(CBB &cbb) noexcept { static void drawBackgrounds( Context &ctx, - ox::Size const&renderSz) noexcept { + ox::Size const &renderSz) noexcept { // load background shader and its uniforms glUseProgram(ctx.bgShader); - const auto uniformSrcImgSz = glGetUniformLocation(ctx.bgShader, "fSrcImgSz"); - const auto uniformXScale = static_cast(glGetUniformLocation(ctx.bgShader, "vXScale")); - const auto uniformTileHeight = static_cast(glGetUniformLocation(ctx.bgShader, "vTileHeight")); - const auto uniformBgIdx = static_cast(glGetUniformLocation(ctx.bgShader, "vBgIdx")); - const auto [wi, hi] = renderSz; - const auto wf = static_cast(wi); - const auto hf = static_cast(hi); + auto const uniformSrcImgSz = glGetUniformLocation(ctx.bgShader, "fSrcImgSz"); + auto const uniformXScale = static_cast(glGetUniformLocation(ctx.bgShader, "vXScale")); + auto const uniformTileHeight = static_cast(glGetUniformLocation(ctx.bgShader, "vTileHeight")); + auto const uniformBgIdx = static_cast(glGetUniformLocation(ctx.bgShader, "vBgIdx")); + auto const [wi, hi] = renderSz; + auto const wf = static_cast(wi); + auto const hf = static_cast(hi); glUniform1f(uniformXScale, hf / wf); auto bgIdx = 0.f; - for (const auto &bg : ctx.backgrounds) { + for (auto const &bg : ctx.backgrounds) { if (bg.enabled) { auto &cbb = ctx.cbbs[bg.cbbIdx]; - const auto tileRows = cbb.tex.height / (TileHeight * Scale); + auto const tileRows = cbb.tex.height / (TileHeight * Scale); glUniform1f(uniformTileHeight, 1.0f / static_cast(tileRows)); glUniform2f( uniformSrcImgSz, @@ -456,11 +456,11 @@ static void drawBackgrounds( static void drawSprites(Context &ctx, ox::Size const&renderSz) noexcept { glUseProgram(ctx.spriteShader); auto &sb = ctx.spriteBlocks; - const auto uniformXScale = glGetUniformLocation(ctx.bgShader, "vXScale"); - const auto uniformTileHeight = glGetUniformLocation(ctx.spriteShader, "vTileHeight"); - const auto [wi, hi] = renderSz; - const auto wf = static_cast(wi); - const auto hf = static_cast(hi); + auto const uniformXScale = glGetUniformLocation(ctx.bgShader, "vXScale"); + auto const uniformTileHeight = glGetUniformLocation(ctx.spriteShader, "vTileHeight"); + auto const [wi, hi] = renderSz; + auto const wf = static_cast(wi); + auto const hf = static_cast(hi); glUniform1f(uniformXScale, hf / wf); // update vbo glBindVertexArray(sb.vao); @@ -469,7 +469,7 @@ static void drawSprites(Context &ctx, ox::Size const&renderSz) noexcept { glutils::sendVbo(sb); } // set vTileHeight uniform - const auto tileRows = sb.tex.height / (TileHeight * Scale); + auto const tileRows = sb.tex.height / (TileHeight * Scale); glUniform1f(uniformTileHeight, 1.0f / static_cast(tileRows)); // draw glBindTexture(GL_TEXTURE_2D, sb.tex); @@ -493,7 +493,7 @@ static void loadPalette( // make first color transparent palette[palOffset + 3] = 0; glUseProgram(shaderPgrm); - const auto uniformPalette = static_cast(glGetUniformLocation(shaderPgrm, "fPalette")); + auto const uniformPalette = static_cast(glGetUniformLocation(shaderPgrm, "fPalette")); glUniform4fv(uniformPalette, ColorCnt, palette.data()); } @@ -526,12 +526,12 @@ static void setSprite( auto const uY = static_cast(s.y + 8) % 255 - 8; oxAssert(1 < ctx.spriteBlocks.vertices.size(), "vbo overflow"); oxAssert(1 < ctx.spriteBlocks.elements.size(), "ebo overflow"); - const auto spriteVboSz = ctx.blocksPerSprite * renderer::SpriteVertexVboLength; - const auto spriteEboSz = ctx.blocksPerSprite * renderer::SpriteVertexEboLength; + auto const spriteVboSz = ctx.blocksPerSprite * renderer::SpriteVertexVboLength; + auto const spriteEboSz = ctx.blocksPerSprite * renderer::SpriteVertexEboLength; auto const vboBase = spriteVboSz * idx; auto const eboBase = spriteEboSz * idx; auto i = 0u; - const auto set = [&](int xIt, int yIt, bool enabled) { + auto const set = [&](int xIt, int yIt, bool enabled) { auto const fX = static_cast(uX + xIt * 8) / 8; auto const fY = static_cast(uY + yIt * 8) / 8; auto const vboIdx = vboBase + renderer::SpriteVertexVboLength * i; @@ -576,10 +576,10 @@ static void setSprite( ox::Result> init(turbine::Context &tctx, InitParams const¶ms) noexcept { auto ctx = ox::make_unique(tctx, params); - const auto bgVshad = ox::sfmt(renderer::bgvshadTmpl, gl::GlslVersion); - const auto bgFshad = ox::sfmt(renderer::bgfshadTmpl, gl::GlslVersion); - const auto spriteVshad = ox::sfmt(renderer::spritevshadTmpl, gl::GlslVersion); - const auto spriteFshad = ox::sfmt(renderer::spritefshadTmpl, gl::GlslVersion); + auto const bgVshad = ox::sfmt(renderer::bgvshadTmpl, gl::GlslVersion); + auto const bgFshad = ox::sfmt(renderer::bgfshadTmpl, gl::GlslVersion); + auto const spriteVshad = ox::sfmt(renderer::spritevshadTmpl, gl::GlslVersion); + auto const spriteFshad = ox::sfmt(renderer::spritefshadTmpl, gl::GlslVersion); OX_RETURN_ERROR(glutils::buildShaderProgram(bgVshad, bgFshad).moveTo(ctx->bgShader)); OX_RETURN_ERROR( glutils::buildShaderProgram(spriteVshad, spriteFshad).moveTo(ctx->spriteShader)); @@ -603,12 +603,12 @@ struct TileSheetData { } }; -static ox::Result normalizeTileSheet( - CompactTileSheet const&ts) noexcept { +static ox::Result normalizeTileSheet + (CompactTileSheet const&ts) noexcept { const uint_t bytesPerTile = ts.bpp == 8 ? PixelsPerTile : PixelsPerTile / 2; - const auto tiles = ts.pixels.size() / bytesPerTile; + auto const tiles = ts.pixels.size() / bytesPerTile; constexpr int width = 8; - const int height = 8 * static_cast(tiles); + int const height = 8 * static_cast(tiles); ox::Vector pixels; if (bytesPerTile == 64) { // 8 BPP pixels.resize(ts.pixels.size()); @@ -779,13 +779,13 @@ void setBgTile( "nostalgia.gfx.setBgTile", "bgIdx: {}, column: {}, row: {}, tile: {}, palBank: {}", bgIdx, column, row, tile.tileIdx, tile.palBank); - const auto z = static_cast(bgIdx); - const auto y = static_cast(row); - const auto x = static_cast(column); - const auto i = renderer::bgVertexRow(x, y); + auto const z = static_cast(bgIdx); + auto const y = static_cast(row); + auto const x = static_cast(column); + auto const i = renderer::bgVertexRow(x, y); auto &cbb = ctx.cbbs[z]; - const auto vbo = ox::Span{cbb.vertices} + i * renderer::BgVertexVboLength; - const auto ebo = ox::Span{cbb.elements} + i * renderer::BgVertexEboLength; + auto const vbo = ox::Span{cbb.vertices} + i * renderer::BgVertexVboLength; + auto const ebo = ox::Span{cbb.elements} + i * renderer::BgVertexEboLength; auto &bg = ctx.backgrounds[bgIdx]; renderer::setTileBufferObject( static_cast(i * renderer::BgVertexVboRows), diff --git a/src/nostalgia/modules/gfx/src/gfx.cpp b/src/nostalgia/modules/gfx/src/gfx.cpp index 89f09689..ac429b77 100644 --- a/src/nostalgia/modules/gfx/src/gfx.cpp +++ b/src/nostalgia/modules/gfx/src/gfx.cpp @@ -51,7 +51,7 @@ ox::Error loadSpritePalette( ox::Error loadBgTileSheet( Context &ctx, unsigned const cbb, - ox::FileAddress const&tsAddr, + ox::FileAddress const &tsAddr, size_t const dstTileIdx, size_t const srcTileIdx, size_t const tileCnt) noexcept { @@ -74,7 +74,7 @@ ox::Error loadBgTileSheet( Context &ctx, unsigned const cbb, ox::StringViewCR tilesheetPath, - ox::Optional const&paletteBank) noexcept { + ox::Optional const &paletteBank) noexcept { OX_REQUIRE(ts, keel::readObj(keelCtx(ctx), tilesheetPath)); return loadBgTileSheet(ctx, cbb, *ts, paletteBank); } @@ -82,8 +82,8 @@ ox::Error loadBgTileSheet( ox::Error loadBgTileSheet( Context &ctx, unsigned const cbb, - ox::FileAddress const&tilesheetAddr, - ox::Optional const&paletteBank) noexcept { + ox::FileAddress const &tilesheetAddr, + ox::Optional const &paletteBank) noexcept { OX_REQUIRE(ts, keel::readObj(keelCtx(ctx), tilesheetAddr)); return loadBgTileSheet(ctx, cbb, *ts, paletteBank); } @@ -98,7 +98,7 @@ ox::Error loadSpriteTileSheet( ox::Error loadSpriteTileSheet( Context &ctx, - ox::FileAddress const&tilesheetAddr, + ox::FileAddress const &tilesheetAddr, bool const loadDefaultPalette) noexcept { OX_REQUIRE(ts, readObj(keelCtx(ctx), tilesheetAddr)); return loadSpriteTileSheet(ctx, *ts, loadDefaultPalette); diff --git a/src/nostalgia/modules/gfx/src/keel/keelmodule.cpp b/src/nostalgia/modules/gfx/src/keel/keelmodule.cpp index fbef02ed..737837f9 100644 --- a/src/nostalgia/modules/gfx/src/keel/keelmodule.cpp +++ b/src/nostalgia/modules/gfx/src/keel/keelmodule.cpp @@ -89,7 +89,7 @@ static class: public keel::Module { } const mod; -keel::Module const*keelModule() noexcept { +keel::Module const *keelModule() noexcept { return &mod; } diff --git a/src/nostalgia/modules/gfx/src/keel/typeconv.cpp b/src/nostalgia/modules/gfx/src/keel/typeconv.cpp index 31d48029..3b179ddd 100644 --- a/src/nostalgia/modules/gfx/src/keel/typeconv.cpp +++ b/src/nostalgia/modules/gfx/src/keel/typeconv.cpp @@ -61,7 +61,7 @@ ox::Error convertPaletteV4ToPaletteV5( for (auto &s : src.pages) { ox::Vector colors; colors.reserve(s.colors.size()); - for (auto const&c : s.colors) { + for (auto const &c : s.colors) { colors.emplace_back(c.r, c.g, c.b, c.a); } dst.pages.emplace_back(PalettePageV2{ diff --git a/src/nostalgia/modules/gfx/src/keel/typeconv.hpp b/src/nostalgia/modules/gfx/src/keel/typeconv.hpp index bc55aa9f..6be75f96 100644 --- a/src/nostalgia/modules/gfx/src/keel/typeconv.hpp +++ b/src/nostalgia/modules/gfx/src/keel/typeconv.hpp @@ -8,7 +8,6 @@ #include -#include #include #include diff --git a/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp b/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp index cba95ffd..0d167c3f 100644 --- a/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp @@ -20,7 +20,7 @@ class PaletteEditorImGui: public studio::Editor { bool m_show = false; public: ox::Signal inputSubmitted; - constexpr void show(ox::StringView const&name) noexcept { + constexpr void show(ox::StringView const &name) noexcept { m_show = true; m_name = name; } diff --git a/src/nostalgia/modules/gfx/src/studio/studiomodule.cpp b/src/nostalgia/modules/gfx/src/studio/studiomodule.cpp index 182f4464..58b03a20 100644 --- a/src/nostalgia/modules/gfx/src/studio/studiomodule.cpp +++ b/src/nostalgia/modules/gfx/src/studio/studiomodule.cpp @@ -30,7 +30,7 @@ static class: public studio::Module { } } const mod; -const studio::Module *studioModule() noexcept { +studio::Module const *studioModule() noexcept { return &mod; } diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/addsubsheetcommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/addsubsheetcommand.cpp index ba35b392..f311ec7a 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/addsubsheetcommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/addsubsheetcommand.cpp @@ -60,7 +60,7 @@ int AddSubSheetCommand::commandId() const noexcept { return static_cast(CommandId::AddSubSheet); } -TileSheet::SubSheetIdx const&AddSubSheetCommand::subsheetIdx() const noexcept { +TileSheet::SubSheetIdx const &AddSubSheetCommand::subsheetIdx() const noexcept { return m_parentIdx; } diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/addsubsheetcommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/addsubsheetcommand.hpp index e268a6d5..b5b79ef0 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/addsubsheetcommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/addsubsheetcommand.hpp @@ -25,7 +25,7 @@ class AddSubSheetCommand: public TileSheetCommand { int commandId() const noexcept final; [[nodiscard]] - TileSheet::SubSheetIdx const&subsheetIdx() const noexcept override; + TileSheet::SubSheetIdx const &subsheetIdx() const noexcept override; }; diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/commands.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/commands.hpp index 17b98990..c193e935 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/commands.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/commands.hpp @@ -37,7 +37,7 @@ constexpr bool operator==(int i, CommandId c) noexcept { class TileSheetCommand: public studio::UndoCommand { public: [[nodiscard]] - virtual TileSheet::SubSheetIdx const&subsheetIdx() const noexcept = 0; + virtual TileSheet::SubSheetIdx const &subsheetIdx() const noexcept = 0; }; } \ No newline at end of file diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.cpp index a09bdd5f..f0acb7f2 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.cpp @@ -48,7 +48,7 @@ CutPasteCommand::CutPasteCommand( ox::Error CutPasteCommand::redo() noexcept { auto &subsheet = getSubSheet(m_img, m_subSheetIdx); - for (const auto &c : m_changes) { + for (auto const &c : m_changes) { subsheet.pixels[c.idx] = static_cast(c.newPalIdx); } return {}; @@ -56,7 +56,7 @@ ox::Error CutPasteCommand::redo() noexcept { ox::Error CutPasteCommand::undo() noexcept { auto &subsheet = getSubSheet(m_img, m_subSheetIdx); - for (const auto &c : m_changes) { + for (auto const &c : m_changes) { subsheet.pixels[c.idx] = static_cast(c.oldPalIdx); } return {}; diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.hpp index 0ff7966b..25146141 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/cutpastecommand.hpp @@ -30,10 +30,10 @@ class TileSheetClipboard: public turbine::ClipboardObject { ox::Vector m_pixels; public: - void addPixel(ox::Point const&pt, uint16_t colorIdx) noexcept; + void addPixel(ox::Point const &pt, uint16_t colorIdx) noexcept; [[nodiscard]] - ox::Vector const&pixels() const noexcept; + ox::Vector const &pixels() const noexcept; }; OX_MODEL_BEGIN(TileSheetClipboard::Pixel) @@ -67,9 +67,9 @@ class CutPasteCommand: public TileSheetCommand { CommandId commandId, TileSheet &img, TileSheet::SubSheetIdx subSheetIdx, - ox::Point const&dstStart, + ox::Point const &dstStart, ox::Point dstEnd, - TileSheetClipboard const&cb); + TileSheetClipboard const &cb); ox::Error redo() noexcept final; @@ -79,7 +79,7 @@ class CutPasteCommand: public TileSheetCommand { int commandId() const noexcept final; [[nodiscard]] - TileSheet::SubSheetIdx const&subsheetIdx() const noexcept override; + TileSheet::SubSheetIdx const &subsheetIdx() const noexcept override; }; diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/deletetilescommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/deletetilescommand.cpp index 9350df0d..a497f7c3 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/deletetilescommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/deletetilescommand.cpp @@ -66,7 +66,7 @@ int DeleteTilesCommand::commandId() const noexcept { return static_cast(CommandId::DeleteTile); } -TileSheet::SubSheetIdx const&DeleteTilesCommand::subsheetIdx() const noexcept { +TileSheet::SubSheetIdx const &DeleteTilesCommand::subsheetIdx() const noexcept { return m_idx; } diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/deletetilescommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/deletetilescommand.hpp index a0e0b34b..5de97235 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/deletetilescommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/deletetilescommand.hpp @@ -31,7 +31,7 @@ class DeleteTilesCommand: public TileSheetCommand { int commandId() const noexcept final; [[nodiscard]] - TileSheet::SubSheetIdx const&subsheetIdx() const noexcept override; + TileSheet::SubSheetIdx const &subsheetIdx() const noexcept override; }; diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/drawcommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/drawcommand.cpp index ea5ced0c..d8791c03 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/drawcommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/drawcommand.cpp @@ -74,7 +74,7 @@ DrawCommand::DrawCommand( DrawCommand::DrawCommand( TileSheet &img, TileSheet::SubSheetIdx subSheetIdx, - ox::SpanView const&idxList, + ox::SpanView const &idxList, int const palIdx) noexcept: m_img(img), m_subSheetIdx(std::move(subSheetIdx)), @@ -90,7 +90,7 @@ bool DrawCommand::append(std::size_t const idx) noexcept { if (m_changes.back().value->idx != idx && getPixel(subsheet, idx) != m_palIdx) { // duplicate entries are bad auto existing = find_if( - m_changes.cbegin(), m_changes.cend(), [idx](auto const&c) { + m_changes.cbegin(), m_changes.cend(), [idx](auto const &c) { return c.idx == idx; }); if (existing == m_changes.cend()) { @@ -102,7 +102,7 @@ bool DrawCommand::append(std::size_t const idx) noexcept { return false; } -bool DrawCommand::append(ox::SpanView const&idxList) noexcept { +bool DrawCommand::append(ox::SpanView const &idxList) noexcept { auto out = false; for (auto idx : idxList) { out = append(idx) || out; @@ -134,7 +134,7 @@ void DrawCommand::lineUpdate(ox::Point a, ox::Point b) noexcept { ox::Error DrawCommand::redo() noexcept { auto &subsheet = getSubSheet(m_img, m_subSheetIdx); - for (auto const&c : m_changes) { + for (auto const &c : m_changes) { subsheet.pixels[c.idx] = static_cast(m_palIdx); } return {}; @@ -142,7 +142,7 @@ ox::Error DrawCommand::redo() noexcept { ox::Error DrawCommand::undo() noexcept { auto &subsheet = getSubSheet(m_img, m_subSheetIdx); - for (auto const&c : m_changes) { + for (auto const &c : m_changes) { subsheet.pixels[c.idx] = static_cast(c.oldPalIdx); } return {}; @@ -152,7 +152,7 @@ int DrawCommand::commandId() const noexcept { return static_cast(CommandId::Draw); } -TileSheet::SubSheetIdx const&DrawCommand::subsheetIdx() const noexcept { +TileSheet::SubSheetIdx const &DrawCommand::subsheetIdx() const noexcept { return m_subSheetIdx; } diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/drawcommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/drawcommand.hpp index 84b21188..51f78d88 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/drawcommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/drawcommand.hpp @@ -33,12 +33,12 @@ class DrawCommand: public TileSheetCommand { DrawCommand( TileSheet &img, TileSheet::SubSheetIdx subSheetIdx, - ox::SpanView const&idxList, + ox::SpanView const &idxList, int palIdx) noexcept; bool append(std::size_t idx) noexcept; - bool append(ox::SpanView const&idxList) noexcept; + bool append(ox::SpanView const &idxList) noexcept; void lineUpdate(ox::Point a, ox::Point b) noexcept; @@ -50,7 +50,7 @@ class DrawCommand: public TileSheetCommand { int commandId() const noexcept final; [[nodiscard]] - TileSheet::SubSheetIdx const&subsheetIdx() const noexcept override; + TileSheet::SubSheetIdx const &subsheetIdx() const noexcept override; void finish() noexcept; diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/flipcommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/flipcommand.hpp index 8d1d7b34..6870d6f8 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/flipcommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/flipcommand.hpp @@ -30,7 +30,7 @@ class FlipXCommand: public TileSheetCommand { int commandId() const noexcept final; [[nodiscard]] - TileSheet::SubSheetIdx const&subsheetIdx() const noexcept override; + TileSheet::SubSheetIdx const &subsheetIdx() const noexcept override; }; @@ -56,7 +56,7 @@ class FlipYCommand: public TileSheetCommand { int commandId() const noexcept final; [[nodiscard]] - TileSheet::SubSheetIdx const&subsheetIdx() const noexcept override; + TileSheet::SubSheetIdx const &subsheetIdx() const noexcept override; }; diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.cpp index 15109eb5..7531d06a 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.cpp @@ -62,7 +62,7 @@ int InsertTilesCommand::commandId() const noexcept { return static_cast(CommandId::InsertTile); } -TileSheet::SubSheetIdx const&InsertTilesCommand::subsheetIdx() const noexcept { +TileSheet::SubSheetIdx const &InsertTilesCommand::subsheetIdx() const noexcept { return m_idx; } diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.hpp index 220311bd..449e1903 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.hpp @@ -31,7 +31,7 @@ class InsertTilesCommand: public TileSheetCommand { int commandId() const noexcept final; [[nodiscard]] - TileSheet::SubSheetIdx const&subsheetIdx() const noexcept override; + TileSheet::SubSheetIdx const &subsheetIdx() const noexcept override; }; diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/movesubsheetcommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/movesubsheetcommand.cpp index d251d93a..04269adb 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/movesubsheetcommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/movesubsheetcommand.cpp @@ -33,7 +33,7 @@ int MoveSubSheetCommand::commandId() const noexcept { return static_cast(CommandId::MoveSubSheet); } -TileSheet::SubSheetIdx const&MoveSubSheetCommand::subsheetIdx() const noexcept { +TileSheet::SubSheetIdx const &MoveSubSheetCommand::subsheetIdx() const noexcept { return *m_active; } diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/movesubsheetcommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/movesubsheetcommand.hpp index 06fc9dd9..35e40eb1 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/movesubsheetcommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/movesubsheetcommand.hpp @@ -26,7 +26,7 @@ class MoveSubSheetCommand: public TileSheetCommand { int commandId() const noexcept final; [[nodiscard]] - TileSheet::SubSheetIdx const&subsheetIdx() const noexcept override; + TileSheet::SubSheetIdx const &subsheetIdx() const noexcept override; }; diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/palettechangecommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/palettechangecommand.cpp index 2da6338d..3bf022ed 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/palettechangecommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/palettechangecommand.cpp @@ -30,7 +30,7 @@ int PaletteChangeCommand::commandId() const noexcept { return static_cast(CommandId::PaletteChange); } -TileSheet::SubSheetIdx const&PaletteChangeCommand::subsheetIdx() const noexcept { +TileSheet::SubSheetIdx const &PaletteChangeCommand::subsheetIdx() const noexcept { return m_idx; } diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/palettechangecommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/palettechangecommand.hpp index 4e2a06a4..7fa176f2 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/palettechangecommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/palettechangecommand.hpp @@ -29,7 +29,7 @@ class PaletteChangeCommand: public TileSheetCommand { int commandId() const noexcept final; [[nodiscard]] - TileSheet::SubSheetIdx const&subsheetIdx() const noexcept override; + TileSheet::SubSheetIdx const &subsheetIdx() const noexcept override; }; diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rmsubsheetcommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rmsubsheetcommand.cpp index bb11bb66..4027686a 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rmsubsheetcommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rmsubsheetcommand.cpp @@ -31,7 +31,7 @@ int RmSubSheetCommand::commandId() const noexcept { return static_cast(CommandId::RmSubSheet); } -TileSheet::SubSheetIdx const&RmSubSheetCommand::subsheetIdx() const noexcept { +TileSheet::SubSheetIdx const &RmSubSheetCommand::subsheetIdx() const noexcept { return m_idx; } diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rmsubsheetcommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rmsubsheetcommand.hpp index 1813c774..9d488b1c 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rmsubsheetcommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rmsubsheetcommand.hpp @@ -26,7 +26,7 @@ class RmSubSheetCommand: public TileSheetCommand { int commandId() const noexcept final; [[nodiscard]] - TileSheet::SubSheetIdx const&subsheetIdx() const noexcept override; + TileSheet::SubSheetIdx const &subsheetIdx() const noexcept override; }; diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rotatecommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rotatecommand.cpp index b9452a1c..4dd6ed2e 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rotatecommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rotatecommand.cpp @@ -119,7 +119,7 @@ int RotateCommand::commandId() const noexcept { return static_cast(CommandId::Rotate); } -TileSheet::SubSheetIdx const&RotateCommand::subsheetIdx() const noexcept { +TileSheet::SubSheetIdx const &RotateCommand::subsheetIdx() const noexcept { return m_idx; } diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rotatecommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rotatecommand.hpp index 2418b1a1..5d801b13 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rotatecommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/rotatecommand.hpp @@ -40,7 +40,7 @@ class RotateCommand: public TileSheetCommand { int commandId() const noexcept final; [[nodiscard]] - TileSheet::SubSheetIdx const&subsheetIdx() const noexcept override; + TileSheet::SubSheetIdx const &subsheetIdx() const noexcept override; }; diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp index e4d7c8ab..5839b25d 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp @@ -33,7 +33,7 @@ int UpdateSubSheetCommand::commandId() const noexcept { return static_cast(CommandId::UpdateSubSheet); } -TileSheet::SubSheetIdx const&UpdateSubSheetCommand::subsheetIdx() const noexcept { +TileSheet::SubSheetIdx const &UpdateSubSheetCommand::subsheetIdx() const noexcept { return m_idx; } diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/updatesubsheetcommand.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/updatesubsheetcommand.hpp index 4969488a..57edc8b4 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/updatesubsheetcommand.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/updatesubsheetcommand.hpp @@ -30,7 +30,7 @@ class UpdateSubSheetCommand: public TileSheetCommand { int commandId() const noexcept final; [[nodiscard]] - TileSheet::SubSheetIdx const&subsheetIdx() const noexcept override; + TileSheet::SubSheetIdx const &subsheetIdx() const noexcept override; }; diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditormodel.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditormodel.cpp index 5c68a828..5d611859 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditormodel.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditormodel.cpp @@ -66,7 +66,7 @@ void TileSheetEditorModel::cut() { } TileSheetClipboard blankCb; auto cb = ox::make_unique(); - auto const&s = activeSubSheet(); + auto const &s = activeSubSheet(); if (iterateSelectionRows(*m_selection, [&](int const x, int const y) { auto pt = ox::Point{x, y}; auto const idx = gfx::idx(s, pt); @@ -97,7 +97,7 @@ void TileSheetEditorModel::copy() { auto cb = ox::make_unique(); if (iterateSelectionRows(*m_selection, [&](int const x, int const y) { auto pt = ox::Point{x, y}; - auto const&s = activeSubSheet(); + auto const &s = activeSubSheet(); auto const idx = gfx::idx(s, pt); if (idx >= s.pixels.size()) { return ox::Error{1, "invalid idx"}; @@ -122,7 +122,7 @@ void TileSheetEditorModel::paste() { oxErrf("Could not read clipboard: {}", toStr(err)); return; } - auto const&s = activeSubSheet(); + auto const &s = activeSubSheet(); auto const pt1 = m_selection->a; auto const pt2 = ox::Point{s.columns * TileWidth, s.rows * TileHeight}; if (auto cmd = ox::make_unique_catch( @@ -235,7 +235,7 @@ void TileSheetEditorModel::setActiveSubsheet(TileSheet::SubSheetIdx const &idx) } void TileSheetEditorModel::fill(ox::Point const &pt, uint8_t const palIdx) noexcept { - auto const&activeSubSheet = getSubSheet(m_img, m_activeSubsSheetIdx); + auto const &activeSubSheet = getSubSheet(m_img, m_activeSubsSheetIdx); // build idx list if (pt.x >= activeSubSheet.columns * TileWidth || pt.y >= activeSubSheet.rows * TileHeight) { return; @@ -303,7 +303,7 @@ void TileSheetEditorModel::completeSelection() noexcept { m_selTracker.finishSelection(); m_selection.emplace(m_selTracker.selection()); auto&pt = m_selection->b; - auto const&s = activeSubSheet(); + auto const &s = activeSubSheet(); pt.x = ox::min(s.columns * TileWidth - 1, pt.x); pt.y = ox::min(s.rows * TileHeight - 1, pt.y); } @@ -356,7 +356,7 @@ ox::Error TileSheetEditorModel::saveFile() noexcept { } bool TileSheetEditorModel::pixelSelected(std::size_t const idx) const noexcept { - auto const&s = activeSubSheet(); + auto const &s = activeSubSheet(); auto const pt = idxToPt(static_cast(idx), s.columns); return m_selection && m_selection->contains(pt); } @@ -398,7 +398,7 @@ ox::Error TileSheetEditorModel::moveSubSheet(TileSheet::SubSheetIdx src, TileShe } void TileSheetEditorModel::getFillPixels( - TileSheet::SubSheet const&activeSubSheet, + TileSheet::SubSheet const &activeSubSheet, ox::Span const pixels, ox::Point const &pt, uint8_t const oldColor) noexcept { @@ -448,7 +448,7 @@ ox::Error TileSheetEditorModel::pushCommand(ox::UPtr &&cmd) return {}; } -ox::Error TileSheetEditorModel::handleFileRename(ox::StringViewCR, ox::StringViewCR newPath, ox::UUID const&id) noexcept { +ox::Error TileSheetEditorModel::handleFileRename(ox::StringViewCR, ox::StringViewCR newPath, ox::UUID const &id) noexcept { if ((beginsWith(m_img.defaultPalette, "uuid://") && substr(m_img.defaultPalette, 7) == id.toString()) || m_img.defaultPalette == newPath) { diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditorview.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditorview.cpp index 1190db3a..5e5af45b 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditorview.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditorview.cpp @@ -29,8 +29,8 @@ void TileSheetEditorView::draw() noexcept { m_pixelGridDrawer.draw(updated(), m_scrollOffset); } -void TileSheetEditorView::scrollV(ox::Vec2 const&paneSz, float wheel, bool zoomMod) noexcept { - auto const&s = m_model.activeSubSheet(); +void TileSheetEditorView::scrollV(ox::Vec2 const &paneSz, float wheel, bool zoomMod) noexcept { + auto const &s = m_model.activeSubSheet(); auto const pixelSize = m_pixelsDrawer.pixelSize(paneSz); ImVec2 const sheetSize(pixelSize.x * static_cast(s.columns) * TileWidth, pixelSize.y * static_cast(s.rows) * TileHeight); @@ -47,8 +47,8 @@ void TileSheetEditorView::scrollV(ox::Vec2 const&paneSz, float wheel, bool zoomM m_scrollOffset.y = ox::clamp(m_scrollOffset.y, 0.f, sheetSize.y / 2); } -void TileSheetEditorView::scrollH(ox::Vec2 const&paneSz, float wheelh) noexcept { - auto const&s = m_model.activeSubSheet(); +void TileSheetEditorView::scrollH(ox::Vec2 const &paneSz, float wheelh) noexcept { + auto const &s = m_model.activeSubSheet(); auto const pixelSize = m_pixelsDrawer.pixelSize(paneSz); ImVec2 const sheetSize(pixelSize.x * static_cast(s.columns) * TileWidth, pixelSize.y * static_cast(s.rows) * TileHeight); @@ -56,43 +56,43 @@ void TileSheetEditorView::scrollH(ox::Vec2 const&paneSz, float wheelh) noexcept m_scrollOffset.x = ox::clamp(m_scrollOffset.x, -(sheetSize.x / 2), 0.f); } -void TileSheetEditorView::insertTile(ox::Vec2 const&paneSize, ox::Vec2 const&clickPos) noexcept { +void TileSheetEditorView::insertTile(ox::Vec2 const &paneSize, ox::Vec2 const &clickPos) noexcept { auto pt = clickPoint(paneSize, clickPos); - auto const&s = m_model.activeSubSheet(); + auto const &s = m_model.activeSubSheet(); pt.x = ox::min(pt.x, s.columns * TileWidth - 1); pt.y = ox::min(pt.y, s.rows * TileHeight - 1); auto const tileIdx = ptToIdx(pt, s.columns) / PixelsPerTile; m_model.insertTiles(m_model.activeSubSheetIdx(), tileIdx, 1); } -void TileSheetEditorView::deleteTile(ox::Vec2 const&paneSize, ox::Vec2 const&clickPos) noexcept { +void TileSheetEditorView::deleteTile(ox::Vec2 const &paneSize, ox::Vec2 const &clickPos) noexcept { auto const pt = clickPoint(paneSize, clickPos); - auto const&s = m_model.activeSubSheet(); + auto const &s = m_model.activeSubSheet(); auto const tileIdx = ptToIdx(pt, s.columns) / PixelsPerTile; m_model.deleteTiles(m_model.activeSubSheetIdx(), tileIdx, 1); } -void TileSheetEditorView::clickDraw(ox::Vec2 const&paneSize, ox::Vec2 const&clickPos) noexcept { +void TileSheetEditorView::clickDraw(ox::Vec2 const &paneSize, ox::Vec2 const &clickPos) noexcept { auto const pt = clickPoint(paneSize, clickPos); m_model.drawCommand(pt, m_palIdx); } -void TileSheetEditorView::clickLine(ox::Vec2 const&paneSize, ox::Vec2 const&clickPos) noexcept { +void TileSheetEditorView::clickLine(ox::Vec2 const &paneSize, ox::Vec2 const &clickPos) noexcept { auto const pt = clickPoint(paneSize, clickPos); m_model.drawLineCommand(pt, m_palIdx); } -void TileSheetEditorView::clickSelect(ox::Vec2 const&paneSize, ox::Vec2 const&clickPos) noexcept { +void TileSheetEditorView::clickSelect(ox::Vec2 const &paneSize, ox::Vec2 const &clickPos) noexcept { auto const pt = clickPoint(paneSize, clickPos); m_model.select(pt); } -void TileSheetEditorView::clickFill(ox::Vec2 const&paneSize, ox::Vec2 const&clickPos) noexcept { +void TileSheetEditorView::clickFill(ox::Vec2 const &paneSize, ox::Vec2 const &clickPos) noexcept { auto const pt = clickPoint(paneSize, clickPos); m_model.fill(pt, static_cast(m_palIdx)); } -void TileSheetEditorView::releaseMouseButton(TileSheetTool tool) noexcept { +void TileSheetEditorView::releaseMouseButton(TileSheetTool const tool) noexcept { switch (tool) { case TileSheetTool::Draw: case TileSheetTool::Fill: @@ -107,7 +107,7 @@ void TileSheetEditorView::releaseMouseButton(TileSheetTool tool) noexcept { } } -void TileSheetEditorView::resizeView(ox::Vec2 const&sz) noexcept { +void TileSheetEditorView::resizeView(ox::Vec2 const &sz) noexcept { m_viewSize = sz; initView(); } @@ -133,9 +133,9 @@ void TileSheetEditorView::initView() noexcept { m_pixelGridDrawer.initBufferSet(m_viewSize, m_model.activeSubSheet()); } -ox::Point TileSheetEditorView::clickPoint(ox::Vec2 const&paneSize, ox::Vec2 const&clickPos) const noexcept { +ox::Point TileSheetEditorView::clickPoint(ox::Vec2 const &paneSize, ox::Vec2 const &clickPos) const noexcept { auto [x, y] = clickPos; - const auto pixDrawSz = m_pixelsDrawer.pixelSize(paneSize); + auto const pixDrawSz = m_pixelsDrawer.pixelSize(paneSize); x /= paneSize.x; y /= paneSize.y; x += -m_scrollOffset.x / 2; diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditorview.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditorview.hpp index 34ee7094..7ab9f6b4 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditorview.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditorview.hpp @@ -62,28 +62,28 @@ class TileSheetEditorView: public ox::SignalHandler { void draw() noexcept; - void insertTile(ox::Vec2 const&paneSize, ox::Vec2 const&clickPos) noexcept; + void insertTile(ox::Vec2 const &paneSize, ox::Vec2 const &clickPos) noexcept; - void deleteTile(ox::Vec2 const&paneSize, ox::Vec2 const&clickPos) noexcept; + void deleteTile(ox::Vec2 const &paneSize, ox::Vec2 const &clickPos) noexcept; - void clickDraw(ox::Vec2 const&paneSize, ox::Vec2 const&clickPos) noexcept; + void clickDraw(ox::Vec2 const &paneSize, ox::Vec2 const &clickPos) noexcept; - void clickLine(ox::Vec2 const&paneSize, ox::Vec2 const&clickPos) noexcept; + void clickLine(ox::Vec2 const &paneSize, ox::Vec2 const &clickPos) noexcept; - void clickSelect(ox::Vec2 const&paneSize, ox::Vec2 const&clickPos) noexcept; + void clickSelect(ox::Vec2 const &paneSize, ox::Vec2 const &clickPos) noexcept; - void clickFill(ox::Vec2 const&paneSize, ox::Vec2 const&clickPos) noexcept; + void clickFill(ox::Vec2 const &paneSize, ox::Vec2 const &clickPos) noexcept; void releaseMouseButton(TileSheetTool tool) noexcept; - void scrollV(ox::Vec2 const&paneSz, float wheel, bool zoomMod) noexcept; + void scrollV(ox::Vec2 const &paneSz, float wheel, bool zoomMod) noexcept; - void scrollH(ox::Vec2 const&paneSz, float wheel) noexcept; + void scrollH(ox::Vec2 const &paneSz, float wheel) noexcept; - void resizeView(ox::Vec2 const&sz) noexcept; + void resizeView(ox::Vec2 const &sz) noexcept; [[nodiscard]] - constexpr TileSheet const&img() const noexcept; + constexpr TileSheet const &img() const noexcept; [[nodiscard]] constexpr TileSheet &img() noexcept; @@ -117,13 +117,13 @@ class TileSheetEditorView: public ox::SignalHandler { private: void initView() noexcept; - ox::Point clickPoint(ox::Vec2 const&paneSize, ox::Vec2 const&clickPos) const noexcept; + ox::Point clickPoint(ox::Vec2 const &paneSize, ox::Vec2 const &clickPos) const noexcept; - ox::Error setActiveSubsheet(TileSheet::SubSheetIdx const&idx) noexcept; + ox::Error setActiveSubsheet(TileSheet::SubSheetIdx const &idx) noexcept; }; -constexpr TileSheet const&TileSheetEditorView::img() const noexcept { +constexpr TileSheet const &TileSheetEditorView::img() const noexcept { return m_model.img(); } diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixelgrid.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixelgrid.cpp index 914c7c6a..c24549cc 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixelgrid.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixelgrid.cpp @@ -23,7 +23,7 @@ ox::Error TileSheetGrid::buildShader() noexcept { pixelLineVshad, pixelLineFshad, pixelLineGshad).moveTo(m_shader); } -void TileSheetGrid::draw(bool const update, ox::Vec2 const&scroll) noexcept { +void TileSheetGrid::draw(bool const update, ox::Vec2 const &scroll) noexcept { // the lines just show up bigger on Windows for some reason if constexpr(ox::defines::OS == ox::OS::Windows) { glLineWidth(3 * m_pixelSizeMod * 0.25f); @@ -42,7 +42,7 @@ void TileSheetGrid::draw(bool const update, ox::Vec2 const&scroll) noexcept { glUseProgram(0); } -void TileSheetGrid::initBufferSet(ox::Vec2 const&paneSize, TileSheet::SubSheet const&subsheet) noexcept { +void TileSheetGrid::initBufferSet(ox::Vec2 const &paneSize, TileSheet::SubSheet const &subsheet) noexcept { // vao m_bufferSet.vao = glutils::generateVertexArrayObject(); glBindVertexArray(m_bufferSet.vao); @@ -65,7 +65,7 @@ void TileSheetGrid::initBufferSet(ox::Vec2 const&paneSize, TileSheet::SubSheet c std::bit_cast(uintptr_t{4 * sizeof(float)})); } -void TileSheetGrid::update(ox::Vec2 const&paneSize, TileSheet::SubSheet const&subsheet) noexcept { +void TileSheetGrid::update(ox::Vec2 const &paneSize, TileSheet::SubSheet const &subsheet) noexcept { glBindVertexArray(m_bufferSet.vao); setBufferObjects(paneSize, subsheet); glutils::sendVbo(m_bufferSet); @@ -77,7 +77,7 @@ void TileSheetGrid::setBufferObject( ox::Point const pt2, Color32 const c, ox::Span const vbo, - ox::Vec2 const&pixSize) noexcept { + ox::Vec2 const &pixSize) noexcept { auto const x1 = static_cast(pt1.x) * pixSize.x - 1.f; auto const y1 = 1.f - static_cast(pt1.y) * pixSize.y; auto const x2 = static_cast(pt2.x) * pixSize.x - 1.f; @@ -87,7 +87,7 @@ void TileSheetGrid::setBufferObject( ox::spancpy(vbo, ox::SpanView{vertices}); } -void TileSheetGrid::setBufferObjects(ox::Vec2 const&paneSize, TileSheet::SubSheet const&subsheet) noexcept { +void TileSheetGrid::setBufferObjects(ox::Vec2 const &paneSize, TileSheet::SubSheet const &subsheet) noexcept { if (subsheet.columns < 1 || subsheet.rows < 1) { m_bufferSet.elements.clear(); m_bufferSet.vertices.clear(); @@ -129,7 +129,7 @@ void TileSheetGrid::setBufferObjects(ox::Vec2 const&paneSize, TileSheet::SubShee } } -ox::Vec2 TileSheetGrid::pixelSize(ox::Vec2 const&paneSize) const noexcept { +ox::Vec2 TileSheetGrid::pixelSize(ox::Vec2 const &paneSize) const noexcept { auto const [sw, sh] = paneSize; constexpr float ymod = 0.35f / 10.0f; auto const xmod = ymod * sh / sw; diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixelgrid.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixelgrid.hpp index 828518e2..5e45ec07 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixelgrid.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixelgrid.hpp @@ -66,19 +66,20 @@ class TileSheetGrid { ox::Error buildShader() noexcept; - void draw(bool update, ox::Vec2 const&scroll) noexcept; + void draw(bool update, ox::Vec2 const &scroll) noexcept; - void initBufferSet(ox::Vec2 const&paneSize, TileSheet::SubSheet const&subsheet) noexcept; + void initBufferSet(ox::Vec2 const &paneSize, TileSheet::SubSheet const &subsheet) noexcept; - void update(ox::Vec2 const&paneSize, TileSheet::SubSheet const&subsheet) noexcept; + void update(ox::Vec2 const &paneSize, TileSheet::SubSheet const &subsheet) noexcept; private: - static void setBufferObject(ox::Point pt1, ox::Point pt2, Color32 c, ox::Span vbo, ox::Vec2 const&pixSize) noexcept; + static void setBufferObject( + ox::Point pt1, ox::Point pt2, Color32 c, ox::Span vbo, ox::Vec2 const &pixSize) noexcept; - void setBufferObjects(ox::Vec2 const&paneSize, TileSheet::SubSheet const&subsheet) noexcept; + void setBufferObjects(ox::Vec2 const &paneSize, TileSheet::SubSheet const &subsheet) noexcept; [[nodiscard]] - ox::Vec2 pixelSize(ox::Vec2 const&paneSize) const noexcept; + ox::Vec2 pixelSize(ox::Vec2 const &paneSize) const noexcept; }; diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixels.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixels.cpp index 2388c318..8374f268 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixels.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixels.cpp @@ -49,7 +49,7 @@ ox::Error TileSheetPixels::buildShader() noexcept { return glutils::buildShaderProgram(s_programSrc).moveTo(m_shader); } -void TileSheetPixels::draw(bool const update, ox::Vec2 const&scroll) noexcept { +void TileSheetPixels::draw(bool const update, ox::Vec2 const &scroll) noexcept { glUseProgram(m_shader); glBindVertexArray(m_bufferSet.vao); if (update) { @@ -62,7 +62,7 @@ void TileSheetPixels::draw(bool const update, ox::Vec2 const&scroll) noexcept { glUseProgram(0); } -void TileSheetPixels::initBufferSet(ox::Vec2 const&paneSize) noexcept { +void TileSheetPixels::initBufferSet(ox::Vec2 const &paneSize) noexcept { m_bufferSet.vao = glutils::generateVertexArrayObject(); m_bufferSet.vbo = glutils::generateBuffer(); m_bufferSet.ebo = glutils::generateBuffer(); @@ -70,14 +70,14 @@ void TileSheetPixels::initBufferSet(ox::Vec2 const&paneSize) noexcept { glutils::setupShaderParams(m_shader, s_programSrc.shaderParams); } -void TileSheetPixels::update(ox::Vec2 const&paneSize) noexcept { +void TileSheetPixels::update(ox::Vec2 const &paneSize) noexcept { glBindVertexArray(m_bufferSet.vao); setBufferObjects(paneSize); glutils::sendVbo(m_bufferSet); glutils::sendEbo(m_bufferSet); } -ox::Vec2 TileSheetPixels::pixelSize(ox::Vec2 const&paneSize) const noexcept { +ox::Vec2 TileSheetPixels::pixelSize(ox::Vec2 const &paneSize) const noexcept { auto const [sw, sh] = paneSize; constexpr float ymod = 0.35f / 10.0f; auto const xmod = ymod * sh / sw; @@ -85,7 +85,7 @@ ox::Vec2 TileSheetPixels::pixelSize(ox::Vec2 const&paneSize) const noexcept { } void TileSheetPixels::setPixelBufferObject( - ox::Vec2 const&paneSize, + ox::Vec2 const &paneSize, unsigned const vertexRow, float x, float y, Color16 const color, @@ -112,15 +112,15 @@ void TileSheetPixels::setPixelBufferObject( ox::spancpy(ebo, ox::SpanView{elms}); } -void TileSheetPixels::setBufferObjects(ox::Vec2 const&paneSize) noexcept { +void TileSheetPixels::setBufferObjects(ox::Vec2 const &paneSize) noexcept { // set buffer lengths - auto const&subSheet = m_model.activeSubSheet(); + auto const &subSheet = m_model.activeSubSheet(); if (subSheet.columns < 1 || subSheet.rows < 1) { m_bufferSet.vertices.clear(); m_bufferSet.elements.clear(); return; } - auto const&pal = m_model.pal(); + auto const &pal = m_model.pal(); auto const width = subSheet.columns * TileWidth; auto const height = subSheet.rows * TileHeight; auto const pixels = static_cast(width) * static_cast(height); diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixels.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixels.hpp index 9d79087b..42e8d8ff 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixels.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheetpixels.hpp @@ -22,7 +22,7 @@ class TileSheetPixels { float m_pixelSizeMod = 1; glutils::GLProgram m_shader; glutils::BufferSet m_bufferSet; - class TileSheetEditorModel const&m_model; + class TileSheetEditorModel const &m_model; public: explicit TileSheetPixels(class TileSheetEditorModel &model) noexcept; @@ -31,18 +31,18 @@ class TileSheetPixels { ox::Error buildShader() noexcept; - void draw(bool update, ox::Vec2 const&scroll) noexcept; + void draw(bool update, ox::Vec2 const &scroll) noexcept; - void initBufferSet(ox::Vec2 const&paneSize) noexcept; + void initBufferSet(ox::Vec2 const &paneSize) noexcept; - void update(ox::Vec2 const&paneSize) noexcept; + void update(ox::Vec2 const &paneSize) noexcept; [[nodiscard]] - ox::Vec2 pixelSize(ox::Vec2 const&paneSize) const noexcept; + ox::Vec2 pixelSize(ox::Vec2 const &paneSize) const noexcept; private: void setPixelBufferObject( - ox::Vec2 const&paneSize, + ox::Vec2 const &paneSize, unsigned vertexRow, float x, float y, @@ -50,7 +50,7 @@ class TileSheetPixels { ox::Span vbo, ox::Span ebo) const noexcept; - void setBufferObjects(ox::Vec2 const&paneSize) noexcept; + void setBufferObjects(ox::Vec2 const &paneSize) noexcept; }; diff --git a/src/nostalgia/modules/gfx/src/tilesheet.cpp b/src/nostalgia/modules/gfx/src/tilesheet.cpp index 796ce31b..37909190 100644 --- a/src/nostalgia/modules/gfx/src/tilesheet.cpp +++ b/src/nostalgia/modules/gfx/src/tilesheet.cpp @@ -12,16 +12,16 @@ namespace nostalgia::gfx { -std::size_t idx(TileSheet::SubSheet const&ss, ox::Point const&pt) noexcept { +std::size_t idx(TileSheet::SubSheet const &ss, ox::Point const &pt) noexcept { return ptToIdx(pt, ss.columns); } [[nodiscard]] -static TileSheet::SubSheet const *getSubsheet(TileSheet::SubSheet const&ss, SubSheetId const id) noexcept { +static TileSheet::SubSheet const *getSubsheet(TileSheet::SubSheet const &ss, SubSheetId const id) noexcept { if (ss.id == id) { return &ss; } - for (auto const&child: ss.subsheets) { + for (auto const &child: ss.subsheets) { if (auto out = getSubsheet(child, id)) { return out; } @@ -30,31 +30,31 @@ static TileSheet::SubSheet const *getSubsheet(TileSheet::SubSheet const&ss, SubS } [[nodiscard]] -static size_t getTileCnt(TileSheet::SubSheet const&ss) noexcept { +static size_t getTileCnt(TileSheet::SubSheet const &ss) noexcept { if (ss.subsheets.empty()) { return ss.pixels.size() / PixelsPerTile; } else { size_t out{}; - for (auto const&child: ss.subsheets) { + for (auto const &child: ss.subsheets) { out += getTileCnt(child); } return out; } } -size_t getTileCnt(TileSheet const&ts) noexcept { +size_t getTileCnt(TileSheet const &ts) noexcept { return getTileCnt(ts.subsheet); } -TileSheet::SubSheet const *getSubsheet(TileSheet const&ts, SubSheetId const id) noexcept { +TileSheet::SubSheet const *getSubsheet(TileSheet const &ts, SubSheetId const id) noexcept { return getSubsheet(ts.subsheet, id); } static ox::Optional getPixelIdx( - TileSheet::SubSheet const&ss, + TileSheet::SubSheet const &ss, SubSheetId const id, size_t &idx) noexcept { - for (auto const&child: ss.subsheets) { + for (auto const &child: ss.subsheets) { if (child.id == id) { return ox::Optional(ox::in_place, idx); } @@ -66,17 +66,17 @@ static ox::Optional getPixelIdx( return ox::Optional{}; } -ox::Optional getTileIdx(TileSheet const&ts, SubSheetId const id) noexcept { +ox::Optional getTileIdx(TileSheet const &ts, SubSheetId const id) noexcept { size_t idx{}; auto const out = getPixelIdx(ts.subsheet, id, idx); return out ? ox::Optional{ox::in_place, *out / PixelsPerTile} : out; } -uint8_t getPixel(TileSheet::SubSheet const&ss, std::size_t const idx) noexcept { +uint8_t getPixel(TileSheet::SubSheet const &ss, std::size_t const idx) noexcept { return ss.pixels[idx]; } -uint8_t getPixel(TileSheet::SubSheet const&ss, ox::Point const&pt) noexcept { +uint8_t getPixel(TileSheet::SubSheet const &ss, ox::Point const &pt) noexcept { auto const idx = ptToIdx(pt, ss.columns); return getPixel(ss, idx); } @@ -84,14 +84,14 @@ uint8_t getPixel(TileSheet::SubSheet const&ss, ox::Point const&pt) noexcept { static void setPixel( ox::Vector &pixels, int const columns, - ox::Point const&pt, + ox::Point const &pt, uint8_t const palIdx) noexcept { - const auto idx = ptToIdx(pt, columns); + auto const idx = ptToIdx(pt, columns); pixels[idx] = palIdx; } -void setPixel(TileSheet::SubSheet &ss, ox::Point const&pt, uint8_t const palIdx) noexcept { - const auto idx = ptToIdx(pt, ss.columns); +void setPixel(TileSheet::SubSheet &ss, ox::Point const &pt, uint8_t const palIdx) noexcept { + auto const idx = ptToIdx(pt, ss.columns); ss.pixels[idx] = palIdx; } @@ -129,11 +129,11 @@ void flipY(TileSheet::SubSheet &ss, ox::Point const &a, ox::Point const &b) noex } } -unsigned pixelCnt(TileSheet::SubSheet const&ss) noexcept { +unsigned pixelCnt(TileSheet::SubSheet const &ss) noexcept { return static_cast(ss.pixels.size()); } -ox::Error resizeSubsheet(TileSheet::SubSheet &ss, ox::Size const&sz) noexcept { +ox::Error resizeSubsheet(TileSheet::SubSheet &ss, ox::Size const &sz) noexcept { ox::Vector out; OX_RETURN_ERROR(setPixelCount(out, static_cast(sz.width * sz.height) * PixelsPerTile)); auto const w = ox::min(ss.columns, sz.width) * TileWidth; @@ -150,12 +150,12 @@ ox::Error resizeSubsheet(TileSheet::SubSheet &ss, ox::Size const&sz) noexcept { return {}; } -ox::Result getNameFor(TileSheet::SubSheet const&ss, SubSheetId const pId) noexcept { +ox::Result getNameFor(TileSheet::SubSheet const &ss, SubSheetId const pId) noexcept { if (ss.id == pId) { return ox::StringView(ss.name); } - for (const auto &sub : ss.subsheets) { - const auto [name, err] = getNameFor(sub, pId); + for (auto const &sub : ss.subsheets) { + auto const [name, err] = getNameFor(sub, pId); if (!err) { return name; } @@ -167,7 +167,7 @@ ox::Result getNameFor(TileSheet::SubSheet const&ss, SubSheetId c TileSheet::SubSheetIdx validateSubSheetIdx( TileSheet::SubSheetIdx &&pIdx, std::size_t const pIdxIt, - TileSheet::SubSheet const&pSubsheet) noexcept { + TileSheet::SubSheet const &pSubsheet) noexcept { if (pIdxIt >= pIdx.size()) { return std::move(pIdx); } @@ -185,7 +185,7 @@ TileSheet::SubSheetIdx validateSubSheetIdx( return validateSubSheetIdx(std::move(pIdx), pIdxIt + 1, pSubsheet.subsheets[currentIdx]); } -TileSheet::SubSheetIdx validateSubSheetIdx(TileSheet const&ts, TileSheet::SubSheetIdx idx) noexcept { +TileSheet::SubSheetIdx validateSubSheetIdx(TileSheet const &ts, TileSheet::SubSheetIdx idx) noexcept { return validateSubSheetIdx(std::move(idx), 0, ts.subsheet); } @@ -215,14 +215,14 @@ ox::Result getSubSheetIdx(TileSheet const &ts, SubSheetI #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdangling-reference" #endif -static TileSheet::SubSheet const&getSubSheet( +static TileSheet::SubSheet const &getSubSheet( ox::SpanView const &idx, std::size_t const idxIt, TileSheet::SubSheet const &pSubsheet) noexcept { if (idxIt == idx.size()) { return pSubsheet; } - const auto currentIdx = idx[idxIt]; + auto const currentIdx = idx[idxIt]; if (pSubsheet.subsheets.size() < currentIdx) { return pSubsheet; } @@ -246,7 +246,7 @@ TileSheet::SubSheet &getSubSheet( #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdangling-reference" #endif -TileSheet::SubSheet const&getSubSheet(TileSheet const &ts, ox::SpanView const &idx) noexcept { +TileSheet::SubSheet const &getSubSheet(TileSheet const &ts, ox::SpanView const &idx) noexcept { return gfx::getSubSheet(idx, 0, ts.subsheet); } @@ -257,7 +257,7 @@ TileSheet::SubSheet &getSubSheet(TileSheet &ts, ox::SpanView const &id #pragma GCC diagnostic pop #endif -ox::Error addSubSheet(TileSheet &ts, TileSheet::SubSheetIdx const&idx) noexcept { +ox::Error addSubSheet(TileSheet &ts, TileSheet::SubSheetIdx const &idx) noexcept { auto &parent = getSubSheet(ts, idx); if (parent.subsheets.size() < 2) { parent.subsheets.emplace_back(++ts.idIt, ox::sfmt("Subsheet {}", parent.subsheets.size()), 1, 1); @@ -268,7 +268,7 @@ ox::Error addSubSheet(TileSheet &ts, TileSheet::SubSheetIdx const&idx) noexcept return {}; } -ox::Error insertSubSheet(TileSheet &ts, ox::SpanView const&idx, TileSheet::SubSheet ss) noexcept { +ox::Error insertSubSheet(TileSheet &ts, ox::SpanView const &idx, TileSheet::SubSheet ss) noexcept { if (idx.empty()) { return ox::Error{1, "invalid insert idx"}; } @@ -283,7 +283,7 @@ ox::Error insertSubSheet(TileSheet &ts, ox::SpanView const&idx, TileSh ox::Error rmSubSheet( TileSheet &ts, - TileSheet::SubSheetIdx const&idx, + TileSheet::SubSheetIdx const &idx, std::size_t const idxIt, TileSheet::SubSheet &pSubsheet) noexcept { if (idxIt == idx.size() - 1) { @@ -292,21 +292,21 @@ ox::Error rmSubSheet( return rmSubSheet(ts, idx, idxIt + 1, pSubsheet.subsheets[idx[idxIt]]); } -ox::Error rmSubSheet(TileSheet &ts, TileSheet::SubSheetIdx const&idx) noexcept { +ox::Error rmSubSheet(TileSheet &ts, TileSheet::SubSheetIdx const &idx) noexcept { return rmSubSheet(ts, idx, 0, ts.subsheet); } uint8_t getPixel( - TileSheet const&ts, - ox::Point const&pt, - TileSheet::SubSheetIdx const&subsheetIdx) noexcept { + TileSheet const &ts, + ox::Point const &pt, + TileSheet::SubSheetIdx const &subsheetIdx) noexcept { auto &s = getSubSheet(ts, subsheetIdx); auto const idx = ptToIdx(pt, s.columns); return getPixel(s, idx); } uint8_t getPixel4Bpp( - CompactTileSheet const&ts, + CompactTileSheet const &ts, size_t const idx) noexcept { oxAssert(ts.bpp == 4, "TileSheet::getPixel4Bpp: wrong bpp"); if (idx & 1) { @@ -317,14 +317,14 @@ uint8_t getPixel4Bpp( } uint8_t getPixel8Bpp( - CompactTileSheet const&ts, + CompactTileSheet const &ts, size_t const idx) noexcept { oxAssert(ts.bpp == 8, "TileSheet::getPixel8Bpp: wrong bpp"); return ts.pixels[idx]; } ox::Pair get2Pixels4Bpp( - CompactTileSheet const&ts, + CompactTileSheet const &ts, size_t const idx) noexcept { oxAssert(ts.bpp == 4, "TileSheet::getPixel4Bpp: wrong bpp"); auto const out = ts.pixels[idx / 2]; @@ -335,7 +335,7 @@ ox::Pair get2Pixels4Bpp( } ox::Pair get2Pixels8Bpp( - CompactTileSheet const&ts, + CompactTileSheet const &ts, size_t const idx) noexcept { oxAssert(ts.bpp == 8, "TileSheet::getPixel8Bpp: wrong bpp"); return { @@ -345,8 +345,8 @@ ox::Pair get2Pixels8Bpp( } static ox::Result getIdFor( - TileSheet::SubSheet const&ss, - ox::SpanView const&pNamePath, + TileSheet::SubSheet const &ss, + ox::SpanView const &pNamePath, std::size_t const pIt = 0) noexcept { for (auto &sub : ss.subsheets) { if (sub.name == pNamePath[pIt]) { @@ -359,7 +359,7 @@ static ox::Result getIdFor( return ox::Error(1, "SubSheet not found"); } -ox::Result getIdFor(TileSheet const&ts, ox::StringViewCR path) noexcept { +ox::Result getIdFor(TileSheet const &ts, ox::StringViewCR path) noexcept { return getIdFor(ts.subsheet, ox::split<8>(path, '.')); } @@ -367,8 +367,8 @@ ox::Result getIdFor(TileSheet const&ts, ox::StringViewCR path) noexc * Gets the offset in tiles of the desired subsheet. */ static ox::Result getTileOffset( - TileSheet::SubSheet const&ss, - ox::SpanView const&pNamePath, + TileSheet::SubSheet const &ss, + ox::SpanView const &pNamePath, std::size_t const pIt = 0, uint32_t pCurrentTotal = 0) noexcept { // pIt == pNamePath.size() - 1 && @@ -391,7 +391,7 @@ static ox::Result getTileOffset( return ox::Error(1, "SubSheet not found"); } -ox::Result getTileOffset(TileSheet const&ts, ox::StringViewCR pNamePath) noexcept { +ox::Result getTileOffset(TileSheet const &ts, ox::StringViewCR pNamePath) noexcept { return gfx::getTileOffset(ts.subsheet, ox::split<8>(pNamePath, '.')); } @@ -399,7 +399,7 @@ ox::Result getNameFor(TileSheet &ts, SubSheetId const pId) noexc return gfx::getNameFor(ts.subsheet, pId); } -ox::Result getNameFor(TileSheet const&ts, SubSheetId const pId) noexcept { +ox::Result getNameFor(TileSheet const &ts, SubSheetId const pId) noexcept { return gfx::getNameFor(ts.subsheet, pId); } @@ -431,19 +431,19 @@ ox::Vector pixels(TileSheet &ts) noexcept { ox::Vector resizeTileSheetData( - ox::Vector const&srcPixels, - ox::Size const&srcSize, + ox::Vector const &srcPixels, + ox::Size const &srcSize, int const scale) noexcept { ox::Vector dst; auto dstWidth = srcSize.width * scale; auto dstHeight = srcSize.height * scale; - const auto pixelCnt = dstWidth * dstHeight; + auto const pixelCnt = dstWidth * dstHeight; dst.resize(static_cast(pixelCnt)); for (auto i = 0; i < pixelCnt; ++i) { - const auto dstPt = idxToPt(i, 1, scale); - const auto srcPt = dstPt / ox::Point{scale, scale}; - const auto srcIdx = ptToIdx(srcPt, 1); - const auto srcPixel = srcPixels[srcIdx]; + auto const dstPt = idxToPt(i, 1, scale); + auto const srcPt = dstPt / ox::Point{scale, scale}; + auto const srcIdx = ptToIdx(srcPt, 1); + auto const srcPixel = srcPixels[srcIdx]; dst[static_cast(i)] = srcPixel; } return dst; diff --git a/src/nostalgia/modules/gfx/test/tests.cpp b/src/nostalgia/modules/gfx/test/tests.cpp index ed745931..cb3f0185 100644 --- a/src/nostalgia/modules/gfx/test/tests.cpp +++ b/src/nostalgia/modules/gfx/test/tests.cpp @@ -24,7 +24,7 @@ static std::map tests = { }, }; -int main(int argc, const char **argv) { +int main(int argc, char const **argv) { int retval = -1; if (argc > 0) { auto const args = ox::Span{argv, static_cast(argc)}; diff --git a/src/nostalgia/modules/sound/test/tests.cpp b/src/nostalgia/modules/sound/test/tests.cpp index bf35cd22..0f0c4e36 100644 --- a/src/nostalgia/modules/sound/test/tests.cpp +++ b/src/nostalgia/modules/sound/test/tests.cpp @@ -11,7 +11,7 @@ static std::map tests = { }; -int main(int argc, const char **argv) { +int main(int argc, char const **argv) { int retval = -1; if (argc > 0) { auto const args = ox::Span{argv, static_cast(argc)}; diff --git a/src/olympic/applib/applib.cpp b/src/olympic/applib/applib.cpp index 270903b9..b3ac97af 100644 --- a/src/olympic/applib/applib.cpp +++ b/src/olympic/applib/applib.cpp @@ -55,7 +55,7 @@ void registerStudioModules() noexcept; #if defined(_WIN32) && OLYMPIC_GUI_APP int WinMain() { auto const argc = __argc; - auto const argv = const_cast(__argv); + auto const argv = const_cast(__argv); #else int main(int const argc, char const **argv) { #endif diff --git a/src/olympic/keel/include/keel/asset.hpp b/src/olympic/keel/include/keel/asset.hpp index dc9f3f57..ce0272e3 100644 --- a/src/olympic/keel/include/keel/asset.hpp +++ b/src/olympic/keel/include/keel/asset.hpp @@ -26,7 +26,7 @@ ox::Error writeUuidHeader(ox::Writer_c auto &writer, ox::UUID const&uuid) noexce template ox::Result readAsset(ox::BufferView buff) noexcept { std::size_t offset = 0; - const auto err = readUuidHeader(buff).error; + auto const err = readUuidHeader(buff).error; if (!err) { offset = K1HdrSz; // the size of K1 headers } diff --git a/src/olympic/keel/src/asset.cpp b/src/olympic/keel/src/asset.cpp index fb640078..bbe9cb90 100644 --- a/src/olympic/keel/src/asset.cpp +++ b/src/olympic/keel/src/asset.cpp @@ -37,8 +37,8 @@ ox::Result readAsset(ox::TypeStore &ts, ox::BufferView buff) no } ox::Result readAssetTypeId(ox::BufferView const buff) noexcept { - const auto err = readUuidHeader(buff).error; - const auto offset = err ? 0u : K1HdrSz; + auto const err = readUuidHeader(buff).error; + auto const offset = err ? 0u : K1HdrSz; if (offset >= buff.size()) [[unlikely]] { return ox::Error(1, "Buffer too small for expected data"); } @@ -47,8 +47,8 @@ ox::Result readAssetTypeId(ox::BufferView const buff) noexcept { ox::Result readAssetHeader(ox::BufferView buff) noexcept { ox::Result out; - const auto err = readUuidHeader(buff).moveTo(out.value.uuid); - const auto offset = err ? 0u : K1HdrSz; + auto const err = readUuidHeader(buff).moveTo(out.value.uuid); + auto const offset = err ? 0u : K1HdrSz; if (offset >= buff.size()) [[unlikely]] { return ox::Error(1, "Buffer too small for expected data"); } diff --git a/src/olympic/keel/src/typeconv.cpp b/src/olympic/keel/src/typeconv.cpp index 2f3532dd..07db4ece 100644 --- a/src/olympic/keel/src/typeconv.cpp +++ b/src/olympic/keel/src/typeconv.cpp @@ -49,7 +49,7 @@ static ox::Result> convert( if (!subConverter.converter().dstMatches(dstTypeName, dstTypeVersion)) { continue; } - const auto [intermediate, chainErr] = + auto const [intermediate, chainErr] = convert(ctx, converters, src, srcTypeName, srcTypeVersion, subConverter.converter().srcTypeName(), subConverter.converter().srcTypeVersion()); if (!chainErr) { diff --git a/src/olympic/keel/test/tests.cpp b/src/olympic/keel/test/tests.cpp index f4681d92..5e18e392 100644 --- a/src/olympic/keel/test/tests.cpp +++ b/src/olympic/keel/test/tests.cpp @@ -25,7 +25,7 @@ static std::map tests = { }, }; -int main(int argc, const char **argv) { +int main(int argc, char const **argv) { int retval = -1; if (argc > 0) { auto const args = ox::Span{argv, static_cast(argc)}; diff --git a/src/olympic/studio/applib/src/app.cpp b/src/olympic/studio/applib/src/app.cpp index 6eb9d131..d3010860 100644 --- a/src/olympic/studio/applib/src/app.cpp +++ b/src/olympic/studio/applib/src/app.cpp @@ -61,7 +61,7 @@ static ox::Error runApp( static ox::Error run( ox::StringViewCR appName, ox::StringViewCR projectDataDir, - ox::SpanView) { + ox::SpanView) { // seed UUID generator auto const time = std::time(nullptr); ox::UUID::seedGenerator({ diff --git a/src/olympic/studio/applib/src/clawviewer.cpp b/src/olympic/studio/applib/src/clawviewer.cpp index 3b4a9492..5689ff20 100644 --- a/src/olympic/studio/applib/src/clawviewer.cpp +++ b/src/olympic/studio/applib/src/clawviewer.cpp @@ -140,14 +140,14 @@ void ClawEditor::drawVar(ObjPath &path, ox::StringViewCR name, ox::ModelValue co void ClawEditor::drawTree(ObjPath &path, ox::ModelObject const&obj) noexcept { using Str = ox::BasicString<100>; - for (const auto &c : obj) { + for (auto const &c : obj) { ImGui::TableNextRow(0, 5); auto pathStr = ox::join("##", path).unwrap(); auto lbl = ox::sfmt("{}##{}", c->name, pathStr); - const auto rowSelected = false; - const auto hasChildren = c->value.type() == ox::ModelValue::Type::Object + auto const rowSelected = false; + auto const hasChildren = c->value.type() == ox::ModelValue::Type::Object || c->value.type() == ox::ModelValue::Type::Vector; - const auto flags = ImGuiTreeNodeFlags_SpanFullWidth + auto const flags = ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_OpenOnArrow | (hasChildren ? 0 : ImGuiTreeNodeFlags_Leaf) | (rowSelected ? ImGuiTreeNodeFlags_Selected : 0); @@ -158,7 +158,7 @@ void ClawEditor::drawTree(ObjPath &path, ox::ModelObject const&obj) noexcept { //} path.push_back(c->name); if (c->value.type() == ox::ModelValue::Type::Object) { - const auto open = ImGui::TreeNodeEx(lbl.c_str(), flags); + auto const open = ImGui::TreeNodeEx(lbl.c_str(), flags); ImGui::SameLine(); drawRow(c->value); if (open) { diff --git a/src/olympic/studio/modlib/include/studio/imguiutil.hpp b/src/olympic/studio/modlib/include/studio/imguiutil.hpp index dd0b6203..bf6565be 100644 --- a/src/olympic/studio/modlib/include/studio/imguiutil.hpp +++ b/src/olympic/studio/modlib/include/studio/imguiutil.hpp @@ -131,7 +131,7 @@ class ChildStackItem { class IDStackItem { public: explicit IDStackItem(int id) noexcept; - explicit IDStackItem(const char *id) noexcept; + explicit IDStackItem(ox::CString const id) noexcept; explicit IDStackItem(ox::CStringViewCR id) noexcept; ~IDStackItem() noexcept; }; @@ -244,7 +244,7 @@ bool BeginPopup(turbine::Context &ctx, ox::CStringViewCR popupName, bool &show, * @return true if new value selected, false otherwise */ bool ComboBox( - ox::CStringView lbl, + ox::CStringView const &lbl, ox::SpanView list, size_t &selectedIdx) noexcept; @@ -255,7 +255,7 @@ bool ComboBox( * @param selectedIdx * @return true if new value selected, false otherwise */ -bool ComboBox(ox::CStringView lbl, ox::Span list, size_t &selectedIdx) noexcept; +bool ComboBox(ox::CStringView const &lbl, ox::Span list, size_t &selectedIdx) noexcept; /** * diff --git a/src/olympic/studio/modlib/src/imguiutil.cpp b/src/olympic/studio/modlib/src/imguiutil.cpp index 2fc75859..bbff7622 100644 --- a/src/olympic/studio/modlib/src/imguiutil.cpp +++ b/src/olympic/studio/modlib/src/imguiutil.cpp @@ -18,11 +18,11 @@ ChildStackItem::~ChildStackItem() noexcept { ImGui::EndChild(); } -IDStackItem::IDStackItem(int id) noexcept { +IDStackItem::IDStackItem(int const id) noexcept { ImGui::PushID(id); } -IDStackItem::IDStackItem(const char *id) noexcept { +IDStackItem::IDStackItem(ox::CString const id) noexcept { ImGui::PushID(id); } @@ -55,7 +55,7 @@ bool PushButton(ox::CStringViewCR lbl, ImVec2 const &btnSz) noexcept { } PopupResponse PopupControlsOkCancel( - float popupWidth, + float const popupWidth, bool &popupOpen, ox::CStringViewCR ok, ox::CStringViewCR cancel) { @@ -110,14 +110,14 @@ bool BeginPopup(turbine::Context &ctx, ox::CStringViewCR popupName, bool &show, } bool ComboBox( - ox::CStringView lbl, - ox::SpanView list, + ox::CStringView const &lbl, + ox::SpanView const list, size_t &selectedIdx) noexcept { bool out{}; auto const first = selectedIdx < list.size() ? list[selectedIdx].c_str() : ""; if (ImGui::BeginCombo(lbl.c_str(), first, 0)) { for (auto i = 0u; i < list.size(); ++i) { - const auto selected = (selectedIdx == i); + auto const selected = (selectedIdx == i); if (ImGui::Selectable(list[i].c_str(), selected) && selectedIdx != i) { selectedIdx = i; out = true; @@ -129,14 +129,14 @@ bool ComboBox( } bool ComboBox( - ox::CStringView lbl, - ox::Span list, + ox::CStringView const &lbl, + ox::Span const list, size_t &selectedIdx) noexcept { bool out{}; auto const first = selectedIdx < list.size() ? list[selectedIdx].c_str() : ""; if (ImGui::BeginCombo(lbl.c_str(), first, 0)) { for (auto i = 0u; i < list.size(); ++i) { - const auto selected = (selectedIdx == i); + auto const selected = (selectedIdx == i); if (ImGui::Selectable(list[i].c_str(), selected) && selectedIdx != i) { selectedIdx = i; out = true; @@ -150,13 +150,13 @@ bool ComboBox( bool ComboBox( ox::CStringViewCR lbl, std::function const &f, - size_t strCnt, + size_t const strCnt, size_t &selectedIdx) noexcept { bool out{}; auto const first = selectedIdx < strCnt ? f(selectedIdx).c_str() : ""; if (ImGui::BeginCombo(lbl.c_str(), first, 0)) { for (auto i = 0u; i < strCnt; ++i) { - const auto selected = (selectedIdx == i); + auto const selected = (selectedIdx == i); if (ImGui::Selectable(f(i).c_str(), selected) && selectedIdx != i) { selectedIdx = i; out = true;