Compare commits
11 Commits
e259a55db8
...
f5573e06da
Author | SHA1 | Date | |
---|---|---|---|
f5573e06da | |||
df87832324 | |||
d585794cbe | |||
209658549c | |||
02383a4aed | |||
185a76282a | |||
b722b4f701 | |||
459ab5aad9 | |||
565f621cfc | |||
9589ca9148 | |||
164db5007b |
8
deps/ox/src/ox/std/string.hpp
vendored
8
deps/ox/src/ox/std/string.hpp
vendored
@ -213,22 +213,22 @@ class BasicString {
|
|||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr const char *c_str() const noexcept {
|
constexpr const char *c_str() const noexcept {
|
||||||
return static_cast<const char*>(m_buff.data());
|
return m_buff.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline explicit operator const char*() const {
|
constexpr explicit operator const char*() const {
|
||||||
return c_str();
|
return c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __has_include(<string>)
|
#if __has_include(<string>)
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline std::string toStdString() const {
|
std::string toStdString() const {
|
||||||
return c_str();
|
return c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline explicit operator std::string() const {
|
explicit operator std::string() const {
|
||||||
return c_str();
|
return c_str();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
# 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
|
||||||
* 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.
|
||||||
* TileSheetEditor: Fix selection clearing in to work when clicking outside
|
* TileSheetEditor: Fix selection clearing in to work when clicking outside
|
||||||
image.
|
image.
|
||||||
|
* TileSheetEditor: Fix Delete Tile functionality, which was completely broken
|
||||||
* PaletteEditor: Fix color number key range in. Previously, pressing A caused
|
* PaletteEditor: Fix color number key range in. Previously, pressing A caused
|
||||||
the editor to jump to the last color.
|
the 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
|
||||||
|
@ -8,14 +8,14 @@
|
|||||||
|
|
||||||
namespace nostalgia::gfx {
|
namespace nostalgia::gfx {
|
||||||
|
|
||||||
gfx::DeleteTilesCommand::DeleteTilesCommand(
|
DeleteTilesCommand::DeleteTilesCommand(
|
||||||
TileSheet &img,
|
TileSheet &img,
|
||||||
TileSheet::SubSheetIdx idx,
|
TileSheet::SubSheetIdx idx,
|
||||||
std::size_t tileIdx,
|
std::size_t const tileIdx,
|
||||||
std::size_t tileCnt) noexcept:
|
std::size_t const tileCnt) noexcept:
|
||||||
m_img(img),
|
m_img(img),
|
||||||
m_idx(std::move(idx)) {
|
m_idx(std::move(idx)) {
|
||||||
const unsigned bytesPerTile = m_img.bpp == 4 ? PixelsPerTile / 2 : PixelsPerTile;
|
constexpr unsigned bytesPerTile = PixelsPerTile;
|
||||||
m_deletePos = tileIdx * bytesPerTile;
|
m_deletePos = tileIdx * bytesPerTile;
|
||||||
m_deleteSz = tileCnt * bytesPerTile;
|
m_deleteSz = tileCnt * bytesPerTile;
|
||||||
m_deletedPixels.resize(m_deleteSz);
|
m_deletedPixels.resize(m_deleteSz);
|
||||||
@ -28,16 +28,20 @@ gfx::DeleteTilesCommand::DeleteTilesCommand(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Error gfx::DeleteTilesCommand::redo() noexcept {
|
ox::Error DeleteTilesCommand::redo() noexcept {
|
||||||
auto &s = getSubSheet(m_img, m_idx);
|
auto &s = getSubSheet(m_img, m_idx);
|
||||||
auto &p = s.pixels;
|
auto &p = s.pixels;
|
||||||
auto srcPos = m_deletePos + m_deleteSz;
|
auto const srcPos = m_deletePos + m_deleteSz;
|
||||||
auto const src = &p[srcPos];
|
|
||||||
auto const dst1 = &p[m_deletePos];
|
auto const dst1 = &p[m_deletePos];
|
||||||
auto const dst2 = &p[(p.size() - m_deleteSz)];
|
auto const dst2 = &p[(p.size() - m_deleteSz)];
|
||||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||||
|
if (srcPos < p.size()) {
|
||||||
|
auto const src = &p[srcPos];
|
||||||
ox::memmove(dst1, src, p.size() - srcPos);
|
ox::memmove(dst1, src, p.size() - srcPos);
|
||||||
ox::memset(dst2, 0, m_deleteSz * sizeof(decltype(p[0])));
|
ox::memset(dst2, 0, m_deleteSz * sizeof(decltype(p[0])));
|
||||||
|
} else {
|
||||||
|
ox::memset(dst1, 0, p.size() - m_deletePos);
|
||||||
|
}
|
||||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -46,11 +50,14 @@ ox::Error DeleteTilesCommand::undo() noexcept {
|
|||||||
auto &s = getSubSheet(m_img, m_idx);
|
auto &s = getSubSheet(m_img, m_idx);
|
||||||
auto &p = s.pixels;
|
auto &p = s.pixels;
|
||||||
auto const src = &p[m_deletePos];
|
auto const src = &p[m_deletePos];
|
||||||
auto const dst1 = &p[m_deletePos + m_deleteSz];
|
|
||||||
auto const dst2 = src;
|
|
||||||
auto const sz = p.size() - m_deletePos - m_deleteSz;
|
auto const sz = p.size() - m_deletePos - m_deleteSz;
|
||||||
|
auto const srcPos = m_deletePos + m_deleteSz;
|
||||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||||
|
if (srcPos < p.size()) {
|
||||||
|
auto const dst1 = &p[m_deletePos + m_deleteSz];
|
||||||
ox::memmove(dst1, src, sz);
|
ox::memmove(dst1, src, sz);
|
||||||
|
}
|
||||||
|
auto const dst2 = src;
|
||||||
ox::memcpy(dst2, m_deletedPixels.data(), m_deletedPixels.size());
|
ox::memcpy(dst2, m_deletedPixels.data(), m_deletedPixels.size());
|
||||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||||
return {};
|
return {};
|
||||||
|
@ -9,20 +9,19 @@ namespace nostalgia::gfx {
|
|||||||
InsertTilesCommand::InsertTilesCommand(
|
InsertTilesCommand::InsertTilesCommand(
|
||||||
TileSheet &img,
|
TileSheet &img,
|
||||||
TileSheet::SubSheetIdx idx,
|
TileSheet::SubSheetIdx idx,
|
||||||
std::size_t tileIdx,
|
std::size_t const tileIdx,
|
||||||
std::size_t tileCnt) noexcept:
|
std::size_t const tileCnt) noexcept:
|
||||||
m_img(img),
|
m_img{img},
|
||||||
m_idx(std::move(idx)) {
|
m_idx{std::move(idx)} {
|
||||||
const unsigned bytesPerTile = m_img.bpp == 4 ? PixelsPerTile / 2 : PixelsPerTile;
|
m_insertPos = tileIdx * PixelsPerTile;
|
||||||
m_insertPos = tileIdx * bytesPerTile;
|
m_insertCnt = tileCnt * PixelsPerTile;
|
||||||
m_insertCnt = tileCnt * bytesPerTile;
|
|
||||||
m_deletedPixels.resize(m_insertCnt);
|
m_deletedPixels.resize(m_insertCnt);
|
||||||
// copy pixels to be erased
|
// copy pixels to be erased
|
||||||
{
|
{
|
||||||
auto &s = getSubSheet(m_img, m_idx);
|
auto &s = getSubSheet(m_img, m_idx);
|
||||||
auto &p = s.pixels;
|
auto &p = s.pixels;
|
||||||
auto dst = m_deletedPixels.begin();
|
auto const dst = m_deletedPixels.begin();
|
||||||
auto src = p.begin() + p.size() - m_insertCnt;
|
auto const src = p.begin() + p.size() - m_insertCnt;
|
||||||
ox::copy_n(src, m_insertCnt, dst);
|
ox::copy_n(src, m_insertCnt, dst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -32,7 +31,7 @@ OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
|||||||
ox::Error InsertTilesCommand::redo() noexcept {
|
ox::Error InsertTilesCommand::redo() noexcept {
|
||||||
auto &s = getSubSheet(m_img, m_idx);
|
auto &s = getSubSheet(m_img, m_idx);
|
||||||
auto &p = s.pixels;
|
auto &p = s.pixels;
|
||||||
auto dstPos = m_insertPos + m_insertCnt;
|
auto const dstPos = m_insertPos + m_insertCnt;
|
||||||
auto const src = &p[m_insertPos];
|
auto const src = &p[m_insertPos];
|
||||||
if (dstPos < p.size()) {
|
if (dstPos < p.size()) {
|
||||||
auto const dst = &p[dstPos];
|
auto const dst = &p[dstPos];
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace nostalgia::gfx {
|
namespace nostalgia::gfx {
|
||||||
|
|
||||||
gfx::UpdateSubSheetCommand::UpdateSubSheetCommand(
|
UpdateSubSheetCommand::UpdateSubSheetCommand(
|
||||||
TileSheet &img,
|
TileSheet &img,
|
||||||
TileSheet::SubSheetIdx idx,
|
TileSheet::SubSheetIdx idx,
|
||||||
ox::StringParam name,
|
ox::StringParam name,
|
||||||
|
@ -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.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
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.0</string>
|
||||||
|
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>12.0.0</string>
|
<string>12.0.0</string>
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
|
|
||||||
namespace keel {
|
namespace keel {
|
||||||
|
|
||||||
class Context;
|
|
||||||
|
|
||||||
class Context {
|
class Context {
|
||||||
public:
|
public:
|
||||||
ox::UPtr<ox::FileSystem> rom;
|
ox::UPtr<ox::FileSystem> rom;
|
||||||
|
@ -182,7 +182,7 @@ ox::Result<ox::CStringView> uuidToPath(Context &ctx, ox::UUID const&uuid) noexce
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Error reloadAsset(keel::Context &ctx, ox::StringViewCR assetId) noexcept {
|
ox::Error reloadAsset(Context &ctx, ox::StringViewCR assetId) noexcept {
|
||||||
if (beginsWith(assetId, "uuid://")) {
|
if (beginsWith(assetId, "uuid://")) {
|
||||||
return ctx.assetManager.reloadAsset(substr(assetId, 7));
|
return ctx.assetManager.reloadAsset(substr(assetId, 7));
|
||||||
} else {
|
} else {
|
||||||
|
@ -13,22 +13,10 @@ extern ox::String appVersion;
|
|||||||
|
|
||||||
namespace studio {
|
namespace studio {
|
||||||
|
|
||||||
AboutPopup::AboutPopup(turbine::Context &ctx) noexcept {
|
AboutPopup::AboutPopup(turbine::Context &ctx) noexcept: Popup("About") {
|
||||||
m_text = ox::sfmt("{} - {}", keelCtx(ctx).appName, olympic::appVersion);
|
m_text = ox::sfmt("{} - {}", keelCtx(ctx).appName, olympic::appVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AboutPopup::open() noexcept {
|
|
||||||
m_stage = Stage::Opening;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AboutPopup::close() noexcept {
|
|
||||||
m_stage = Stage::Closed;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AboutPopup::isOpen() const noexcept {
|
|
||||||
return m_stage == Stage::Open;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AboutPopup::draw(Context &sctx) noexcept {
|
void AboutPopup::draw(Context &sctx) noexcept {
|
||||||
if (ImGui::IsKeyPressed(ImGuiKey_Escape)) {
|
if (ImGui::IsKeyPressed(ImGuiKey_Escape)) {
|
||||||
close();
|
close();
|
||||||
@ -47,7 +35,7 @@ void AboutPopup::draw(Context &sctx) noexcept {
|
|||||||
ig::centerNextWindow(sctx.tctx);
|
ig::centerNextWindow(sctx.tctx);
|
||||||
auto open = true;
|
auto open = true;
|
||||||
if (ImGui::BeginPopupModal("About", &open, modalFlags)) {
|
if (ImGui::BeginPopupModal("About", &open, modalFlags)) {
|
||||||
ImGui::Text("%s", m_text.c_str());
|
ImGui::Text("%s\n\nBuild date: %s", m_text.c_str(), __DATE__);
|
||||||
ImGui::NewLine();
|
ImGui::NewLine();
|
||||||
ImGui::Dummy({148.0f, 0.0f});
|
ImGui::Dummy({148.0f, 0.0f});
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
@ -13,29 +13,14 @@
|
|||||||
|
|
||||||
namespace studio {
|
namespace studio {
|
||||||
|
|
||||||
class AboutPopup: public studio::Popup {
|
class AboutPopup final: public ig::Popup {
|
||||||
public:
|
|
||||||
enum class Stage {
|
|
||||||
Closed,
|
|
||||||
Opening,
|
|
||||||
Open,
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Stage m_stage = Stage::Closed;
|
|
||||||
ox::String m_text;
|
ox::String m_text;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AboutPopup(turbine::Context &ctx) noexcept;
|
explicit AboutPopup(turbine::Context &ctx) noexcept;
|
||||||
|
|
||||||
void open() noexcept override;
|
void draw(Context &sctx) noexcept override;
|
||||||
|
|
||||||
void close() noexcept override;
|
|
||||||
|
|
||||||
[[nodiscard]]
|
|
||||||
bool isOpen() const noexcept override;
|
|
||||||
|
|
||||||
void draw(studio::Context &sctx) noexcept override;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -65,10 +65,7 @@ OX_MODEL_END()
|
|||||||
StudioUI::StudioUI(turbine::Context &ctx, ox::StringParam projectDataDir) noexcept:
|
StudioUI::StudioUI(turbine::Context &ctx, ox::StringParam projectDataDir) noexcept:
|
||||||
m_sctx{*this, ctx},
|
m_sctx{*this, ctx},
|
||||||
m_tctx{ctx},
|
m_tctx{ctx},
|
||||||
m_projectDataDir{std::move(projectDataDir)},
|
m_projectDataDir{std::move(projectDataDir)} {
|
||||||
m_projectExplorer{keelCtx(m_tctx)},
|
|
||||||
m_newProject{m_projectDataDir},
|
|
||||||
m_aboutPopup{m_tctx} {
|
|
||||||
{
|
{
|
||||||
ImFontConfig fontCfg;
|
ImFontConfig fontCfg;
|
||||||
fontCfg.FontDataOwnedByAtlas = false;
|
fontCfg.FontDataOwnedByAtlas = false;
|
||||||
@ -255,7 +252,7 @@ void StudioUI::drawMenu() noexcept {
|
|||||||
void StudioUI::drawTabBar() noexcept {
|
void StudioUI::drawTabBar() noexcept {
|
||||||
auto const viewport = ImGui::GetContentRegionAvail();
|
auto const viewport = ImGui::GetContentRegionAvail();
|
||||||
ImGui::BeginChild("TabWindow##MainWindow##Studio", ImVec2(viewport.x, viewport.y));
|
ImGui::BeginChild("TabWindow##MainWindow##Studio", ImVec2(viewport.x, viewport.y));
|
||||||
constexpr auto tabBarFlags = ImGuiTabBarFlags_Reorderable | ImGuiTabBarFlags_TabListPopupButton;
|
constexpr auto tabBarFlags = ImGuiTabBarFlags_TabListPopupButton;
|
||||||
if (ImGui::BeginTabBar("TabBar##TabWindow##MainWindow##Studio", tabBarFlags)) {
|
if (ImGui::BeginTabBar("TabBar##TabWindow##MainWindow##Studio", tabBarFlags)) {
|
||||||
drawTabs();
|
drawTabs();
|
||||||
ImGui::EndTabBar();
|
ImGui::EndTabBar();
|
||||||
|
@ -36,7 +36,7 @@ class StudioUI: public ox::SignalHandler {
|
|||||||
TaskRunner m_taskRunner;
|
TaskRunner m_taskRunner;
|
||||||
ox::Vector<ox::UPtr<BaseEditor>> m_editors;
|
ox::Vector<ox::UPtr<BaseEditor>> m_editors;
|
||||||
ox::HashMap<ox::String, EditorMaker::Func> m_editorMakers;
|
ox::HashMap<ox::String, EditorMaker::Func> m_editorMakers;
|
||||||
ProjectExplorer m_projectExplorer;
|
ProjectExplorer m_projectExplorer{keelCtx(m_tctx)};
|
||||||
ox::Vector<ox::String> m_openFiles;
|
ox::Vector<ox::String> m_openFiles;
|
||||||
BaseEditor *m_activeEditorOnLastDraw = nullptr;
|
BaseEditor *m_activeEditorOnLastDraw = nullptr;
|
||||||
BaseEditor *m_activeEditor = nullptr;
|
BaseEditor *m_activeEditor = nullptr;
|
||||||
@ -45,6 +45,7 @@ class StudioUI: public ox::SignalHandler {
|
|||||||
ox::Vector<ox::Pair<ox::String>> m_queuedMoves;
|
ox::Vector<ox::Pair<ox::String>> m_queuedMoves;
|
||||||
ox::Vector<ox::Pair<ox::String>> m_queuedDirMoves;
|
ox::Vector<ox::Pair<ox::String>> m_queuedDirMoves;
|
||||||
NewMenu m_newMenu{keelCtx(m_tctx)};
|
NewMenu m_newMenu{keelCtx(m_tctx)};
|
||||||
|
AboutPopup m_aboutPopup{m_tctx};
|
||||||
DeleteConfirmation m_deleteConfirmation;
|
DeleteConfirmation m_deleteConfirmation;
|
||||||
NewDir m_newDirDialog;
|
NewDir m_newDirDialog;
|
||||||
ig::QuestionPopup m_closeFileConfirm{"Close File?", "This file has unsaved changes. Close?"};
|
ig::QuestionPopup m_closeFileConfirm{"Close File?", "This file has unsaved changes. Close?"};
|
||||||
@ -55,8 +56,7 @@ class StudioUI: public ox::SignalHandler {
|
|||||||
ig::MessagePopup m_messagePopup{"Message", ""};
|
ig::MessagePopup m_messagePopup{"Message", ""};
|
||||||
MakeCopyPopup m_copyFilePopup;
|
MakeCopyPopup m_copyFilePopup;
|
||||||
RenameFile m_renameFile;
|
RenameFile m_renameFile;
|
||||||
NewProject m_newProject;
|
NewProject m_newProject{m_projectDataDir};
|
||||||
AboutPopup m_aboutPopup;
|
|
||||||
ox::Array<Widget*, 10> const m_widgets {
|
ox::Array<Widget*, 10> const m_widgets {
|
||||||
&m_closeFileConfirm,
|
&m_closeFileConfirm,
|
||||||
&m_closeAppConfirm,
|
&m_closeAppConfirm,
|
||||||
|
@ -34,3 +34,4 @@ mkdir_p(dmg_dir)
|
|||||||
shutil.copytree('dist/darwin-arm64-release/NostalgiaStudio.app', f'{dmg_dir}/NostalgiaStudio.app')
|
shutil.copytree('dist/darwin-arm64-release/NostalgiaStudio.app', f'{dmg_dir}/NostalgiaStudio.app')
|
||||||
os.symlink('/Applications', f'{dmg_dir}/Applications')
|
os.symlink('/Applications', f'{dmg_dir}/Applications')
|
||||||
run(['hdiutil', 'create', '-srcfolder', dmg_dir, dmg])
|
run(['hdiutil', 'create', '-srcfolder', dmg_dir, dmg])
|
||||||
|
rm(dmg_dir)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user