Compare commits
10 Commits
release-d2
...
0de428a2e5
Author | SHA1 | Date | |
---|---|---|---|
0de428a2e5 | |||
8a52df4f76 | |||
efec6eb3c8 | |||
56eeb24900 | |||
ae81f6b3de | |||
c1108301c0 | |||
83fbe6ac74 | |||
80b452833f | |||
0fa394333b | |||
cae7535034 |
7
deps/ox/src/ox/std/span.hpp
vendored
7
deps/ox/src/ox/std/span.hpp
vendored
@@ -146,12 +146,7 @@ class Span {
|
||||
return iterator<const T&, const T*, true>(m_items, MaxValue<size_type>, m_size);
|
||||
}
|
||||
|
||||
constexpr T &operator[](std::size_t i) noexcept {
|
||||
boundsCheck(__FILE__, __LINE__, i, size(), "Span access overflow");
|
||||
return m_items[i];
|
||||
}
|
||||
|
||||
constexpr T const&operator[](std::size_t i) const noexcept {
|
||||
constexpr T &operator[](std::size_t i) const noexcept {
|
||||
boundsCheck(__FILE__, __LINE__, i, size(), "Span access overflow");
|
||||
return m_items[i];
|
||||
}
|
||||
|
@@ -1,19 +1,24 @@
|
||||
# d2025.06.0
|
||||
|
||||
* PaletteEditor: Add RGB key shortcuts for focusing color channels
|
||||
|
||||
# d2025.05.0
|
||||
|
||||
* Add app icon for both window and file
|
||||
* Change application font to Roboto Medium
|
||||
* Closing application will now confirm with user if any files have unsaved
|
||||
changes.
|
||||
* UUID duplicates will now be reported when opening a project
|
||||
* Deleting a directory now closes files in that directory
|
||||
* Delete key now initiates deletion of selected directory
|
||||
* UUID duplicates will now be reported when opening a project.
|
||||
* Deleting a directory now closes files in that directory.
|
||||
* Delete key now initiates deletion of selected directory.
|
||||
* Remove ability to re-order tabs. There were bugs associated with that.
|
||||
* TileSheetEditor: Fix selection clearing in to work when clicking outside
|
||||
image.
|
||||
* Mac: Menu bar shortcuts now say Cmd instead of Ctrl.
|
||||
* TileSheetEditor: Fix selection clearing to work when clicking outside image.
|
||||
* TileSheetEditor: Fix Delete Tile functionality, which was completely broken
|
||||
* PaletteEditor: Fix color number key range in. Previously, pressing A caused
|
||||
the editor to jump to the last color.
|
||||
* PaletteEditor: page rename will now take effect upon pressing enter if the
|
||||
* TileSheetEditor: Fix Insert Tile functionality, which was completely broken
|
||||
* PaletteEditor: Fix color number key range. Previously, pressing A caused the
|
||||
editor to jump to the last color.
|
||||
* PaletteEditor: Page rename will now take effect upon pressing enter if the
|
||||
text input has focus
|
||||
|
||||
# d2025.02.1
|
||||
|
@@ -223,7 +223,7 @@ bool bgStatus(Context &ctx, unsigned bg) noexcept;
|
||||
|
||||
void setBgStatus(Context &ctx, unsigned bg, bool status) noexcept;
|
||||
|
||||
void setBgCbb(Context &ctx, unsigned bgIdx, unsigned cbb) noexcept;
|
||||
void setBgCbb(Context &ctx, unsigned bgIdx, unsigned cbbIdx) noexcept;
|
||||
|
||||
void setBgPriority(Context &ctx, uint_t bgIdx, uint_t priority) noexcept;
|
||||
|
||||
@@ -231,10 +231,10 @@ void hideSprite(Context &ctx, unsigned) noexcept;
|
||||
|
||||
void showSprite(Context &ctx, unsigned) noexcept;
|
||||
|
||||
void setSprite(Context &c, uint_t idx, Sprite const&s) noexcept;
|
||||
void setSprite(Context &ctx, uint_t idx, Sprite const&sprite) noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
uint_t spriteCount(Context &ctx) noexcept;
|
||||
uint_t spriteCount(Context const &ctx) noexcept;
|
||||
|
||||
ox::Error initConsole(Context &ctx) noexcept;
|
||||
|
||||
|
@@ -22,7 +22,7 @@ ox::Error initGfx(Context &ctx, InitParams const&) noexcept;
|
||||
ox::Result<ox::UPtr<Context>> init(turbine::Context &tctx, InitParams const¶ms) noexcept {
|
||||
auto ctx = ox::make_unique<Context>(tctx);
|
||||
OX_RETURN_ERROR(initGfx(*ctx, params));
|
||||
return ox::UPtr<Context>(std::move(ctx));
|
||||
return ctx;
|
||||
}
|
||||
|
||||
keel::Context &keelCtx(Context &ctx) noexcept {
|
||||
|
@@ -36,9 +36,9 @@ ox::Error initGfx(Context&, InitParams const&) noexcept {
|
||||
|
||||
ox::Error loadBgPalette(
|
||||
Context&,
|
||||
size_t palBank,
|
||||
size_t const palBank,
|
||||
CompactPalette const&palette,
|
||||
size_t page) noexcept {
|
||||
size_t const page) noexcept {
|
||||
if (palette.pages.empty()) {
|
||||
return {};
|
||||
}
|
||||
@@ -52,7 +52,7 @@ ox::Error loadBgPalette(
|
||||
ox::Error loadSpritePalette(
|
||||
Context&,
|
||||
CompactPalette const&palette,
|
||||
size_t page) noexcept {
|
||||
size_t const page) noexcept {
|
||||
if (palette.pages.empty()) {
|
||||
return {};
|
||||
}
|
||||
@@ -133,7 +133,7 @@ ox::Error loadBgTileSheet(
|
||||
|
||||
ox::Error loadBgTileSheet(
|
||||
Context &ctx,
|
||||
unsigned cbb,
|
||||
unsigned const cbb,
|
||||
CompactTileSheet const&ts,
|
||||
ox::Optional<unsigned> const&paletteBank) noexcept {
|
||||
auto const cnt = (ts.pixels.size() * PixelsPerTile) / (1 + (ts.bpp == 4));
|
||||
@@ -184,7 +184,7 @@ static void setSpritesBpp(unsigned const bpp) noexcept {
|
||||
ox::Error loadSpriteTileSheet(
|
||||
Context &ctx,
|
||||
CompactTileSheet const&ts,
|
||||
bool loadDefaultPalette) noexcept {
|
||||
bool const loadDefaultPalette) noexcept {
|
||||
for (size_t i = 0; i < ts.pixels.size(); i += 2) {
|
||||
uint16_t v = ts.pixels[i];
|
||||
v |= static_cast<uint16_t>(ts.pixels[i + 1] << 8);
|
||||
@@ -206,7 +206,8 @@ ox::Error loadSpriteTileSheet(
|
||||
return {};
|
||||
}
|
||||
|
||||
void setBgTile(Context &ctx, uint_t bgIdx, int column, int row, BgTile const&tile) noexcept {
|
||||
void setBgTile(
|
||||
Context &ctx, uint_t const bgIdx, int const column, int const row, BgTile const&tile) noexcept {
|
||||
auto const tileIdx = static_cast<std::size_t>(row * tileColumns(ctx) + column);
|
||||
// see Tonc 9.3
|
||||
MEM_BG_MAP[bgIdx][tileIdx] =
|
||||
@@ -216,7 +217,7 @@ void setBgTile(Context &ctx, uint_t bgIdx, int column, int row, BgTile const&til
|
||||
static_cast<uint16_t>(tile.palBank << 0xc);
|
||||
}
|
||||
|
||||
void clearBg(Context &ctx, uint_t bgIdx) noexcept {
|
||||
void clearBg(Context &ctx, uint_t const bgIdx) noexcept {
|
||||
memset(MEM_BG_MAP[bgIdx].data(), 0, static_cast<size_t>(tileRows(ctx) * tileColumns(ctx)));
|
||||
}
|
||||
|
||||
@@ -224,39 +225,39 @@ uint8_t bgStatus(Context&) noexcept {
|
||||
return (REG_DISPCTL >> 8u) & 0b1111u;
|
||||
}
|
||||
|
||||
void setBgStatus(Context&, uint32_t status) noexcept {
|
||||
void setBgStatus(Context&, uint32_t const status) noexcept {
|
||||
constexpr auto BgStatus = 8;
|
||||
REG_DISPCTL = (REG_DISPCTL & ~0b111100000000u) | status << BgStatus;
|
||||
}
|
||||
|
||||
bool bgStatus(Context&, unsigned bg) noexcept {
|
||||
bool bgStatus(Context&, unsigned const bg) noexcept {
|
||||
return (REG_DISPCTL >> (8 + bg)) & 1;
|
||||
}
|
||||
|
||||
void setBgStatus(Context&, unsigned bg, bool status) noexcept {
|
||||
void setBgStatus(Context&, unsigned const bg, bool const status) noexcept {
|
||||
constexpr auto Bg0Status = 8;
|
||||
const auto mask = static_cast<uint32_t>(status) << (Bg0Status + bg);
|
||||
REG_DISPCTL = REG_DISPCTL | ((REG_DISPCTL & ~mask) | mask);
|
||||
}
|
||||
|
||||
void setBgBpp(Context&, unsigned bgIdx, unsigned bpp) noexcept {
|
||||
void setBgBpp(Context&, unsigned const bgIdx, unsigned const bpp) noexcept {
|
||||
auto &bgCtl = regBgCtl(bgIdx);
|
||||
teagba::bgSetBpp(bgCtl, bpp);
|
||||
}
|
||||
|
||||
void setBgCbb(Context &ctx, unsigned bgIdx, unsigned cbb) noexcept {
|
||||
void setBgCbb(Context &ctx, unsigned const bgIdx, unsigned const cbbIdx) noexcept {
|
||||
auto &bgCtl = regBgCtl(bgIdx);
|
||||
const auto &cbbData = ctx.cbbData[cbb];
|
||||
const auto &cbbData = ctx.cbbData[cbbIdx];
|
||||
teagba::bgSetBpp(bgCtl, cbbData.bpp);
|
||||
teagba::bgSetCbb(bgCtl, cbb);
|
||||
teagba::bgSetCbb(bgCtl, cbbIdx);
|
||||
}
|
||||
|
||||
void setBgPriority(Context&, uint_t bgIdx, uint_t priority) noexcept {
|
||||
void setBgPriority(Context&, uint_t const bgIdx, uint_t const priority) noexcept {
|
||||
auto &bgCtl = regBgCtl(bgIdx);
|
||||
bgCtl = (bgCtl & 0b1111'1111'1111'1100u) | (priority & 0b11);
|
||||
}
|
||||
|
||||
void hideSprite(Context&, unsigned idx) noexcept {
|
||||
void hideSprite(Context&, unsigned const idx) noexcept {
|
||||
//oxAssert(g_spriteUpdates < config::GbaSpriteBufferLen, "Sprite update buffer overflow");
|
||||
teagba::addSpriteUpdate({
|
||||
.attr0 = uint16_t{0b11 << 8},
|
||||
@@ -264,7 +265,7 @@ void hideSprite(Context&, unsigned idx) noexcept {
|
||||
});
|
||||
}
|
||||
|
||||
void showSprite(Context&, unsigned idx) noexcept {
|
||||
void showSprite(Context&, unsigned const idx) noexcept {
|
||||
//oxAssert(g_spriteUpdates < config::GbaSpriteBufferLen, "Sprite update buffer overflow");
|
||||
teagba::addSpriteUpdate({
|
||||
.attr0 = 0,
|
||||
@@ -272,7 +273,7 @@ void showSprite(Context&, unsigned idx) noexcept {
|
||||
});
|
||||
}
|
||||
|
||||
void setSprite(Context&, uint_t idx, Sprite const&s) noexcept {
|
||||
void setSprite(Context&, uint_t const idx, Sprite const&s) noexcept {
|
||||
//oxAssert(g_spriteUpdates < config::GbaSpriteBufferLen, "Sprite update buffer overflow");
|
||||
uint16_t const eightBpp = s.bpp == 8;
|
||||
teagba::addSpriteUpdate({
|
||||
@@ -293,7 +294,7 @@ void setSprite(Context&, uint_t idx, Sprite const&s) noexcept {
|
||||
});
|
||||
}
|
||||
|
||||
uint_t spriteCount(Context&) noexcept {
|
||||
uint_t spriteCount(Context const&) noexcept {
|
||||
return SpriteCount;
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,7 @@ Context::~Context() noexcept {
|
||||
ox::Result<ox::UPtr<Context>> init(turbine::Context &tctx, InitParams const¶ms) noexcept {
|
||||
auto ctx = ox::make_unique<Context>(tctx, params);
|
||||
OX_RETURN_ERROR(initGfx(*ctx, params));
|
||||
return ox::UPtr<Context>(ctx.release());
|
||||
return ctx;
|
||||
}
|
||||
|
||||
keel::Context &keelCtx(Context &ctx) noexcept {
|
||||
|
@@ -28,7 +28,7 @@ static constexpr auto PriorityScale = 0.01f;
|
||||
Drawer::Drawer(Context &ctx) noexcept: m_ctx(ctx) {}
|
||||
|
||||
void Drawer::draw(turbine::Context &tctx) noexcept {
|
||||
gfx::gl::draw(m_ctx, turbine::getScreenSize(tctx));
|
||||
gl::draw(m_ctx, turbine::getScreenSize(tctx));
|
||||
}
|
||||
|
||||
static constexpr ox::CStringView bgvshadTmpl = R"glsl(
|
||||
@@ -106,7 +106,7 @@ static constexpr ox::CStringView spritefshadTmpl = R"glsl(
|
||||
})glsl";
|
||||
|
||||
[[nodiscard]]
|
||||
static constexpr auto bgVertexRow(uint_t x, uint_t y) noexcept {
|
||||
static constexpr auto bgVertexRow(uint_t const x, uint_t const y) noexcept {
|
||||
return y * TileRows + x;
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ static void setTileBufferObject(
|
||||
ox::spancpy<GLuint>(ebo, elms);
|
||||
}
|
||||
|
||||
static void initSpriteBufferObjects(Context &ctx, glutils::BufferSet &bs) noexcept {
|
||||
static void initSpriteBufferObjects(Context const &ctx, glutils::BufferSet &bs) noexcept {
|
||||
for (auto i = 0u; i < ctx.spriteCount; ++i) {
|
||||
auto const vbo = ox::Span{bs.vertices}
|
||||
+ i * static_cast<std::size_t>(SpriteVertexVboLength);
|
||||
@@ -256,7 +256,7 @@ static void initSpritesBufferset(Context &ctx) noexcept {
|
||||
}
|
||||
|
||||
static void initBackgroundBufferset(
|
||||
GLuint shader,
|
||||
GLuint const shader,
|
||||
glutils::BufferSet &bs) noexcept {
|
||||
// vao
|
||||
bs.vao = glutils::generateVertexArrayObject();
|
||||
@@ -290,8 +290,8 @@ static void initBackgroundBufferset(
|
||||
}
|
||||
|
||||
static glutils::GLTexture createTexture(
|
||||
GLsizei w,
|
||||
GLsizei h,
|
||||
GLsizei const w,
|
||||
GLsizei const h,
|
||||
void const*pixels) noexcept {
|
||||
GLuint texId = 0;
|
||||
glGenTextures(1, &texId);
|
||||
@@ -375,10 +375,10 @@ static void drawSprites(Context &ctx, ox::Size const&renderSz) noexcept {
|
||||
|
||||
static void loadPalette(
|
||||
ox::Array<GLfloat, 1024> &palette,
|
||||
size_t palOffset,
|
||||
GLuint shaderPgrm,
|
||||
size_t const palOffset,
|
||||
GLuint const shaderPgrm,
|
||||
CompactPalette const&pal,
|
||||
size_t page = 0) noexcept {
|
||||
size_t const page = 0) noexcept {
|
||||
static constexpr std::size_t ColorCnt = 256;
|
||||
for (auto i = palOffset; auto const c : pal.pages[page]) {
|
||||
palette[i++] = redf(c);
|
||||
@@ -523,14 +523,18 @@ static ox::Result<TileSheetData> normalizeTileSheet(
|
||||
pixels[i * 2 + 1] = ts.pixels[i] >> 4;
|
||||
}
|
||||
}
|
||||
return TileSheetData{std::move(pixels), width, height};
|
||||
return TileSheetData{
|
||||
.pixels = std::move(pixels),
|
||||
.width = width,
|
||||
.height = height
|
||||
};
|
||||
}
|
||||
|
||||
ox::Error loadBgPalette(
|
||||
Context &ctx,
|
||||
size_t palBank,
|
||||
size_t const palBank,
|
||||
CompactPalette const&palette,
|
||||
size_t page) noexcept {
|
||||
size_t const page) noexcept {
|
||||
renderer::loadPalette(ctx.bgPalette, palBank * 16 * 4, ctx.bgShader, palette, page);
|
||||
return {};
|
||||
}
|
||||
@@ -538,14 +542,14 @@ ox::Error loadBgPalette(
|
||||
ox::Error loadSpritePalette(
|
||||
Context &ctx,
|
||||
CompactPalette const&palette,
|
||||
size_t page) noexcept {
|
||||
size_t const page) noexcept {
|
||||
ox::Array<GLfloat, 1024> pal;
|
||||
renderer::loadPalette(pal, 0, ctx.spriteShader, palette, page);
|
||||
return {};
|
||||
}
|
||||
|
||||
static ox::Result<TileSheetData> buildSetTsd(
|
||||
Context &ctx,
|
||||
Context const &ctx,
|
||||
TileSheetSet const&set) noexcept {
|
||||
auto &kctx = keelCtx(ctx.turbineCtx);
|
||||
TileSheetData setTsd;
|
||||
@@ -567,7 +571,7 @@ static ox::Result<TileSheetData> buildSetTsd(
|
||||
|
||||
static void copyPixels(
|
||||
CompactTileSheet const&ts,
|
||||
ox::Span<uint32_t> dst,
|
||||
ox::Span<uint32_t> const dst,
|
||||
size_t const srcPxIdx,
|
||||
size_t const pxlCnt) noexcept {
|
||||
size_t idx{};
|
||||
@@ -624,7 +628,7 @@ ox::Error loadBgTileSheet(
|
||||
|
||||
ox::Error loadBgTileSheet(
|
||||
Context &ctx,
|
||||
uint_t cbb,
|
||||
uint_t const cbb,
|
||||
CompactTileSheet const&ts,
|
||||
ox::Optional<unsigned> const&paletteBank) noexcept {
|
||||
auto const bytesPerTile = static_cast<uint64_t>(PixelsPerTile / (1 + (ts.bpp == 4)));
|
||||
@@ -638,7 +642,7 @@ ox::Error loadBgTileSheet(
|
||||
|
||||
ox::Error loadBgTileSheet(
|
||||
Context &ctx,
|
||||
unsigned cbb,
|
||||
unsigned const cbb,
|
||||
TileSheetSet const&set) noexcept {
|
||||
OX_REQUIRE(setTsd, buildSetTsd(ctx, set));
|
||||
ctx.cbbs[cbb].tex = renderer::createTexture(setTsd.width, setTsd.height, setTsd.pixels.data());
|
||||
@@ -648,7 +652,7 @@ ox::Error loadBgTileSheet(
|
||||
ox::Error loadSpriteTileSheet(
|
||||
Context &ctx,
|
||||
CompactTileSheet const&ts,
|
||||
bool loadDefaultPalette) noexcept {
|
||||
bool const loadDefaultPalette) noexcept {
|
||||
OX_REQUIRE(tsd, normalizeTileSheet(ts));
|
||||
oxTracef("nostalgia.gfx.gl", "loadSpriteTexture: { w: {}, h: {} }", tsd.width, tsd.height);
|
||||
ctx.spriteBlocks.tex = renderer::createTexture(tsd.width, tsd.height, tsd.pixels.data());
|
||||
@@ -668,9 +672,9 @@ ox::Error loadSpriteTileSheet(
|
||||
|
||||
void setBgTile(
|
||||
Context &ctx,
|
||||
uint_t bgIdx,
|
||||
int column,
|
||||
int row,
|
||||
uint_t const bgIdx,
|
||||
int const column,
|
||||
int const row,
|
||||
BgTile const&tile) noexcept {
|
||||
oxTracef(
|
||||
"nostalgia.gfx.setBgTile",
|
||||
@@ -698,7 +702,7 @@ void setBgTile(
|
||||
cbb.updated = true;
|
||||
}
|
||||
|
||||
void clearBg(Context &ctx, uint_t bgIdx) noexcept {
|
||||
void clearBg(Context &ctx, uint_t const bgIdx) noexcept {
|
||||
auto &cbb = ctx.cbbs[static_cast<std::size_t>(bgIdx)];
|
||||
initBackgroundBufferObjects(cbb);
|
||||
cbb.updated = true;
|
||||
@@ -714,61 +718,59 @@ uint8_t bgStatus(Context &ctx) noexcept {
|
||||
return out;
|
||||
}
|
||||
|
||||
void setBgStatus(Context &ctx, uint32_t status) noexcept {
|
||||
void setBgStatus(Context &ctx, uint32_t const status) noexcept {
|
||||
for (uint_t i = 0; i < ctx.cbbs.size(); ++i) {
|
||||
ctx.backgrounds[i].enabled = (status >> i) & 1;
|
||||
}
|
||||
}
|
||||
|
||||
bool bgStatus(Context &ctx, uint_t bg) noexcept {
|
||||
bool bgStatus(Context &ctx, uint_t const bg) noexcept {
|
||||
return ctx.backgrounds[bg].enabled;
|
||||
}
|
||||
|
||||
void setBgStatus(Context&ctx, uint_t bg, bool status) noexcept {
|
||||
void setBgStatus(Context&ctx, uint_t const bg, bool const status) noexcept {
|
||||
ctx.backgrounds[bg].enabled = status;
|
||||
}
|
||||
|
||||
void setBgBpp(Context&, unsigned, unsigned) noexcept {}
|
||||
|
||||
void setBgCbb(Context &ctx, uint_t bgIdx, uint_t cbbIdx) noexcept {
|
||||
void setBgCbb(Context &ctx, uint_t const bgIdx, uint_t const cbbIdx) noexcept {
|
||||
auto &bg = ctx.backgrounds[bgIdx];
|
||||
bg.cbbIdx = cbbIdx;
|
||||
}
|
||||
|
||||
void setBgPriority(Context &ctx, uint_t bgIdx, uint_t priority) noexcept {
|
||||
void setBgPriority(Context &ctx, uint_t const bgIdx, uint_t const priority) noexcept {
|
||||
auto &bg = ctx.backgrounds[bgIdx];
|
||||
bg.priority = static_cast<float>(priority & 0b11);
|
||||
}
|
||||
|
||||
void hideSprite(Context &ctx, uint_t idx) noexcept {
|
||||
void hideSprite(Context &ctx, uint_t const idx) noexcept {
|
||||
auto &s = ctx.spriteStates[idx];
|
||||
s.enabled = false;
|
||||
renderer::setSprite(ctx, idx, s);
|
||||
}
|
||||
|
||||
void showSprite(Context &ctx, uint_t idx) noexcept {
|
||||
void showSprite(Context &ctx, uint_t const idx) noexcept {
|
||||
auto &s = ctx.spriteStates[idx];
|
||||
s.enabled = true;
|
||||
renderer::setSprite(ctx, idx, s);
|
||||
}
|
||||
|
||||
void setSprite(Context &ctx, uint_t idx, Sprite const&sprite) noexcept {
|
||||
void setSprite(Context &ctx, uint_t const idx, Sprite const&sprite) noexcept {
|
||||
auto &s = ctx.spriteStates[idx];
|
||||
s = sprite;
|
||||
renderer::setSprite(ctx, idx, s);
|
||||
}
|
||||
|
||||
uint_t spriteCount(Context &ctx) noexcept {
|
||||
uint_t spriteCount(Context const &ctx) noexcept {
|
||||
return ctx.spriteCount;
|
||||
}
|
||||
|
||||
namespace gl {
|
||||
|
||||
ox::Size drawSize(int scale) noexcept {
|
||||
ox::Size drawSize(int const scale) noexcept {
|
||||
return {240 * scale, 160 * scale};
|
||||
}
|
||||
|
||||
void draw(gfx::Context &ctx, ox::Size const&renderSz) noexcept {
|
||||
void draw(Context &ctx, ox::Size const&renderSz) noexcept {
|
||||
glViewport(0, 0, renderSz.width, renderSz.height);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_BLEND);
|
||||
@@ -783,7 +785,7 @@ void draw(gfx::Context &ctx, ox::Size const&renderSz) noexcept {
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
void draw(gfx::Context &ctx, int scale) noexcept {
|
||||
void draw(Context &ctx, int const scale) noexcept {
|
||||
draw(ctx, drawSize(scale));
|
||||
}
|
||||
|
||||
|
@@ -118,12 +118,12 @@ void PaletteEditorImGui::navigateTo(ox::StringViewCR arg) noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
void PaletteEditorImGui::drawColumnLeftAlign(ox::CStringView txt) noexcept {
|
||||
void PaletteEditorImGui::drawColumnLeftAlign(ox::CStringViewCR txt) noexcept {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%s", txt.c_str());
|
||||
}
|
||||
|
||||
void PaletteEditorImGui::drawColumn(ox::CStringView txt) noexcept {
|
||||
void PaletteEditorImGui::drawColumn(ox::CStringViewCR txt) noexcept {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::SetCursorPosX(
|
||||
ImGui::GetCursorPosX() + ImGui::GetColumnWidth() - ImGui::CalcTextSize(txt.data()).x);
|
||||
@@ -143,7 +143,15 @@ void PaletteEditorImGui::numShortcuts(size_t &val, size_t const sizeRange) noexc
|
||||
}
|
||||
}
|
||||
|
||||
void PaletteEditorImGui::colorInput(ox::CStringView label, int &v, bool &inputFocused) noexcept {
|
||||
void PaletteEditorImGui::colorInput(
|
||||
ox::CStringViewCR label,
|
||||
int &v,
|
||||
bool &inputFocused,
|
||||
FocusCmd const colorChannel) noexcept {
|
||||
if (colorChannel == m_focusCmd) [[unlikely]] {
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
m_focusCmd = FocusCmd::None;
|
||||
}
|
||||
ImGui::InputInt(label.c_str(), &v, 1, 5);
|
||||
inputFocused = inputFocused || ImGui::IsItemFocused();
|
||||
v = ox::max(v, 0);
|
||||
@@ -296,9 +304,9 @@ void PaletteEditorImGui::drawColorEditor() noexcept {
|
||||
"Name", m_pal.colorNames[m_selectedColorRow]);
|
||||
bool inputFocused = ImGui::IsItemFocused();
|
||||
ImGui::Separator();
|
||||
colorInput("Red", r, inputFocused);
|
||||
colorInput("Green", g, inputFocused);
|
||||
colorInput("Blue", b, inputFocused);
|
||||
colorInput("Red", r, inputFocused, FocusCmd::Red);
|
||||
colorInput("Green", g, inputFocused, FocusCmd::Green);
|
||||
colorInput("Blue", b, inputFocused, FocusCmd::Blue);
|
||||
if (ig::PushButton("Apply to all pages", {-1, ig::BtnSz.y})) {
|
||||
std::ignore = pushCommand<ApplyColorAllPagesCommand>(
|
||||
m_pal, m_page, m_selectedColorRow);
|
||||
@@ -309,6 +317,15 @@ void PaletteEditorImGui::drawColorEditor() noexcept {
|
||||
} else {
|
||||
numShortcuts(m_page, m_pal.pages.size());
|
||||
}
|
||||
if (ImGui::IsKeyDown(ImGuiKey_R)) {
|
||||
m_focusCmd = FocusCmd::Red;
|
||||
}
|
||||
if (ImGui::IsKeyDown(ImGuiKey_G)) {
|
||||
m_focusCmd = FocusCmd::Green;
|
||||
}
|
||||
if (ImGui::IsKeyDown(ImGuiKey_B)) {
|
||||
m_focusCmd = FocusCmd::Blue;
|
||||
}
|
||||
}
|
||||
auto const newColor = color16(r, g, b, a);
|
||||
if (c != newColor) {
|
||||
@@ -320,7 +337,7 @@ void PaletteEditorImGui::drawColorEditor() noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
ox::Error PaletteEditorImGui::renamePage(ox::StringView name) noexcept {
|
||||
ox::Error PaletteEditorImGui::renamePage(ox::StringViewCR name) noexcept {
|
||||
return pushCommand<RenamePageCommand>(m_pal, m_page, name);
|
||||
}
|
||||
|
||||
|
@@ -36,6 +36,13 @@ class PaletteEditorImGui: public studio::Editor {
|
||||
Palette m_pal;
|
||||
size_t m_selectedColorRow = 0;
|
||||
size_t m_page = 0;
|
||||
enum class FocusCmd {
|
||||
None,
|
||||
Red,
|
||||
Green,
|
||||
Blue,
|
||||
};
|
||||
FocusCmd m_focusCmd;
|
||||
|
||||
public:
|
||||
PaletteEditorImGui(studio::Context &sctx, ox::StringParam path);
|
||||
@@ -48,9 +55,9 @@ class PaletteEditorImGui: public studio::Editor {
|
||||
void navigateTo(ox::StringViewCR arg) noexcept override;
|
||||
|
||||
private:
|
||||
static void drawColumnLeftAlign(ox::CStringView txt) noexcept;
|
||||
static void drawColumnLeftAlign(ox::CStringViewCR txt) noexcept;
|
||||
|
||||
static void drawColumn(ox::CStringView txt) noexcept;
|
||||
static void drawColumn(ox::CStringViewCR txt) noexcept;
|
||||
|
||||
static void drawColumn(ox::Integer_c auto i) noexcept {
|
||||
drawColumn(ox::intToStr(i));
|
||||
@@ -58,7 +65,7 @@ class PaletteEditorImGui: public studio::Editor {
|
||||
|
||||
static void numShortcuts(size_t &val, size_t sizeRange) noexcept;
|
||||
|
||||
static void colorInput(ox::CStringView label, int &v, bool &inputFocused) noexcept;
|
||||
void colorInput(ox::CStringViewCR label, int &v, bool &inputFocused, FocusCmd colorChannel) noexcept;
|
||||
|
||||
void drawColorsEditor() noexcept;
|
||||
|
||||
@@ -66,7 +73,7 @@ class PaletteEditorImGui: public studio::Editor {
|
||||
|
||||
void drawColorEditor() noexcept;
|
||||
|
||||
ox::Error renamePage(ox::StringView name) noexcept;
|
||||
ox::Error renamePage(ox::StringViewCR name) noexcept;
|
||||
|
||||
ox::Error handleCommand(studio::UndoCommand const*) noexcept;
|
||||
};
|
||||
|
@@ -28,7 +28,7 @@ install(
|
||||
DIRECTORY
|
||||
../include/keel
|
||||
DESTINATION
|
||||
include/keel
|
||||
include
|
||||
)
|
||||
|
||||
install(
|
||||
@@ -60,4 +60,11 @@ if(TURBINE_BUILD_TYPE STREQUAL "Native")
|
||||
OxClaw
|
||||
OxLogConn
|
||||
)
|
||||
install(
|
||||
TARGETS
|
||||
KeelPack-AppLib
|
||||
DESTINATION
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
endif()
|
||||
|
@@ -13,8 +13,9 @@ extern ox::String appVersion;
|
||||
|
||||
namespace studio {
|
||||
|
||||
AboutPopup::AboutPopup(turbine::Context &ctx) noexcept: Popup("About") {
|
||||
m_text = ox::sfmt("{} - {}", keelCtx(ctx).appName, olympic::appVersion);
|
||||
AboutPopup::AboutPopup(turbine::Context &ctx) noexcept:
|
||||
Popup("About"),
|
||||
m_text{sfmt("{} - {}", keelCtx(ctx).appName, olympic::appVersion)} {
|
||||
}
|
||||
|
||||
void AboutPopup::draw(Context &sctx) noexcept {
|
||||
|
@@ -15,7 +15,7 @@ namespace studio {
|
||||
|
||||
class AboutPopup final: public ig::Popup {
|
||||
private:
|
||||
ox::String m_text;
|
||||
ox::String const m_text;
|
||||
|
||||
public:
|
||||
explicit AboutPopup(turbine::Context &ctx) noexcept;
|
||||
|
@@ -44,5 +44,5 @@ install(
|
||||
DIRECTORY
|
||||
../include/studio
|
||||
DESTINATION
|
||||
include/studio
|
||||
include
|
||||
)
|
||||
|
@@ -38,7 +38,7 @@ install(
|
||||
DIRECTORY
|
||||
../include/turbine
|
||||
DESTINATION
|
||||
include/turbine
|
||||
include
|
||||
)
|
||||
|
||||
install(
|
||||
|
Reference in New Issue
Block a user