Refactor + render animation tweaks + updated frame properties + bug fixes

This commit is contained in:
2025-12-17 23:02:00 -05:00
parent b4b4fe3714
commit 119bbc4081
63 changed files with 1964 additions and 1701 deletions
+10 -15
View File
@@ -13,9 +13,11 @@
#include <cstring>
#include <format>
#include "filesystem_.h"
#include "path_.h"
namespace anm2ed::dialog
using namespace anm2ed::util;
namespace anm2ed
{
static void callback(void* userData, const char* const* filelist, int filter)
{
@@ -23,7 +25,7 @@ namespace anm2ed::dialog
if (filelist && filelist[0] && strlen(filelist[0]) > 0)
{
self->path = anm2ed::util::filesystem::path_from_utf8(filelist[0]);
self->path = path::from_utf8(filelist[0]);
self->selectedFilter = filter;
}
else
@@ -32,13 +34,6 @@ namespace anm2ed::dialog
self->path.clear();
}
}
}
using namespace anm2ed::dialog;
namespace filesystem = anm2ed::util::filesystem;
namespace anm2ed
{
Dialog::Dialog(SDL_Window* window)
{
@@ -46,21 +41,21 @@ namespace anm2ed
this->window = window;
}
void Dialog::file_open(dialog::Type type)
void Dialog::file_open(Type type)
{
SDL_ShowOpenFileDialog(callback, this, window, FILTERS[TYPE_FILTERS[type]], std::size(FILTERS[TYPE_FILTERS[type]]),
nullptr, false);
this->type = type;
}
void Dialog::file_save(dialog::Type type)
void Dialog::file_save(Type type)
{
SDL_ShowSaveFileDialog(callback, this, window, FILTERS[TYPE_FILTERS[type]], std::size(FILTERS[TYPE_FILTERS[type]]),
nullptr);
this->type = type;
}
void Dialog::folder_open(dialog::Type type)
void Dialog::folder_open(Type type)
{
SDL_ShowOpenFolderDialog(callback, this, window, nullptr, false);
this->type = type;
@@ -72,7 +67,7 @@ namespace anm2ed
#ifdef _WIN32
ShellExecuteW(nullptr, L"open", path.native().c_str(), nullptr, nullptr, SW_SHOWNORMAL);
#elif __unix__
auto pathUtf8 = filesystem::path_to_utf8(path);
auto pathUtf8 = path::to_utf8(path);
system(std::format("xdg-open \"{}\" &", pathUtf8).c_str());
#else
toasts.push(localize.get(TOAST_NOT_SUPPORTED));
@@ -82,6 +77,6 @@ namespace anm2ed
void Dialog::reset() { *this = Dialog(this->window); }
bool Dialog::is_selected(dialog::Type type) const { return this->type == type && !path.empty(); }
bool Dialog::is_selected(Type type) const { return this->type == type && !path.empty(); }
};