ZFFramework
 
Loading...
Searching...
No Matches
ZFAniForFrame.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFAniForFrame_h_
7#define _ZFI_ZFAniForFrame_h_
8
9#include "ZFAnimation.h"
11
13#define ZFSerializableKeyword_ZFAniForFrame_frames "frames"
14
15// ============================================================
16zfclassFwd _ZFP_ZFAniForFramePrivate;
34zfclass ZFLIB_ZFUtility ZFAniForFrame : zfextend ZFAnimation {
35 ZFOBJECT_DECLARE(ZFAniForFrame, ZFAnimation)
36
37public:
38 // ============================================================
39 // event
45 ZFEVENT(AniFrameOnUpdate)
46
47 // ============================================================
48 // animation setting
49public:
53 )
57 )
58
63 , ZFMP_IN(zfindex, index)
64 )
67 , ZFMP_IN(zfindex, index)
68 )
71
76
77 // ============================================================
78 // property
79public:
93
94 // ============================================================
95 // object
96protected:
98 virtual void objectOnInit(void);
100 virtual void objectOnDealloc(void);
102 virtual ZFCompareResult objectCompareValueImpl(ZF_IN ZFObject *anotherObj) {
103 if(this == anotherObj) {return ZFCompareEqual;}
104 zfself *another = zfcast(zfself *, anotherObj);
105 if(another == zfnull) {return ZFCompareUncomparable;}
106 if(this->frameCount() != another->frameCount()
107 || this->useGlobalTimer() != another->useGlobalTimer()
108 ) {
110 }
111 for(zfindex i = 0; i < this->frameCount(); ++i) {
112 if(this->frameAt(i) != another->frameAt(i)) {
114 }
115 }
116 return ZFCompareEqual;
117 }
118
121 ZF_IN const ZFSerializableData &serializableData
122 , ZF_OUT_OPT zfstring *outErrorHint = zfnull
123 , ZF_OUT_OPT ZFSerializableData *outErrorPos = zfnull
124 );
127 ZF_IN_OUT ZFSerializableData &serializableData
128 , ZF_OUT_OPT zfstring *outErrorHint = zfnull
129 , ZF_IN_OPT ZFSerializable *refOwner = zfnull
130 );
131
132 // ============================================================
133 // start stop
134public:
136 virtual zftimet durationFixed(void);
137
138protected:
140 virtual void aniImplStart(void);
142 virtual void aniImplStop(void);
143
144protected:
153
154private:
155 _ZFP_ZFAniForFramePrivate *d;
156 friend zfclassFwd _ZFP_ZFAniForFramePrivate;
157};
158
160#endif // #ifndef _ZFI_ZFAniForFrame_h_
161
base class of all animation
#define ZF_OUT_OPT
dummy macro that shows the param used as optional output
Definition ZFCoreTypeDef_ClassType.h:192
#define zfextend
dummy macro shows class inherit from another
Definition ZFCoreTypeDef_ClassType.h:53
#define zfoverride
dummy macro shows that method override parent's method
Definition ZFCoreTypeDef_ClassType.h:58
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:180
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:184
#define ZF_IN_OUT
dummy macro that shows the param used as required input and output
Definition ZFCoreTypeDef_ClassType.h:196
#define zfclassFwd
forward declaration of a class type
Definition ZFCoreTypeDef_ClassType.h:31
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:103
_ZFT_t_zfindex zfindex
similar to size_t, used for index and size only
Definition ZFCoreTypeDef_CoreType.h:154
#define zftrue
bool true type
Definition ZFCoreTypeDef_CoreType.h:107
_zft_zftimet zftimet
time unit, ensured at least 64 bit, ensured signed
Definition ZFCoreTypeDef_CoreType.h:203
#define zfnull
same as NULL, defined for future use
Definition ZFCoreTypeDef_CoreType.h:88
ZFCompareResult
compare result of two ZFObjects
Definition ZFCoreTypeDef_OtherType.h:28
@ ZFCompareUncomparable
Definition ZFCoreTypeDef_OtherType.h:29
@ ZFCompareEqual
Definition ZFCoreTypeDef_OtherType.h:31
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
#define ZFMP_IN(ParamType, paramName)
macro to wrap param types for ZFMETHOD_INLINE_0 series
Definition ZFMethod.h:105
#define ZFMETHOD_DECLARE_0(ReturnType, MethodName)
see ZFMethod
Definition ZFMethodDeclare.h:693
#define ZFMETHOD_DECLARE_1(ReturnType, MethodName, ZFMP_0)
see ZFMethod
Definition ZFMethodDeclare.h:854
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
#define zfcast(T_To, obj)
safely cast ZFObject types, return null if not desired type
Definition ZFObjectCast.h:28
#define zfclass
same as class, shows that this class is a ZFObject type
Definition ZFObjectClassTypeFwd.h:38
#define ZFOBJECT_DECLARE(ChildClass, SuperClass,...)
necessary for every class inherit from ZFObject
Definition ZFObjectDeclare.h:126
#define ZFEVENT(YourEvent)
see ZFObject::observerNotify
Definition ZFObjectObserver.h:328
#define ZFPROPERTY_ASSIGN(Type, Name,...)
see ZFPROPERTY_RETAIN
Definition ZFPropertyDeclare.h:128
#define ZFLIB_ZFUtility
used to export symbols
Definition ZFUtilityDef.h:15
virtual zfbool & useGlobalTimer()
whether use global timer to update frame, true by default
Definition ZFAniForFrame.h:92
virtual zfbool serializableOnSerializeFromData(const ZFSerializableData &serializableData, zfstring *outErrorHint=zft_zfnull, ZFSerializableData *outErrorPos=zft_zfnull)
for serializable data that has "category" attribute, ZFSerializable would ignore it and leave it to s...
virtual void objectOnInit(void)
override this to init your object
virtual void frameRemoveAll()
remove all frame
virtual void frames(const ZFCoreArray< zftimet > &frames)
add multiple frames
virtual zftimet frameAt(zfindex index)
return frame duration at index
virtual void frameRemoveAt(zfindex index)
remove frame at index
virtual zfindex frameCount()
return frame count
virtual zfbool serializableOnSerializeToData(ZFSerializableData &serializableData, zfstring *outErrorHint=zft_zfnull, ZFSerializable *refOwner=zft_zfnull)
corresponding to serializableOnSerializeFromData, return whether the task is success,...
virtual void aniFrameOnUpdate(zfindex frameIndex)
called to do the actual update
virtual void aniImplStart(void)
for subclass to achieve actual animation
ZFAniForFrame zfself
class ref to self
Definition ZFAniForFrame.h:35
virtual zftimet durationFixed(void)
util method to duration
virtual void frame(zftimet duration)
add a frame
virtual void aniImplStop(void)
for subclass to stop actual animation
virtual zfindex frameIndex()
current frame index, or zfindexMax if stopped
virtual void objectOnDealloc(void)
override this to destroy your object
virtual ZFCompareResult objectCompareValueImpl(ZFObject *anotherObj)
see objectCompareValue
Definition ZFAniForFrame.h:102
virtual zftimet & duration()
animation's duration in miliseconds, 0 to use ZFAniDuration, 0 by default
Definition ZFAnimation.h:57
light weight array
Definition ZFCoreArray.h:331
ZFSerializable's data container, see ZFSerializable.
Definition ZFSerializableData.h:74