diff --git a/src/nostalgia/modules/core/include/nostalgia/core/gfx.hpp b/src/nostalgia/modules/core/include/nostalgia/core/gfx.hpp index 6ad7ec92..22bea3da 100644 --- a/src/nostalgia/modules/core/include/nostalgia/core/gfx.hpp +++ b/src/nostalgia/modules/core/include/nostalgia/core/gfx.hpp @@ -5,15 +5,11 @@ #pragma once #include -#include #include #include #include -#include "color.hpp" #include "context.hpp" -#include "ptidxconv.hpp" -#include "tilesheet.hpp" namespace nostalgia::core { @@ -82,6 +78,6 @@ void setSprite(Context *ctx, Sprite const&s) noexcept; } namespace nostalgia::core::gl { -void drawMainView(core::Context*, ox::Size const&) noexcept; +void drawMainView(core::Context&, ox::Size const&) noexcept; } diff --git a/src/nostalgia/modules/core/src/gba/gfx.cpp b/src/nostalgia/modules/core/src/gba/gfx.cpp index 9fadfb25..2d606ccd 100644 --- a/src/nostalgia/modules/core/src/gba/gfx.cpp +++ b/src/nostalgia/modules/core/src/gba/gfx.cpp @@ -13,8 +13,10 @@ #include #include +#include #include #include +#include #include "context.hpp" diff --git a/src/nostalgia/modules/core/src/opengl/gfx.cpp b/src/nostalgia/modules/core/src/opengl/gfx.cpp index 6af4da2e..b64e0f64 100644 --- a/src/nostalgia/modules/core/src/opengl/gfx.cpp +++ b/src/nostalgia/modules/core/src/opengl/gfx.cpp @@ -12,17 +12,27 @@ #include #include +#include #include "context.hpp" namespace nostalgia::core { +[[nodiscard]] +inline GlContext &glctx(Context &ctx) noexcept { + if constexpr(ox::defines::Debug) { + return dynamic_cast(ctx); + } else { + return static_cast(ctx); + } +} + namespace renderer { Drawer::Drawer(Context &ctx) noexcept: m_ctx(ctx) {} void Drawer::draw(turbine::Context &tctx) noexcept { - core::gl::drawMainView(&m_ctx, turbine::getScreenSize(tctx)); + core::gl::drawMainView(m_ctx, turbine::getScreenSize(tctx)); } constexpr ox::StringView bgvshadTmpl = R"( @@ -71,17 +81,17 @@ constexpr ox::StringView spritevshadTmpl = R"( constexpr ox::StringView spritefshadTmpl = bgfshadTmpl; [[nodiscard]] -static constexpr auto bgVertexRow(unsigned x, unsigned y) noexcept { +static constexpr auto bgVertexRow(uint_t x, uint_t y) noexcept { return y * TileRows + x; } static void setSpriteBufferObject( - unsigned vi, + uint_t vi, float enabled, float x, float y, - unsigned textureRow, - unsigned flipX, + uint_t textureRow, + uint_t flipX, float *vbo, GLuint *ebo) noexcept { // don't worry, this memcpy gets optimized to something much more ideal @@ -109,10 +119,10 @@ static void setSpriteBufferObject( } void setTileBufferObject( - unsigned vi, + uint_t vi, float x, float y, - unsigned textureRow, + uint_t textureRow, float *vbo, GLuint *ebo) noexcept { // don't worry, this memcpy gets optimized to something much more ideal @@ -137,22 +147,22 @@ void setTileBufferObject( memcpy(ebo, elms.data(), sizeof(elms)); } -static void initSpriteBufferObjects(glutils::BufferSet *bs) noexcept { +static void initSpriteBufferObjects(glutils::BufferSet &bs) noexcept { for (auto i = 0u; i < SpriteCount; ++i) { - auto vbo = &bs->vertices[i * static_cast(SpriteVertexVboLength)]; - auto ebo = &bs->elements[i * static_cast(SpriteVertexEboLength)]; + auto vbo = &bs.vertices[i * static_cast(SpriteVertexVboLength)]; + auto ebo = &bs.elements[i * static_cast(SpriteVertexEboLength)]; setSpriteBufferObject(i * SpriteVertexVboRows, 0, 0, 0, 0, false, vbo, ebo); } } -static void initBackgroundBufferObjects(glutils::BufferSet *bg) noexcept { +static void initBackgroundBufferObjects(glutils::BufferSet &bg) noexcept { for (auto x = 0u; x < TileColumns; ++x) { for (auto y = 0u; y < TileRows; ++y) { const auto i = bgVertexRow(x, y); - auto vbo = &bg->vertices[i * static_cast(BgVertexVboLength)]; - auto ebo = &bg->elements[i * static_cast(BgVertexEboLength)]; + auto vbo = &bg.vertices[i * static_cast(BgVertexVboLength)]; + auto ebo = &bg.elements[i * static_cast(BgVertexEboLength)]; setTileBufferObject( - static_cast(i * BgVertexVboRows), + static_cast(i * BgVertexVboRows), static_cast(x), static_cast(y), 0, @@ -162,25 +172,25 @@ static void initBackgroundBufferObjects(glutils::BufferSet *bg) noexcept { } } -static void initSpritesBufferset(GLuint shader, glutils::BufferSet *bs) noexcept { +static void initSpritesBufferset(GLuint shader, glutils::BufferSet &bs) noexcept { // vao - bs->vao = glutils::generateVertexArrayObject(); - glBindVertexArray(bs->vao); + bs.vao = glutils::generateVertexArrayObject(); + glBindVertexArray(bs.vao); // vbo & ebo - bs->vbo = glutils::generateBuffer(); - bs->ebo = glutils::generateBuffer(); + bs.vbo = glutils::generateBuffer(); + bs.ebo = glutils::generateBuffer(); initSpriteBufferObjects(bs); - glutils::sendVbo(*bs); - glutils::sendEbo(*bs); + glutils::sendVbo(bs); + glutils::sendEbo(bs); // vbo layout - auto enabledAttr = static_cast(glGetAttribLocation(shader, "vEnabled")); + auto const enabledAttr = static_cast(glGetAttribLocation(shader, "vEnabled")); glEnableVertexAttribArray(enabledAttr); glVertexAttribPointer(enabledAttr, 1, GL_FLOAT, GL_FALSE, SpriteVertexVboRowLength * sizeof(float), nullptr); - auto posAttr = static_cast(glGetAttribLocation(shader, "vPosition")); + auto const posAttr = static_cast(glGetAttribLocation(shader, "vPosition")); glEnableVertexAttribArray(posAttr); glVertexAttribPointer(posAttr, 2, GL_FLOAT, GL_FALSE, SpriteVertexVboRowLength * sizeof(float), reinterpret_cast(1 * sizeof(float))); - auto texCoordAttr = static_cast(glGetAttribLocation(shader, "vTexCoord")); + auto const texCoordAttr = static_cast(glGetAttribLocation(shader, "vTexCoord")); glEnableVertexAttribArray(texCoordAttr); glVertexAttribPointer(texCoordAttr, 2, GL_FLOAT, GL_FALSE, SpriteVertexVboRowLength * sizeof(float), reinterpret_cast(3 * sizeof(float))); @@ -188,25 +198,25 @@ static void initSpritesBufferset(GLuint shader, glutils::BufferSet *bs) noexcept static void initBackgroundBufferset( GLuint shader, - glutils::BufferSet *bg) noexcept { + glutils::BufferSet &bg) noexcept { // vao - bg->vao = glutils::generateVertexArrayObject(); - glBindVertexArray(bg->vao); + bg.vao = glutils::generateVertexArrayObject(); + glBindVertexArray(bg.vao); // vbo & ebo - bg->vbo = glutils::generateBuffer(); - bg->ebo = glutils::generateBuffer(); + bg.vbo = glutils::generateBuffer(); + bg.ebo = glutils::generateBuffer(); initBackgroundBufferObjects(bg); - glutils::sendVbo(*bg); - glutils::sendEbo(*bg); + glutils::sendVbo(bg); + glutils::sendEbo(bg); // vbo layout - auto posAttr = static_cast(glGetAttribLocation(shader, "vPosition")); + auto const posAttr = static_cast(glGetAttribLocation(shader, "vPosition")); glEnableVertexAttribArray(posAttr); glVertexAttribPointer(posAttr, 2, GL_FLOAT, GL_FALSE, BgVertexVboRowLength * sizeof(float), nullptr); - auto texCoordAttr = static_cast(glGetAttribLocation(shader, "vTexCoord")); + auto const texCoordAttr = static_cast(glGetAttribLocation(shader, "vTexCoord")); glEnableVertexAttribArray(texCoordAttr); glVertexAttribPointer( - texCoordAttr, 2, GL_FLOAT, GL_FALSE, BgVertexVboRowLength * sizeof(bg->vertices[0]), - reinterpret_cast(2 * sizeof(bg->vertices[0]))); + texCoordAttr, 2, GL_FLOAT, GL_FALSE, BgVertexVboRowLength * sizeof(bg.vertices[0]), + reinterpret_cast(2 * sizeof(bg.vertices[0]))); } static glutils::GLTexture loadTexture( @@ -228,42 +238,42 @@ static glutils::GLTexture loadTexture( return tex; } -static void drawBackground(CBB *cbb) noexcept { - glBindVertexArray(cbb->vao); - if (cbb->updated) { - cbb->updated = false; - glutils::sendVbo(*cbb); +static void drawBackground(CBB &cbb) noexcept { + glBindVertexArray(cbb.vao); + if (cbb.updated) { + cbb.updated = false; + glutils::sendVbo(cbb); } - glBindTexture(GL_TEXTURE_2D, cbb->tex); - glDrawElements(GL_TRIANGLES, static_cast(cbb->elements.size()), GL_UNSIGNED_INT, nullptr); + glBindTexture(GL_TEXTURE_2D, cbb.tex); + glDrawElements(GL_TRIANGLES, static_cast(cbb.elements.size()), GL_UNSIGNED_INT, nullptr); } static void drawBackgrounds( - GlContext *gctx, + GlContext &gctx, ox::Size const&renderSz) noexcept { // load background shader and its uniforms - glUseProgram(gctx->bgShader); - const auto uniformXScale = static_cast(glGetUniformLocation(gctx->bgShader, "vXScale")); - const auto uniformTileHeight = static_cast(glGetUniformLocation(gctx->bgShader, "vTileHeight")); + glUseProgram(gctx.bgShader); + const auto uniformXScale = static_cast(glGetUniformLocation(gctx.bgShader, "vXScale")); + const auto uniformTileHeight = static_cast(glGetUniformLocation(gctx.bgShader, "vTileHeight")); const auto [wi, hi] = renderSz; const auto wf = static_cast(wi); const auto hf = static_cast(hi); glUniform1f(uniformXScale, hf / wf); - for (const auto &bg : gctx->backgrounds) { + for (const auto &bg : gctx.backgrounds) { if (bg.enabled) { - auto &cbb = gctx->cbbs[bg.cbbIdx]; + auto &cbb = gctx.cbbs[bg.cbbIdx]; const auto tileRows = cbb.tex.height / TileHeight; glUniform1f(uniformTileHeight, 1.0f / static_cast(tileRows)); - drawBackground(&cbb); + drawBackground(cbb); } } } -static void drawSprites(GlContext *gctx, ox::Size const&renderSz) noexcept { - glUseProgram(gctx->spriteShader); - auto &sb = gctx->spriteBlocks; - const auto uniformXScale = static_cast(glGetUniformLocation(gctx->bgShader, "vXScale")); - const auto uniformTileHeight = static_cast(glGetUniformLocation(gctx->spriteShader, "vTileHeight")); +static void drawSprites(GlContext &gctx, ox::Size const&renderSz) noexcept { + glUseProgram(gctx.spriteShader); + auto &sb = gctx.spriteBlocks; + const auto uniformXScale = static_cast(glGetUniformLocation(gctx.bgShader, "vXScale")); + const auto uniformTileHeight = static_cast(glGetUniformLocation(gctx.spriteShader, "vTileHeight")); const auto [wi, hi] = renderSz; const auto wf = static_cast(wi); const auto hf = static_cast(hi); @@ -302,31 +312,31 @@ static void loadPalette( glUniform4fv(uniformPalette, ColorCnt, palette.data()); } -static void loadBgPalette(GlContext *gctx, Palette const&pal) noexcept { - loadPalette(gctx->bgShader, pal); +static void loadBgPalette(GlContext &gctx, Palette const&pal) noexcept { + loadPalette(gctx.bgShader, pal); } -static void loadSpritePalette(GlContext *gctx, Palette const&pal) noexcept { - loadPalette(gctx->spriteShader, pal, true); +static void loadSpritePalette(GlContext &gctx, Palette const&pal) noexcept { + loadPalette(gctx.spriteShader, pal, true); } static void loadBgTexture( - GlContext *gctx, - unsigned cbbIdx, + GlContext &gctx, + uint_t cbbIdx, const void *pixels, int w, int h) noexcept { oxTracef("nostalgia::core::gfx::gl", "loadBgTexture: { cbbIdx: {}, w: {}, h: {} }", cbbIdx, w, h); - gctx->cbbs[cbbIdx].tex = loadTexture(w, h, pixels); + gctx.cbbs[cbbIdx].tex = loadTexture(w, h, pixels); } static void loadSpriteTexture( - GlContext *gctx, + GlContext &gctx, const void *pixels, int w, int h) noexcept { oxTracef("nostalgia::core::gfx::gl", "loadSpriteTexture: { w: {}, h: {} }", w, h); - gctx->spriteBlocks.tex = loadTexture(w, h, pixels); + gctx.spriteBlocks.tex = loadTexture(w, h, pixels); } } @@ -340,22 +350,22 @@ ox::Error initGfx( const auto bgFshad = ox::sfmt(renderer::bgfshadTmpl, glutils::GlslVersion); const auto spriteVshad = ox::sfmt(renderer::spritevshadTmpl, glutils::GlslVersion); const auto spriteFshad = ox::sfmt(renderer::spritefshadTmpl, glutils::GlslVersion); - auto &gctx = static_cast(*ctx); + auto &gctx = glctx(*ctx); oxReturnError(glutils::buildShaderProgram(bgVshad.c_str(), bgFshad.c_str()).moveTo(&gctx.bgShader)); oxReturnError( glutils::buildShaderProgram(spriteVshad.c_str(), spriteFshad.c_str()).moveTo(&gctx.spriteShader)); for (auto &bg : gctx.cbbs) { - initBackgroundBufferset(gctx.bgShader, &bg); + initBackgroundBufferset(gctx.bgShader, bg); } if (initParams.glInstallDrawer) { turbine::gl::addDrawer(gctx.turbineCtx, &gctx.drawer); - initSpritesBufferset(gctx.spriteShader, &gctx.spriteBlocks); + initSpritesBufferset(gctx.spriteShader, gctx.spriteBlocks); } return {}; } void shutdownGfx(Context &ctx) noexcept { - auto &gctx = static_cast(ctx); + auto &gctx = glctx(ctx); turbine::gl::removeDrawer(gctx.turbineCtx, &gctx.drawer); } @@ -366,9 +376,9 @@ struct TileSheetData { }; static ox::Result loadTileSheet( - Context *ctx, CompactTileSheet const&tilesheet) noexcept { - auto &gctx = static_cast(*ctx); - const unsigned bytesPerTile = tilesheet.bpp == 8 ? PixelsPerTile : PixelsPerTile / 2; + Context &ctx, CompactTileSheet const&tilesheet) noexcept { + auto &gctx = glctx(ctx); + const uint_t bytesPerTile = tilesheet.bpp == 8 ? PixelsPerTile : PixelsPerTile / 2; const auto tiles = tilesheet.pixels.size() / bytesPerTile; constexpr int width = 8; const int height = 8 * static_cast(tiles); @@ -385,22 +395,22 @@ static ox::Result loadTileSheet( pixels[i * 2 + 1] = tilesheet.pixels[i] >> 4; } } - renderer::loadSpriteTexture(&gctx, pixels.data(), width, height); + renderer::loadSpriteTexture(gctx, pixels.data(), width, height); return TileSheetData{std::move(pixels), width, height}; } ox::Error loadBgTileSheet( Context *ctx, - unsigned cbb, + uint_t cbb, ox::FileAddress const&tilesheetAddr, ox::FileAddress const&paletteAddr) noexcept { - auto &gctx = static_cast(*ctx); + auto &gctx = glctx(*ctx); auto &kctx = gctx.turbineCtx.keelCtx; oxRequire(tilesheet, readObj(&kctx, tilesheetAddr)); oxRequire(palette, readObj(&kctx, paletteAddr ? paletteAddr : tilesheet->defaultPalette)); - oxRequire(tsd, loadTileSheet(ctx, *tilesheet)); - renderer::loadBgTexture(&gctx, cbb, tsd.pixels.data(), tsd.width, tsd.height); - renderer::loadBgPalette(&gctx, *palette); + oxRequire(tsd, loadTileSheet(*ctx, *tilesheet)); + renderer::loadBgTexture(gctx, cbb, tsd.pixels.data(), tsd.width, tsd.height); + renderer::loadBgPalette(gctx, *palette); return {}; } @@ -408,13 +418,13 @@ ox::Error loadSpriteTileSheet( Context *ctx, ox::FileAddress const&tilesheetAddr, ox::FileAddress const&paletteAddr) noexcept { - auto &gctx = static_cast(*ctx); + auto &gctx = glctx(*ctx); auto &kctx = gctx.turbineCtx.keelCtx; oxRequire(tilesheet, readObj(&kctx, tilesheetAddr)); oxRequire(palette, readObj(&kctx, paletteAddr ? paletteAddr : tilesheet->defaultPalette)); - oxRequire(tsd, loadTileSheet(ctx, *tilesheet)); - renderer::loadSpriteTexture(&gctx, tsd.pixels.data(), tsd.width, tsd.height); - renderer::loadSpritePalette(&gctx, *palette); + oxRequire(tsd, loadTileSheet(*ctx, *tilesheet)); + renderer::loadSpriteTexture(gctx, tsd.pixels.data(), tsd.width, tsd.height); + renderer::loadSpritePalette(gctx, *palette); return {}; } @@ -427,7 +437,7 @@ ox::Error initConsole(Context *ctx) noexcept { } void puts(Context *ctx, int column, int row, ox::CRStringView str) noexcept { - const auto col = static_cast(column); + const auto col = static_cast(column); for (auto i = 0u; i < str.bytes(); ++i) { setTile( ctx, @@ -438,48 +448,48 @@ void puts(Context *ctx, int column, int row, ox::CRStringView str) noexcept { } } -void setBgCbb(Context *ctx, unsigned bgIdx, unsigned cbbIdx) noexcept { - auto &gctx = static_cast(*ctx); +void setBgCbb(Context *ctx, uint_t bgIdx, uint_t cbbIdx) noexcept { + auto &gctx = glctx(*ctx); auto &bg = gctx.backgrounds[bgIdx]; bg.cbbIdx = cbbIdx; } uint8_t bgStatus(Context *ctx) noexcept { - const auto &gctx = static_cast(*ctx); + const auto &gctx = glctx(*ctx); uint8_t out = 0; - for (unsigned i = 0; i < gctx.cbbs.size(); ++i) { - out |= static_cast(static_cast(gctx.backgrounds[i].enabled) << i); + for (uint_t i = 0; i < gctx.cbbs.size(); ++i) { + out |= static_cast(static_cast(gctx.backgrounds[i].enabled) << i); } return out; } void setBgStatus(Context *ctx, uint32_t status) noexcept { - auto &gctx = static_cast(*ctx); - for (unsigned i = 0; i < gctx.cbbs.size(); ++i) { + auto &gctx = glctx(*ctx); + for (uint_t i = 0; i < gctx.cbbs.size(); ++i) { gctx.backgrounds[i].enabled = (status >> i) & 1; } } -bool bgStatus(Context *ctx, unsigned bg) noexcept { - const auto &gctx = static_cast(*ctx); +bool bgStatus(Context *ctx, uint_t bg) noexcept { + const auto &gctx = glctx(*ctx); return gctx.backgrounds[bg].enabled; } -void setBgStatus(Context *ctx, unsigned bg, bool status) noexcept { - auto &gctx = static_cast(*ctx); +void setBgStatus(Context *ctx, uint_t bg, bool status) noexcept { + auto &gctx = glctx(*ctx); gctx.backgrounds[bg].enabled = status; } -void clearTileLayer(Context *ctx, unsigned bgIdx) noexcept { - auto &gctx = static_cast(*ctx); +void clearTileLayer(Context *ctx, uint_t bgIdx) noexcept { + auto &gctx = glctx(*ctx); auto &bg = gctx.cbbs[static_cast(bgIdx)]; - initBackgroundBufferObjects(&bg); + initBackgroundBufferObjects(bg); bg.updated = true; } -void hideSprite(Context *ctx, unsigned idx) noexcept { - auto &gctx = static_cast(*ctx); +void hideSprite(Context *ctx, uint_t idx) noexcept { + auto &gctx = glctx(*ctx); auto vbo = &gctx.spriteBlocks.vertices[idx * renderer::SpriteVertexVboLength]; auto ebo = &gctx.spriteBlocks.elements[idx * renderer::SpriteVertexEboLength]; renderer::setSpriteBufferObject(idx * renderer::SpriteVertexVboRows, 0, @@ -489,17 +499,17 @@ void hideSprite(Context *ctx, unsigned idx) noexcept { void setSprite( Context *ctx, - unsigned idx, + uint_t idx, int x, int y, - unsigned tileIdx, - unsigned spriteShape, - unsigned spriteSize, - unsigned flipX) noexcept { + uint_t tileIdx, + uint_t spriteShape, + uint_t spriteSize, + uint_t flipX) noexcept { //oxTracef("nostalgia::core::gfx::gl", "setSprite(ctx, {}, {}, {}, {}, {}, {}, {})", // idx, x, y, tileIdx, spriteShape, spriteSize, flipX); // Tonc Table 8.4 - static constexpr ox::Array, 12> dimensions{ + static constexpr ox::Array, 12> dimensions{ // col 0 {1, 1}, // 0, 0 {2, 2}, // 0, 1 @@ -519,7 +529,7 @@ void setSprite( const auto dim = dimensions[(spriteShape << 2) | spriteSize]; const auto uX = static_cast(x) % 255; const auto uY = static_cast(y + 8) % 255 - 8; - auto &gctx = static_cast(*ctx); + auto &gctx = glctx(*ctx); auto i = 0u; const auto set = [&](int xIt, int yIt) { const auto fX = static_cast(uX + xIt * 8) / 8; @@ -549,7 +559,7 @@ void setSprite( void setTile( Context *ctx, - unsigned bgIdx, + uint_t bgIdx, int column, int row, uint8_t tile) noexcept { @@ -557,16 +567,16 @@ void setTile( "nostalgia::core::gfx::setTile", "bgIdx: {}, column: {}, row: {}, tile: {}", bgIdx, column, row, tile); - auto &gctx = static_cast(*ctx); - const auto z = static_cast(bgIdx); - const auto y = static_cast(row); - const auto x = static_cast(column); + auto &gctx = glctx(*ctx); + 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 &bg = gctx.cbbs[z]; auto vbo = &bg.vertices[i * renderer::BgVertexVboLength]; auto ebo = &bg.elements[i * renderer::BgVertexEboLength]; renderer::setTileBufferObject( - static_cast(i * renderer::BgVertexVboRows), + static_cast(i * renderer::BgVertexVboRows), static_cast(x), static_cast(y), tile, @@ -577,13 +587,13 @@ void setTile( namespace gl { -void drawMainView(core::Context *ctx, ox::Size const&renderSz) noexcept { +void drawMainView(core::Context &ctx, ox::Size const&renderSz) noexcept { glViewport(0, 0, renderSz.width, renderSz.height); glutils::clearScreen(); - auto &gctx = static_cast(*ctx); - renderer::drawBackgrounds(&gctx, renderSz); + auto &gctx = glctx(ctx); + renderer::drawBackgrounds(gctx, renderSz); if (gctx.spriteBlocks.tex) { - renderer::drawSprites(&gctx, renderSz); + renderer::drawSprites(gctx, renderSz); } } diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor-imgui.hpp b/src/nostalgia/modules/core/src/studio/paletteeditor-imgui.hpp index 32e4b717..b015bf64 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor-imgui.hpp +++ b/src/nostalgia/modules/core/src/studio/paletteeditor-imgui.hpp @@ -7,6 +7,7 @@ #include #include +#include namespace nostalgia::core { diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor.hpp b/src/nostalgia/modules/core/src/studio/paletteeditor.hpp index 86e1289f..43bced85 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor.hpp +++ b/src/nostalgia/modules/core/src/studio/paletteeditor.hpp @@ -6,7 +6,9 @@ #include +#include #include +#include namespace nostalgia::core { @@ -105,4 +107,4 @@ class MoveColorCommand: public studio::UndoCommand { void moveColor(int idx, int offset) noexcept; }; -} \ No newline at end of file +} diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditormodel.hpp b/src/nostalgia/modules/core/src/studio/tilesheeteditormodel.hpp index a79a91f5..5ead1eae 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditormodel.hpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditormodel.hpp @@ -12,6 +12,7 @@ #include #include +#include namespace nostalgia::core { diff --git a/src/nostalgia/modules/core/src/studio/tilesheetpixelgrid.hpp b/src/nostalgia/modules/core/src/studio/tilesheetpixelgrid.hpp index 9649d0fb..77f0c5bf 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheetpixelgrid.hpp +++ b/src/nostalgia/modules/core/src/studio/tilesheetpixelgrid.hpp @@ -8,6 +8,7 @@ #include #include +#include namespace nostalgia::core { diff --git a/src/nostalgia/modules/core/src/studio/tilesheetpixels.hpp b/src/nostalgia/modules/core/src/studio/tilesheetpixels.hpp index 5cca246d..61a5ee13 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheetpixels.hpp +++ b/src/nostalgia/modules/core/src/studio/tilesheetpixels.hpp @@ -9,6 +9,7 @@ #include #include +#include #include namespace nostalgia::core { diff --git a/src/nostalgia/modules/scene/include/nostalgia/scene/scenestatic.hpp b/src/nostalgia/modules/scene/include/nostalgia/scene/scenestatic.hpp index 531ff510..be781770 100644 --- a/src/nostalgia/modules/scene/include/nostalgia/scene/scenestatic.hpp +++ b/src/nostalgia/modules/scene/include/nostalgia/scene/scenestatic.hpp @@ -58,9 +58,10 @@ struct TileDoc { }; oxModelBegin(TileDoc) - oxModelFieldRename(subsheet_id, subsheetId); - oxModelFieldRename(subsheet_path, subsheetPath); - oxModelField(type); + oxModelFieldRename(subsheet_id, subsheetId) + oxModelFieldRename(subsheet_path, subsheetPath) + oxModelField(type) + oxModelFieldRename(layer_attachments, layerAttachments) oxModelEnd() struct SceneDoc { diff --git a/src/nostalgia/modules/scene/src/studio/sceneeditorview.cpp b/src/nostalgia/modules/scene/src/studio/sceneeditorview.cpp index f802c4eb..fbe715f4 100644 --- a/src/nostalgia/modules/scene/src/studio/sceneeditorview.cpp +++ b/src/nostalgia/modules/scene/src/studio/sceneeditorview.cpp @@ -23,7 +23,7 @@ void SceneEditorView::draw(int width, int height) noexcept { glutils::resizeInitFrameBuffer(&m_frameBuffer, width, height); } const glutils::FrameBufferBind frameBufferBind(m_frameBuffer); - core::gl::drawMainView(m_cctx.get(), {width, height}); + core::gl::drawMainView(*m_cctx, {width, height}); } const glutils::FrameBuffer &SceneEditorView::framebuffer() const noexcept {