Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / rive-cpp / include / rive / generated / animation / linear_animation_base.hpp
1 #ifndef _RIVE_LINEAR_ANIMATION_BASE_HPP_
2 #define _RIVE_LINEAR_ANIMATION_BASE_HPP_
3 #include "rive/animation/animation.hpp"
4 #include "rive/core/field_types/core_bool_type.hpp"
5 #include "rive/core/field_types/core_double_type.hpp"
6 #include "rive/core/field_types/core_uint_type.hpp"
7 namespace rive {
8     class LinearAnimationBase : public Animation {
9     protected:
10         typedef Animation Super;
11
12     public:
13         static const uint16_t typeKey = 31;
14
15         /// Helper to quickly determine if a core object extends another without RTTI
16         /// at runtime.
17         bool isTypeOf(uint16_t typeKey) const override {
18             switch (typeKey) {
19                 case LinearAnimationBase::typeKey:
20                 case AnimationBase::typeKey:
21                     return true;
22                 default:
23                     return false;
24             }
25         }
26
27         uint16_t coreType() const override { return typeKey; }
28
29         static const uint16_t fpsPropertyKey = 56;
30         static const uint16_t durationPropertyKey = 57;
31         static const uint16_t speedPropertyKey = 58;
32         static const uint16_t loopValuePropertyKey = 59;
33         static const uint16_t workStartPropertyKey = 60;
34         static const uint16_t workEndPropertyKey = 61;
35         static const uint16_t enableWorkAreaPropertyKey = 62;
36
37     private:
38         uint32_t m_Fps = 60;
39         uint32_t m_Duration = 60;
40         float m_Speed = 1.0f;
41         uint32_t m_LoopValue = 0;
42         uint32_t m_WorkStart = -1;
43         uint32_t m_WorkEnd = -1;
44         bool m_EnableWorkArea = false;
45
46     public:
47         inline uint32_t fps() const { return m_Fps; }
48         void fps(uint32_t value) {
49             if (m_Fps == value) {
50                 return;
51             }
52             m_Fps = value;
53             fpsChanged();
54         }
55
56         inline uint32_t duration() const { return m_Duration; }
57         void duration(uint32_t value) {
58             if (m_Duration == value) {
59                 return;
60             }
61             m_Duration = value;
62             durationChanged();
63         }
64
65         inline float speed() const { return m_Speed; }
66         void speed(float value) {
67             if (m_Speed == value) {
68                 return;
69             }
70             m_Speed = value;
71             speedChanged();
72         }
73
74         inline uint32_t loopValue() const { return m_LoopValue; }
75         void loopValue(uint32_t value) {
76             if (m_LoopValue == value) {
77                 return;
78             }
79             m_LoopValue = value;
80             loopValueChanged();
81         }
82
83         inline uint32_t workStart() const { return m_WorkStart; }
84         void workStart(uint32_t value) {
85             if (m_WorkStart == value) {
86                 return;
87             }
88             m_WorkStart = value;
89             workStartChanged();
90         }
91
92         inline uint32_t workEnd() const { return m_WorkEnd; }
93         void workEnd(uint32_t value) {
94             if (m_WorkEnd == value) {
95                 return;
96             }
97             m_WorkEnd = value;
98             workEndChanged();
99         }
100
101         inline bool enableWorkArea() const { return m_EnableWorkArea; }
102         void enableWorkArea(bool value) {
103             if (m_EnableWorkArea == value) {
104                 return;
105             }
106             m_EnableWorkArea = value;
107             enableWorkAreaChanged();
108         }
109
110         Core* clone() const override;
111         void copy(const LinearAnimationBase& object) {
112             m_Fps = object.m_Fps;
113             m_Duration = object.m_Duration;
114             m_Speed = object.m_Speed;
115             m_LoopValue = object.m_LoopValue;
116             m_WorkStart = object.m_WorkStart;
117             m_WorkEnd = object.m_WorkEnd;
118             m_EnableWorkArea = object.m_EnableWorkArea;
119             Animation::copy(object);
120         }
121
122         bool deserialize(uint16_t propertyKey, BinaryReader& reader) override {
123             switch (propertyKey) {
124                 case fpsPropertyKey:
125                     m_Fps = CoreUintType::deserialize(reader);
126                     return true;
127                 case durationPropertyKey:
128                     m_Duration = CoreUintType::deserialize(reader);
129                     return true;
130                 case speedPropertyKey:
131                     m_Speed = CoreDoubleType::deserialize(reader);
132                     return true;
133                 case loopValuePropertyKey:
134                     m_LoopValue = CoreUintType::deserialize(reader);
135                     return true;
136                 case workStartPropertyKey:
137                     m_WorkStart = CoreUintType::deserialize(reader);
138                     return true;
139                 case workEndPropertyKey:
140                     m_WorkEnd = CoreUintType::deserialize(reader);
141                     return true;
142                 case enableWorkAreaPropertyKey:
143                     m_EnableWorkArea = CoreBoolType::deserialize(reader);
144                     return true;
145             }
146             return Animation::deserialize(propertyKey, reader);
147         }
148
149     protected:
150         virtual void fpsChanged() {}
151         virtual void durationChanged() {}
152         virtual void speedChanged() {}
153         virtual void loopValueChanged() {}
154         virtual void workStartChanged() {}
155         virtual void workEndChanged() {}
156         virtual void enableWorkAreaChanged() {}
157     };
158 } // namespace rive
159
160 #endif