Porytiles
Loading...
Searching...
No Matches
anim_json_parser.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <filesystem>
4#include <map>
5#include <string>
6#include <vector>
7
8#include "gsl/pointers"
9
15
16namespace porytiles {
17
52 public:
53 explicit AnimJsonParser(gsl::not_null<const TextFormatter *> format);
54
66 parse(const std::filesystem::path &json_path) const;
67
80 parse_primary_references(const std::filesystem::path &json_path) const;
81
94 [[nodiscard]] ChainableResult<void> write(
95 const std::filesystem::path &json_path,
96 const std::map<DynamicCasedName, AnimParams> &params,
97 const std::map<DynamicCasedName, std::vector<AnimOverrideEntry>> &primary_references = {}) const;
98
99 private:
100 const TextFormatter *format_;
101};
102
103} // namespace porytiles
Parses and writes animation configuration JSON files (anim.json).
ChainableResult< void > write(const std::filesystem::path &json_path, const std::map< DynamicCasedName, AnimParams > &params, const std::map< DynamicCasedName, std::vector< AnimOverrideEntry > > &primary_references={}) const
Writes animation parameters to an anim.json file.
ChainableResult< std::map< DynamicCasedName, std::vector< AnimOverrideEntry > > > parse_primary_references(const std::filesystem::path &json_path) const
Parses the primary_references section from an anim.json file.
ChainableResult< std::map< DynamicCasedName, AnimParams > > parse(const std::filesystem::path &json_path) const
Parses an anim.json file into a map of animation parameters.
A result type that maintains a chainable sequence of errors for debugging and error reporting.
A smart string wrapper that preserves word structure for lossless case format conversion.
Abstract base class for applying text styling with context-aware formatting.