Mega Region Update.

This commit is contained in:
2026-02-05 21:34:42 -05:00
parent 00bff4a91f
commit 64d6a1d95a
45 changed files with 1590 additions and 205 deletions
+13 -3
View File
@@ -3,11 +3,14 @@
#include <filesystem>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <tinyxml2/tinyxml2.h>
#include "texture.h"
#include "anm2_type.h"
#include "types.h"
#include "origin.h"
namespace anm2ed::anm2
{
@@ -16,27 +19,34 @@ namespace anm2ed::anm2
public:
struct Region
{
using Origin = origin::Type;
static constexpr Origin TOP_LEFT = origin::TOP_LEFT;
static constexpr Origin ORIGIN_CENTER = origin::ORIGIN_CENTER;
static constexpr Origin CUSTOM = origin::CUSTOM;
std::string name{};
glm::vec2 crop{};
glm::vec2 pivot{};
glm::vec2 size{};
Origin origin{CUSTOM};
};
std::filesystem::path path{};
resource::Texture texture;
std::map<int, Region> regions{};
std::vector<int> regionOrder{};
Spritesheet() = default;
Spritesheet(tinyxml2::XMLElement*, int&);
Spritesheet(const std::filesystem::path&, const std::filesystem::path& = {});
tinyxml2::XMLElement* to_element(tinyxml2::XMLDocument&, int);
tinyxml2::XMLElement* to_element(tinyxml2::XMLDocument&, int, Flags = 0);
std::string to_string(int id);
std::string region_to_string(int id);
bool regions_deserialize(const std::string&, types::merge::Type, std::string* = nullptr);
bool save(const std::filesystem::path&, const std::filesystem::path& = {});
void serialize(tinyxml2::XMLDocument&, tinyxml2::XMLElement*, int);
void reload(const std::filesystem::path&);
void serialize(tinyxml2::XMLDocument&, tinyxml2::XMLElement*, int, Flags = 0);
void reload(const std::filesystem::path&, const std::filesystem::path& = {});
bool is_valid();
};
}