diff options
author | hop311 <hop3114@gmail.com> | 2024-04-15 01:13:46 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-04-15 01:24:07 +0200 |
commit | 083365191bd5f586edd850e0bd6a0190de782ab1 (patch) | |
tree | c03b31ed54afbd0cba57b37e47a16fb560131b8f /src/openvic-simulation/interface/GFXObject.hpp | |
parent | a7f125a5f276e2951d1236fe88e32c5c08271504 (diff) |
Rework GFX::Actor Attachments and Animations
Diffstat (limited to 'src/openvic-simulation/interface/GFXObject.hpp')
-rw-r--r-- | src/openvic-simulation/interface/GFXObject.hpp | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/src/openvic-simulation/interface/GFXObject.hpp b/src/openvic-simulation/interface/GFXObject.hpp index 840e4a9..db15096 100644 --- a/src/openvic-simulation/interface/GFXObject.hpp +++ b/src/openvic-simulation/interface/GFXObject.hpp @@ -24,48 +24,44 @@ namespace OpenVic::GFX { friend std::unique_ptr<Actor> std::make_unique<Actor>(); public: - class Attachment : public Named<> { - friend class LoadBase; + class Attachment { + friend class Actor; - private: - std::string PROPERTY(node); - int32_t PROPERTY(attach_id); + public: + using attach_id_t = uint32_t; - protected: - Attachment(); + private: + std::string PROPERTY(actor_name); + std::string PROPERTY(attach_node); + attach_id_t PROPERTY(attach_id); - bool _fill_key_map(NodeTools::case_insensitive_key_map_t& key_map) override; + Attachment(std::string_view new_actor_name, std::string_view new_attach_node, attach_id_t new_attach_id); public: Attachment(Attachment&&) = default; - virtual ~Attachment() = default; }; - class Animation : public Named<> { - friend class LoadBase; + class Animation { + friend class Actor; std::string PROPERTY(file); - fixed_point_t PROPERTY(default_time); + fixed_point_t PROPERTY(scroll_time); - protected: - Animation(); - - bool _fill_key_map(NodeTools::case_insensitive_key_map_t& key_map) override; + Animation(std::string_view new_file, fixed_point_t new_scroll_time); public: Animation(Animation&&) = default; - virtual ~Animation() = default; }; private: - std::string PROPERTY(model_file); - std::string PROPERTY(idle_animation_file); - std::string PROPERTY(move_animation_file); - std::string PROPERTY(attack_animation_file); fixed_point_t PROPERTY(scale); + std::string PROPERTY(model_file); + std::optional<Animation> PROPERTY(idle_animation); + std::optional<Animation> PROPERTY(move_animation); + std::optional<Animation> PROPERTY(attack_animation); + std::vector<Attachment> PROPERTY(attachments); - NamedRegistry<Attachment> IDENTIFIER_REGISTRY(attachment); - NamedRegistry<Animation> IDENTIFIER_REGISTRY(animation); + bool _set_animation(std::string_view name, std::string_view file, fixed_point_t scroll_time); protected: Actor(); |