Compare commits
6 Commits
83fbe6ac74
...
release-d2
| Author | SHA1 | Date | |
|---|---|---|---|
| 65df731abb | |||
| a098cb5ce7 | |||
| 8c0b0263db | |||
| 7f6c453345 | |||
| 261e324acd | |||
| f5573e06da |
7
deps/buildcore/scripts/pybb.py
vendored
7
deps/buildcore/scripts/pybb.py
vendored
@@ -11,6 +11,7 @@
|
|||||||
# "Python Busy Box" - adds cross-platform equivalents to Unix commands that
|
# "Python Busy Box" - adds cross-platform equivalents to Unix commands that
|
||||||
# don't translate well to that other operating system
|
# don't translate well to that other operating system
|
||||||
|
|
||||||
|
import multiprocessing
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import shutil
|
import shutil
|
||||||
@@ -57,7 +58,11 @@ def cmake_build(base_path: str, target: Optional[str]) -> int:
|
|||||||
path = os.path.join(base_path, d)
|
path = os.path.join(base_path, d)
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
continue
|
continue
|
||||||
args = ['cmake', '--build', path]
|
args = ['cmake', '--build', path, f'-j{multiprocessing.cpu_count()}']
|
||||||
|
if path.endswith('release'):
|
||||||
|
args.append('--config=release')
|
||||||
|
elif path.endswith('debug'):
|
||||||
|
args.append('--config=debug')
|
||||||
if target is not None:
|
if target is not None:
|
||||||
args.extend(['--target', target])
|
args.extend(['--target', target])
|
||||||
err = subprocess.run(args).returncode
|
err = subprocess.run(args).returncode
|
||||||
|
|||||||
@@ -24,9 +24,6 @@ enum class FileAddressType: int8_t {
|
|||||||
Inode,
|
Inode,
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
constexpr Error model(T *h, CommonPtrWith<class FileAddress> auto *fa) noexcept;
|
|
||||||
|
|
||||||
class FileAddress {
|
class FileAddress {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|||||||
@@ -1,20 +1,25 @@
|
|||||||
|
# d2025.05.1
|
||||||
|
|
||||||
|
* TileSheetEditor: Fix overrun errors when switching subsheets, clear selection
|
||||||
|
on switch (261e324acd)
|
||||||
|
* Fix new build error that occurs in MSVC (26d5048e6720c4c2d52508a6ee44c67dd9fe3ee5)
|
||||||
|
|
||||||
# d2025.05.0
|
# d2025.05.0
|
||||||
|
|
||||||
* Add app icon for both window and file
|
* Add app icon for both window and file
|
||||||
* Change application font to Roboto Medium
|
* Change application font to Roboto Medium
|
||||||
* Closing application will now confirm with user if any files have unsaved
|
* Closing application will now confirm with user if any files have unsaved
|
||||||
changes.
|
changes.
|
||||||
* UUID duplicates will now be reported when opening a project.
|
* UUID duplicates will now be reported when opening a project
|
||||||
* Deleting a directory now closes files in that directory.
|
* Deleting a directory now closes files in that directory
|
||||||
* Delete key now initiates deletion of selected directory.
|
* Delete key now initiates deletion of selected directory
|
||||||
* Remove ability to re-order tabs. There were bugs associated with that.
|
* Remove ability to re-order tabs. There were bugs associated with that.
|
||||||
* Mac: Menu bar shortcuts now say Cmd instead of Ctrl.
|
* TileSheetEditor: Fix selection clearing in to work when clicking outside
|
||||||
* TileSheetEditor: Fix selection clearing to work when clicking outside image.
|
image.
|
||||||
* TileSheetEditor: Fix Delete Tile functionality, which was completely broken
|
* TileSheetEditor: Fix Delete Tile functionality, which was completely broken
|
||||||
* TileSheetEditor: Fix Insert Tile functionality, which was completely broken
|
* PaletteEditor: Fix color number key range in. Previously, pressing A caused
|
||||||
* PaletteEditor: Fix color number key range. Previously, pressing A caused the
|
the editor to jump to the last color.
|
||||||
editor to jump to the last color.
|
* PaletteEditor: page rename will now take effect upon pressing enter if the
|
||||||
* PaletteEditor: Page rename will now take effect upon pressing enter if the
|
|
||||||
text input has focus
|
text input has focus
|
||||||
|
|
||||||
# d2025.02.1
|
# d2025.02.1
|
||||||
|
|||||||
@@ -231,10 +231,10 @@ void hideSprite(Context &ctx, unsigned) noexcept;
|
|||||||
|
|
||||||
void showSprite(Context &ctx, unsigned) noexcept;
|
void showSprite(Context &ctx, unsigned) noexcept;
|
||||||
|
|
||||||
void setSprite(Context &ctx, uint_t idx, Sprite const&sprite) noexcept;
|
void setSprite(Context &c, uint_t idx, Sprite const&s) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
uint_t spriteCount(Context const &ctx) noexcept;
|
uint_t spriteCount(Context &ctx) noexcept;
|
||||||
|
|
||||||
ox::Error initConsole(Context &ctx) noexcept;
|
ox::Error initConsole(Context &ctx) noexcept;
|
||||||
|
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ void setSprite(Context&, uint_t idx, Sprite const&s) noexcept {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
uint_t spriteCount(Context const &) noexcept {
|
uint_t spriteCount(Context&) noexcept {
|
||||||
return SpriteCount;
|
return SpriteCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ static void setTileBufferObject(
|
|||||||
ox::spancpy<GLuint>(ebo, elms);
|
ox::spancpy<GLuint>(ebo, elms);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initSpriteBufferObjects(Context const &ctx, glutils::BufferSet &bs) noexcept {
|
static void initSpriteBufferObjects(Context &ctx, glutils::BufferSet &bs) noexcept {
|
||||||
for (auto i = 0u; i < ctx.spriteCount; ++i) {
|
for (auto i = 0u; i < ctx.spriteCount; ++i) {
|
||||||
auto const vbo = ox::Span{bs.vertices}
|
auto const vbo = ox::Span{bs.vertices}
|
||||||
+ i * static_cast<std::size_t>(SpriteVertexVboLength);
|
+ i * static_cast<std::size_t>(SpriteVertexVboLength);
|
||||||
@@ -256,7 +256,7 @@ static void initSpritesBufferset(Context &ctx) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void initBackgroundBufferset(
|
static void initBackgroundBufferset(
|
||||||
GLuint const shader,
|
GLuint shader,
|
||||||
glutils::BufferSet &bs) noexcept {
|
glutils::BufferSet &bs) noexcept {
|
||||||
// vao
|
// vao
|
||||||
bs.vao = glutils::generateVertexArrayObject();
|
bs.vao = glutils::generateVertexArrayObject();
|
||||||
@@ -375,10 +375,10 @@ static void drawSprites(Context &ctx, ox::Size const&renderSz) noexcept {
|
|||||||
|
|
||||||
static void loadPalette(
|
static void loadPalette(
|
||||||
ox::Array<GLfloat, 1024> &palette,
|
ox::Array<GLfloat, 1024> &palette,
|
||||||
size_t const palOffset,
|
size_t palOffset,
|
||||||
GLuint const shaderPgrm,
|
GLuint shaderPgrm,
|
||||||
CompactPalette const&pal,
|
CompactPalette const&pal,
|
||||||
size_t const page = 0) noexcept {
|
size_t page = 0) noexcept {
|
||||||
static constexpr std::size_t ColorCnt = 256;
|
static constexpr std::size_t ColorCnt = 256;
|
||||||
for (auto i = palOffset; auto const c : pal.pages[page]) {
|
for (auto i = palOffset; auto const c : pal.pages[page]) {
|
||||||
palette[i++] = redf(c);
|
palette[i++] = redf(c);
|
||||||
@@ -528,9 +528,9 @@ static ox::Result<TileSheetData> normalizeTileSheet(
|
|||||||
|
|
||||||
ox::Error loadBgPalette(
|
ox::Error loadBgPalette(
|
||||||
Context &ctx,
|
Context &ctx,
|
||||||
size_t const palBank,
|
size_t palBank,
|
||||||
CompactPalette const&palette,
|
CompactPalette const&palette,
|
||||||
size_t const page) noexcept {
|
size_t page) noexcept {
|
||||||
renderer::loadPalette(ctx.bgPalette, palBank * 16 * 4, ctx.bgShader, palette, page);
|
renderer::loadPalette(ctx.bgPalette, palBank * 16 * 4, ctx.bgShader, palette, page);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@@ -538,14 +538,14 @@ ox::Error loadBgPalette(
|
|||||||
ox::Error loadSpritePalette(
|
ox::Error loadSpritePalette(
|
||||||
Context &ctx,
|
Context &ctx,
|
||||||
CompactPalette const&palette,
|
CompactPalette const&palette,
|
||||||
size_t const page) noexcept {
|
size_t page) noexcept {
|
||||||
ox::Array<GLfloat, 1024> pal;
|
ox::Array<GLfloat, 1024> pal;
|
||||||
renderer::loadPalette(pal, 0, ctx.spriteShader, palette, page);
|
renderer::loadPalette(pal, 0, ctx.spriteShader, palette, page);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
static ox::Result<TileSheetData> buildSetTsd(
|
static ox::Result<TileSheetData> buildSetTsd(
|
||||||
Context const &ctx,
|
Context &ctx,
|
||||||
TileSheetSet const&set) noexcept {
|
TileSheetSet const&set) noexcept {
|
||||||
auto &kctx = keelCtx(ctx.turbineCtx);
|
auto &kctx = keelCtx(ctx.turbineCtx);
|
||||||
TileSheetData setTsd;
|
TileSheetData setTsd;
|
||||||
@@ -624,7 +624,7 @@ ox::Error loadBgTileSheet(
|
|||||||
|
|
||||||
ox::Error loadBgTileSheet(
|
ox::Error loadBgTileSheet(
|
||||||
Context &ctx,
|
Context &ctx,
|
||||||
uint_t const cbb,
|
uint_t cbb,
|
||||||
CompactTileSheet const&ts,
|
CompactTileSheet const&ts,
|
||||||
ox::Optional<unsigned> const&paletteBank) noexcept {
|
ox::Optional<unsigned> const&paletteBank) noexcept {
|
||||||
auto const bytesPerTile = static_cast<uint64_t>(PixelsPerTile / (1 + (ts.bpp == 4)));
|
auto const bytesPerTile = static_cast<uint64_t>(PixelsPerTile / (1 + (ts.bpp == 4)));
|
||||||
@@ -638,7 +638,7 @@ ox::Error loadBgTileSheet(
|
|||||||
|
|
||||||
ox::Error loadBgTileSheet(
|
ox::Error loadBgTileSheet(
|
||||||
Context &ctx,
|
Context &ctx,
|
||||||
unsigned const cbb,
|
unsigned cbb,
|
||||||
TileSheetSet const&set) noexcept {
|
TileSheetSet const&set) noexcept {
|
||||||
OX_REQUIRE(setTsd, buildSetTsd(ctx, set));
|
OX_REQUIRE(setTsd, buildSetTsd(ctx, set));
|
||||||
ctx.cbbs[cbb].tex = renderer::createTexture(setTsd.width, setTsd.height, setTsd.pixels.data());
|
ctx.cbbs[cbb].tex = renderer::createTexture(setTsd.width, setTsd.height, setTsd.pixels.data());
|
||||||
@@ -648,7 +648,7 @@ ox::Error loadBgTileSheet(
|
|||||||
ox::Error loadSpriteTileSheet(
|
ox::Error loadSpriteTileSheet(
|
||||||
Context &ctx,
|
Context &ctx,
|
||||||
CompactTileSheet const&ts,
|
CompactTileSheet const&ts,
|
||||||
bool const loadDefaultPalette) noexcept {
|
bool loadDefaultPalette) noexcept {
|
||||||
OX_REQUIRE(tsd, normalizeTileSheet(ts));
|
OX_REQUIRE(tsd, normalizeTileSheet(ts));
|
||||||
oxTracef("nostalgia.gfx.gl", "loadSpriteTexture: { w: {}, h: {} }", tsd.width, tsd.height);
|
oxTracef("nostalgia.gfx.gl", "loadSpriteTexture: { w: {}, h: {} }", tsd.width, tsd.height);
|
||||||
ctx.spriteBlocks.tex = renderer::createTexture(tsd.width, tsd.height, tsd.pixels.data());
|
ctx.spriteBlocks.tex = renderer::createTexture(tsd.width, tsd.height, tsd.pixels.data());
|
||||||
@@ -669,8 +669,8 @@ ox::Error loadSpriteTileSheet(
|
|||||||
void setBgTile(
|
void setBgTile(
|
||||||
Context &ctx,
|
Context &ctx,
|
||||||
uint_t bgIdx,
|
uint_t bgIdx,
|
||||||
int const column,
|
int column,
|
||||||
int const row,
|
int row,
|
||||||
BgTile const&tile) noexcept {
|
BgTile const&tile) noexcept {
|
||||||
oxTracef(
|
oxTracef(
|
||||||
"nostalgia.gfx.setBgTile",
|
"nostalgia.gfx.setBgTile",
|
||||||
@@ -698,7 +698,7 @@ void setBgTile(
|
|||||||
cbb.updated = true;
|
cbb.updated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearBg(Context &ctx, uint_t const bgIdx) noexcept {
|
void clearBg(Context &ctx, uint_t bgIdx) noexcept {
|
||||||
auto &cbb = ctx.cbbs[static_cast<std::size_t>(bgIdx)];
|
auto &cbb = ctx.cbbs[static_cast<std::size_t>(bgIdx)];
|
||||||
initBackgroundBufferObjects(cbb);
|
initBackgroundBufferObjects(cbb);
|
||||||
cbb.updated = true;
|
cbb.updated = true;
|
||||||
@@ -714,49 +714,51 @@ uint8_t bgStatus(Context &ctx) noexcept {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBgStatus(Context &ctx, uint32_t const status) noexcept {
|
void setBgStatus(Context &ctx, uint32_t status) noexcept {
|
||||||
for (uint_t i = 0; i < ctx.cbbs.size(); ++i) {
|
for (uint_t i = 0; i < ctx.cbbs.size(); ++i) {
|
||||||
ctx.backgrounds[i].enabled = (status >> i) & 1;
|
ctx.backgrounds[i].enabled = (status >> i) & 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bgStatus(Context &ctx, uint_t const bg) noexcept {
|
bool bgStatus(Context &ctx, uint_t bg) noexcept {
|
||||||
return ctx.backgrounds[bg].enabled;
|
return ctx.backgrounds[bg].enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBgStatus(Context&ctx, uint_t const bg, bool const status) noexcept {
|
void setBgStatus(Context&ctx, uint_t bg, bool status) noexcept {
|
||||||
ctx.backgrounds[bg].enabled = status;
|
ctx.backgrounds[bg].enabled = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBgCbb(Context &ctx, uint_t const bgIdx, uint_t const cbbIdx) noexcept {
|
void setBgBpp(Context&, unsigned, unsigned) noexcept {}
|
||||||
|
|
||||||
|
void setBgCbb(Context &ctx, uint_t bgIdx, uint_t cbbIdx) noexcept {
|
||||||
auto &bg = ctx.backgrounds[bgIdx];
|
auto &bg = ctx.backgrounds[bgIdx];
|
||||||
bg.cbbIdx = cbbIdx;
|
bg.cbbIdx = cbbIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBgPriority(Context &ctx, uint_t const bgIdx, uint_t const priority) noexcept {
|
void setBgPriority(Context &ctx, uint_t bgIdx, uint_t priority) noexcept {
|
||||||
auto &bg = ctx.backgrounds[bgIdx];
|
auto &bg = ctx.backgrounds[bgIdx];
|
||||||
bg.priority = static_cast<float>(priority & 0b11);
|
bg.priority = static_cast<float>(priority & 0b11);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hideSprite(Context &ctx, uint_t const idx) noexcept {
|
void hideSprite(Context &ctx, uint_t idx) noexcept {
|
||||||
auto &s = ctx.spriteStates[idx];
|
auto &s = ctx.spriteStates[idx];
|
||||||
s.enabled = false;
|
s.enabled = false;
|
||||||
renderer::setSprite(ctx, idx, s);
|
renderer::setSprite(ctx, idx, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showSprite(Context &ctx, uint_t const idx) noexcept {
|
void showSprite(Context &ctx, uint_t idx) noexcept {
|
||||||
auto &s = ctx.spriteStates[idx];
|
auto &s = ctx.spriteStates[idx];
|
||||||
s.enabled = true;
|
s.enabled = true;
|
||||||
renderer::setSprite(ctx, idx, s);
|
renderer::setSprite(ctx, idx, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSprite(Context &ctx, uint_t const idx, Sprite const&sprite) noexcept {
|
void setSprite(Context &ctx, uint_t idx, Sprite const&sprite) noexcept {
|
||||||
auto &s = ctx.spriteStates[idx];
|
auto &s = ctx.spriteStates[idx];
|
||||||
s = sprite;
|
s = sprite;
|
||||||
renderer::setSprite(ctx, idx, s);
|
renderer::setSprite(ctx, idx, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint_t spriteCount(Context const &ctx) noexcept {
|
uint_t spriteCount(Context &ctx) noexcept {
|
||||||
return ctx.spriteCount;
|
return ctx.spriteCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -766,7 +768,7 @@ ox::Size drawSize(int scale) noexcept {
|
|||||||
return {240 * scale, 160 * scale};
|
return {240 * scale, 160 * scale};
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw(Context &ctx, ox::Size const&renderSz) noexcept {
|
void draw(gfx::Context &ctx, ox::Size const&renderSz) noexcept {
|
||||||
glViewport(0, 0, renderSz.width, renderSz.height);
|
glViewport(0, 0, renderSz.width, renderSz.height);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
@@ -781,7 +783,7 @@ void draw(Context &ctx, ox::Size const&renderSz) noexcept {
|
|||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw(Context &ctx, int scale) noexcept {
|
void draw(gfx::Context &ctx, int scale) noexcept {
|
||||||
draw(ctx, drawSize(scale));
|
draw(ctx, drawSize(scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,11 +27,14 @@ CutPasteCommand::CutPasteCommand(
|
|||||||
TileSheet::SubSheetIdx subSheetIdx,
|
TileSheet::SubSheetIdx subSheetIdx,
|
||||||
ox::Point const&dstStart,
|
ox::Point const&dstStart,
|
||||||
ox::Point dstEnd,
|
ox::Point dstEnd,
|
||||||
TileSheetClipboard const&cb) noexcept:
|
TileSheetClipboard const&cb):
|
||||||
m_commandId(commandId),
|
m_commandId(commandId),
|
||||||
m_img(img),
|
m_img(img),
|
||||||
m_subSheetIdx(std::move(subSheetIdx)) {
|
m_subSheetIdx(std::move(subSheetIdx)) {
|
||||||
auto const&ss = getSubSheet(m_img, m_subSheetIdx);
|
auto const&ss = getSubSheet(m_img, m_subSheetIdx);
|
||||||
|
if (dstStart.x >= ss.columns * TileWidth || dstStart.y >= ss.rows * TileHeight) {
|
||||||
|
throw ox::Exception{1, "paste starts beyond the bounds of target"};
|
||||||
|
}
|
||||||
dstEnd.x = std::min(ss.columns * TileWidth - 1, dstEnd.x);
|
dstEnd.x = std::min(ss.columns * TileWidth - 1, dstEnd.x);
|
||||||
dstEnd.y = std::min(ss.rows * TileHeight - 1, dstEnd.y);
|
dstEnd.y = std::min(ss.rows * TileHeight - 1, dstEnd.y);
|
||||||
for (auto const&p : cb.pixels()) {
|
for (auto const&p : cb.pixels()) {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class CutPasteCommand: public TileSheetCommand {
|
|||||||
TileSheet::SubSheetIdx subSheetIdx,
|
TileSheet::SubSheetIdx subSheetIdx,
|
||||||
ox::Point const&dstStart,
|
ox::Point const&dstStart,
|
||||||
ox::Point dstEnd,
|
ox::Point dstEnd,
|
||||||
TileSheetClipboard const&cb) noexcept;
|
TileSheetClipboard const&cb);
|
||||||
|
|
||||||
ox::Error redo() noexcept final;
|
ox::Error redo() noexcept final;
|
||||||
|
|
||||||
|
|||||||
@@ -46,13 +46,13 @@ Palette const TileSheetEditorModel::s_defaultPalette = {
|
|||||||
|
|
||||||
TileSheetEditorModel::TileSheetEditorModel(
|
TileSheetEditorModel::TileSheetEditorModel(
|
||||||
studio::Context &sctx, ox::StringParam path, studio::UndoStack &undoStack):
|
studio::Context &sctx, ox::StringParam path, studio::UndoStack &undoStack):
|
||||||
m_sctx(sctx),
|
m_sctx{sctx},
|
||||||
m_tctx(m_sctx.tctx),
|
m_tctx{m_sctx.tctx},
|
||||||
m_path(std::move(path)),
|
m_path{std::move(path)},
|
||||||
m_img(*readObj<TileSheet>(keelCtx(m_tctx), m_path).unwrapThrow()),
|
m_img{*readObj<TileSheet>(keelCtx(m_tctx), m_path).unwrapThrow()},
|
||||||
// ignore failure to load palette
|
// ignore failure to load palette
|
||||||
m_pal(readObj<Palette>(keelCtx(m_tctx), m_img.defaultPalette).value),
|
m_pal{readObj<Palette>(keelCtx(m_tctx), m_img.defaultPalette).value},
|
||||||
m_undoStack(undoStack) {
|
m_undoStack{undoStack} {
|
||||||
normalizeSubsheets(m_img.subsheet);
|
normalizeSubsheets(m_img.subsheet);
|
||||||
m_pal.updated.connect(this, &TileSheetEditorModel::markUpdated);
|
m_pal.updated.connect(this, &TileSheetEditorModel::markUpdated);
|
||||||
m_undoStack.changeTriggered.connect(this, &TileSheetEditorModel::markUpdatedCmdId);
|
m_undoStack.changeTriggered.connect(this, &TileSheetEditorModel::markUpdatedCmdId);
|
||||||
@@ -67,19 +67,27 @@ void TileSheetEditorModel::cut() {
|
|||||||
TileSheetClipboard blankCb;
|
TileSheetClipboard blankCb;
|
||||||
auto cb = ox::make_unique<TileSheetClipboard>();
|
auto cb = ox::make_unique<TileSheetClipboard>();
|
||||||
auto const&s = activeSubSheet();
|
auto const&s = activeSubSheet();
|
||||||
iterateSelectionRows(*m_selection, [&](int const x, int const y) {
|
if (iterateSelectionRows(*m_selection, [&](int const x, int const y) {
|
||||||
auto pt = ox::Point{x, y};
|
auto pt = ox::Point{x, y};
|
||||||
auto const idx = gfx::idx(s, pt);
|
auto const idx = gfx::idx(s, pt);
|
||||||
auto const c = getPixel(s, idx);
|
if (idx >= s.pixels.size()) {
|
||||||
|
return ox::Error{1, "invalid idx"};
|
||||||
|
}
|
||||||
|
auto const c = s.pixels[idx];
|
||||||
pt -= m_selection->a;
|
pt -= m_selection->a;
|
||||||
cb->addPixel(pt, c);
|
cb->addPixel(pt, c);
|
||||||
blankCb.addPixel(pt, 0);
|
blankCb.addPixel(pt, 0);
|
||||||
});
|
return ox::Error{};
|
||||||
|
})) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto const pt1 = m_selection->a;
|
auto const pt1 = m_selection->a;
|
||||||
auto const pt2 = ox::Point{s.columns * TileWidth, s.rows * TileHeight};
|
auto const pt2 = ox::Point{s.columns * TileWidth, s.rows * TileHeight};
|
||||||
turbine::setClipboardObject(m_tctx, std::move(cb));
|
turbine::setClipboardObject(m_tctx, std::move(cb));
|
||||||
std::ignore = pushCommand(ox::make<CutPasteCommand>(
|
if (auto const cmd = ox::makeCatch<CutPasteCommand>(
|
||||||
CommandId::Cut, m_img, m_activeSubsSheetIdx, pt1, pt2, blankCb));
|
CommandId::Cut, m_img, m_activeSubsSheetIdx, pt1, pt2, blankCb); cmd.ok()) {
|
||||||
|
std::ignore = pushCommand(cmd.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditorModel::copy() {
|
void TileSheetEditorModel::copy() {
|
||||||
@@ -87,14 +95,20 @@ void TileSheetEditorModel::copy() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto cb = ox::make_unique<TileSheetClipboard>();
|
auto cb = ox::make_unique<TileSheetClipboard>();
|
||||||
iterateSelectionRows(*m_selection, [&](int const x, int const y) {
|
if (iterateSelectionRows(*m_selection, [&](int const x, int const y) {
|
||||||
auto pt = ox::Point{x, y};
|
auto pt = ox::Point{x, y};
|
||||||
auto const&s = activeSubSheet();
|
auto const&s = activeSubSheet();
|
||||||
auto const idx = gfx::idx(s, pt);
|
auto const idx = gfx::idx(s, pt);
|
||||||
auto const c = getPixel(s, idx);
|
if (idx >= s.pixels.size()) {
|
||||||
|
return ox::Error{1, "invalid idx"};
|
||||||
|
}
|
||||||
|
auto const c = s.pixels[idx];
|
||||||
pt -= m_selection->a;
|
pt -= m_selection->a;
|
||||||
cb->addPixel(pt, c);
|
cb->addPixel(pt, c);
|
||||||
});
|
return ox::Error{};
|
||||||
|
})) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
turbine::setClipboardObject(m_tctx, std::move(cb));
|
turbine::setClipboardObject(m_tctx, std::move(cb));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,8 +125,10 @@ void TileSheetEditorModel::paste() {
|
|||||||
auto const&s = activeSubSheet();
|
auto const&s = activeSubSheet();
|
||||||
auto const pt1 = m_selection->a;
|
auto const pt1 = m_selection->a;
|
||||||
auto const pt2 = ox::Point{s.columns * TileWidth, s.rows * TileHeight};
|
auto const pt2 = ox::Point{s.columns * TileWidth, s.rows * TileHeight};
|
||||||
std::ignore = pushCommand(ox::make<CutPasteCommand>(
|
if (auto const cmd = ox::makeCatch<CutPasteCommand>(
|
||||||
CommandId::Paste, m_img, m_activeSubsSheetIdx, pt1, pt2, *cb));
|
CommandId::Paste, m_img, m_activeSubsSheetIdx, pt1, pt2, *cb); cmd.ok()) {
|
||||||
|
std::ignore = pushCommand(cmd.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TileSheetEditorModel::acceptsClipboardPayload() const noexcept {
|
bool TileSheetEditorModel::acceptsClipboardPayload() const noexcept {
|
||||||
@@ -152,7 +168,7 @@ void TileSheetEditorModel::drawCommand(ox::Point const &pt, std::size_t const pa
|
|||||||
auto const idx = gfx::idx(activeSubSheet, pt);
|
auto const idx = gfx::idx(activeSubSheet, pt);
|
||||||
if (m_ongoingDrawCommand) {
|
if (m_ongoingDrawCommand) {
|
||||||
m_updated = m_updated || m_ongoingDrawCommand->append(idx);
|
m_updated = m_updated || m_ongoingDrawCommand->append(idx);
|
||||||
} else if (getPixel(activeSubSheet, idx) != palIdx) {
|
} else if (activeSubSheet.pixels[idx] != palIdx) {
|
||||||
std::ignore = pushCommand(ox::make<DrawCommand>(
|
std::ignore = pushCommand(ox::make<DrawCommand>(
|
||||||
m_img, m_activeSubsSheetIdx, idx, static_cast<int>(palIdx)));
|
m_img, m_activeSubsSheetIdx, idx, static_cast<int>(palIdx)));
|
||||||
}
|
}
|
||||||
@@ -213,6 +229,7 @@ ox::Error TileSheetEditorModel::updateSubsheet(
|
|||||||
void TileSheetEditorModel::setActiveSubsheet(TileSheet::SubSheetIdx const&idx) noexcept {
|
void TileSheetEditorModel::setActiveSubsheet(TileSheet::SubSheetIdx const&idx) noexcept {
|
||||||
m_activeSubsSheetIdx = idx;
|
m_activeSubsSheetIdx = idx;
|
||||||
this->activeSubsheetChanged.emit(m_activeSubsSheetIdx);
|
this->activeSubsheetChanged.emit(m_activeSubsSheetIdx);
|
||||||
|
clearSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditorModel::fill(ox::Point const&pt, int const palIdx) noexcept {
|
void TileSheetEditorModel::fill(ox::Point const&pt, int const palIdx) noexcept {
|
||||||
@@ -381,7 +398,7 @@ void TileSheetEditorModel::getFillPixels(
|
|||||||
int const oldColor) const noexcept {
|
int const oldColor) const noexcept {
|
||||||
auto const idx = ptToIdx(pt, activeSubSheet.columns);
|
auto const idx = ptToIdx(pt, activeSubSheet.columns);
|
||||||
auto const relIdx = idx % PixelsPerTile;
|
auto const relIdx = idx % PixelsPerTile;
|
||||||
if (pixels[relIdx] || getPixel(activeSubSheet, idx) != oldColor) {
|
if (pixels[relIdx] || activeSubSheet.pixels[idx] != oldColor) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// mark pixels to update
|
// mark pixels to update
|
||||||
@@ -419,7 +436,7 @@ void TileSheetEditorModel::setPalPath() noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ox::Error TileSheetEditorModel::pushCommand(studio::UndoCommand *cmd) noexcept {
|
ox::Error TileSheetEditorModel::pushCommand(studio::UndoCommand *cmd) noexcept {
|
||||||
std::ignore = m_undoStack.push(ox::UPtr<studio::UndoCommand>{cmd});
|
std::ignore = m_undoStack.push(ox::UPtr{cmd});
|
||||||
m_ongoingDrawCommand = dynamic_cast<DrawCommand*>(cmd);
|
m_ongoingDrawCommand = dynamic_cast<DrawCommand*>(cmd);
|
||||||
m_updated = true;
|
m_updated = true;
|
||||||
return {};
|
return {};
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ target_link_libraries(
|
|||||||
|
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
NostalgiaStudio PUBLIC
|
NostalgiaStudio PUBLIC
|
||||||
OLYMPIC_APP_VERSION="dev build"
|
OLYMPIC_APP_VERSION="d2025.05.1"
|
||||||
)
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
|
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>dev build</string>
|
<string>d2025.05.1</string>
|
||||||
|
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>12.0.0</string>
|
<string>12.0.0</string>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ install(
|
|||||||
DIRECTORY
|
DIRECTORY
|
||||||
../include/keel
|
../include/keel
|
||||||
DESTINATION
|
DESTINATION
|
||||||
include
|
include/keel
|
||||||
)
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
@@ -60,11 +60,4 @@ if(TURBINE_BUILD_TYPE STREQUAL "Native")
|
|||||||
OxClaw
|
OxClaw
|
||||||
OxLogConn
|
OxLogConn
|
||||||
)
|
)
|
||||||
install(
|
|
||||||
TARGETS
|
|
||||||
KeelPack-AppLib
|
|
||||||
DESTINATION
|
|
||||||
LIBRARY DESTINATION lib
|
|
||||||
ARCHIVE DESTINATION lib
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -44,5 +44,5 @@ install(
|
|||||||
DIRECTORY
|
DIRECTORY
|
||||||
../include/studio
|
../include/studio
|
||||||
DESTINATION
|
DESTINATION
|
||||||
include
|
include/studio
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ install(
|
|||||||
DIRECTORY
|
DIRECTORY
|
||||||
../include/turbine
|
../include/turbine
|
||||||
DESTINATION
|
DESTINATION
|
||||||
include
|
include/turbine
|
||||||
)
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
|
|||||||
Reference in New Issue
Block a user