1 /* !!!! GENERATED FILE - DO NOT EDIT !!!! 2 * -------------------------------------- 3 * 4 * This file is part of liblcf. Copyright (c) 2021 liblcf authors. 5 * https://github.com/EasyRPG/liblcf - https://easyrpg.org 6 * 7 * liblcf is Free/Libre Open Source Software, released under the MIT License. 8 * For the full copyright and license information, please view the COPYING 9 * file that was distributed with this source code. 10 */ 11 12 #ifndef LCF_RPG_ANIMATION_H 13 #define LCF_RPG_ANIMATION_H 14 15 // Headers 16 #include <vector> 17 #include "lcf/dbstring.h" 18 #include "lcf/enum_tags.h" 19 #include "lcf/rpg/animationframe.h" 20 #include "lcf/rpg/animationtiming.h" 21 #include "lcf/context.h" 22 #include <ostream> 23 #include <type_traits> 24 25 /** 26 * rpg::Animation class. 27 */ 28 namespace lcf { 29 namespace rpg { 30 class Animation { 31 public: 32 enum Scope { 33 Scope_target = 0, 34 Scope_screen = 1 35 }; 36 static constexpr auto kScopeTags = lcf::makeEnumTags<Scope>( 37 "target", 38 "screen" 39 ); 40 enum Position { 41 Position_up = 0, 42 Position_middle = 1, 43 Position_down = 2 44 }; 45 static constexpr auto kPositionTags = lcf::makeEnumTags<Position>( 46 "up", 47 "middle", 48 "down" 49 ); 50 51 int ID = 0; 52 DBString name; 53 DBString animation_name; 54 bool large = false; 55 std::vector<AnimationTiming> timings; 56 int32_t scope = 0; 57 int32_t position = 2; 58 std::vector<AnimationFrame> frames; 59 }; 60 inline std::ostream& operator<<(std::ostream& os, Animation::Scope code) { 61 os << static_cast<std::underlying_type_t<decltype(code)>>(code); 62 return os; 63 } 64 inline std::ostream& operator<<(std::ostream& os, Animation::Position code) { 65 os << static_cast<std::underlying_type_t<decltype(code)>>(code); 66 return os; 67 } 68 69 inline bool operator==(const Animation& l, const Animation& r) { 70 return l.name == r.name 71 && l.animation_name == r.animation_name 72 && l.large == r.large 73 && l.timings == r.timings 74 && l.scope == r.scope 75 && l.position == r.position 76 && l.frames == r.frames; 77 } 78 79 inline bool operator!=(const Animation& l, const Animation& r) { 80 return !(l == r); 81 } 82 83 std::ostream& operator<<(std::ostream& os, const Animation& obj); 84 85 template <typename F, typename ParentCtx = Context<void,void>> 86 void ForEachString(Animation& obj, const F& f, const ParentCtx* parent_ctx = nullptr) { 87 const auto ctx1 = Context<Animation, ParentCtx>{ "name", -1, &obj, parent_ctx }; 88 f(obj.name, ctx1); 89 const auto ctx2 = Context<Animation, ParentCtx>{ "animation_name", -1, &obj, parent_ctx }; 90 f(obj.animation_name, ctx2); 91 for (int i = 0; i < static_cast<int>(obj.timings.size()); ++i) { 92 const auto ctx4 = Context<Animation, ParentCtx>{ "timings", i, &obj, parent_ctx }; 93 ForEachString(obj.timings[i], f, &ctx4); 94 } 95 for (int i = 0; i < static_cast<int>(obj.frames.size()); ++i) { 96 const auto ctx7 = Context<Animation, ParentCtx>{ "frames", i, &obj, parent_ctx }; 97 ForEachString(obj.frames[i], f, &ctx7); 98 } 99 (void)obj; 100 (void)f; 101 (void)parent_ctx; 102 } 103 104 } // namespace rpg 105 } // namespace lcf 106 107 #endif 108