regions and a whole bunch of other shit

This commit is contained in:
2026-01-30 01:13:28 -05:00
parent ca3a0f6691
commit 1b7a49c25d
28 changed files with 988 additions and 107 deletions
+15
View File
@@ -1,24 +1,39 @@
#pragma once
#include <filesystem>
#include <map>
#include <set>
#include <string>
#include <tinyxml2/tinyxml2.h>
#include "texture.h"
#include "types.h"
namespace anm2ed::anm2
{
class Spritesheet
{
public:
struct Region
{
std::string name{};
glm::vec2 crop{};
glm::vec2 pivot{};
glm::vec2 size{};
};
std::filesystem::path path{};
resource::Texture texture;
std::map<int, Region> regions{};
Spritesheet() = default;
Spritesheet(tinyxml2::XMLElement*, int&);
Spritesheet(const std::filesystem::path&, const std::filesystem::path& = {});
tinyxml2::XMLElement* to_element(tinyxml2::XMLDocument&, int);
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&);