![]() |
AppEasy Core SDK
1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
|
00001 // 00002 // 00003 // AppEasy SDK - Cross Platform Multi-purpose Game and App Engine 00004 // 00005 // Developed by Matthew Hopwood of Pocketeers Limited - www.pocketeers.co.uk 00006 // 00007 // For updates, tutorials and more details check out www.appeasymobile.com 00008 // 00009 // This code is provided free of charge and without any warranty whatsoever. You must ensure that this whole notice is present in all files and derivatives, so the reader knows its origin. 00010 // If you use this SDK in your product then please ensure that you credit AppEasy's usage appropriately. Please see www.appeasymobile.com for licensing details and support 00011 // 00012 // 00013 00014 #if !defined(_CZ_ADS_VIEW_ANIMATOR_H_) 00015 #define _CZ_ADS_VIEW_ANIMATOR_H_ 00016 00017 #include "CzUtil.h" 00018 #include "CzTime.h" 00019 #include "CzTypes.h" 00020 00021 // 00022 // 00023 // CzAdsViewAnimator - The CzAdsViewAnimator class is responsible for animating a CzAdsView 00024 // 00025 // 00026 class CzAdsViewAnimator 00027 { 00028 public: 00029 enum eCzAdsAnimIn 00030 { 00031 AnimFadeIn, // Fades in 00032 AnimScaleIn, // Scales in 00033 AnimSpinIn, // Spins in 00034 AnimBottomSweepIn, // Sweeps in from bottom 00035 AnimTopSweepIn, // Sweeps in from bottom 00036 AnimLeftSweepIn, // Sweeps in from left 00037 AnimRightSweepIn, // Sweeps in from right 00038 }; 00039 enum eCzAdsAnimOut 00040 { 00041 AnimFadeOut, // Fades in 00042 AnimScaleOut, // Scales in 00043 AnimSpinOut, // Spins in 00044 AnimBottomSweepOut, // Sweeps in from bottom 00045 AnimTopSweepOut, // Sweeps in from bottom 00046 AnimLeftSweepOut, // Sweeps in from left 00047 AnimRightSweepOut, // Sweeps in from right 00048 }; 00049 enum eCzAdsAnimStay 00050 { 00051 AnimNone, // No anim 00052 AnimWobble, // Wobble 00053 AnimScale, // Scale 00054 }; 00055 enum eCzAdsAnimPhase 00056 { 00057 AnimPhaseIn, // Animation phase in 00058 AnimPhaseStay, // Animation phase stay 00059 AnimPhaseOut, // Animation phase out 00060 AnimPhaseDone, // Animation done 00061 }; 00062 00063 // Properties 00064 protected: 00065 CzIVec2 RestingPosition; // resting position where ad should stop 00066 eCzAdsAnimIn InAnim; // Animation to show the ad 00067 eCzAdsAnimOut OutAnim; // Animation to hide the ad 00068 eCzAdsAnimStay StayAnim; // Animation shilst ad is visible 00069 int InDuration; // Amount of time to spend bringing the ad in 00070 int OutDuration; // Amount of time to spend sending the ad out 00071 int StayDuration; // Amount of time to ad shoud stay on screen 00072 int Width, Height; // Canvas width and height 00073 int AdWidth, AdHeight; // Ad width and height 00074 int AdViewDataIndex; // The index of this animations parent ad view data object in the ad view 00075 bool Looped; // if true then animation will loop continually 00076 public: 00077 void setRestingPosition(int x, int y) { RestingPosition.x = x; RestingPosition.y = y; } 00078 void setInAnim(eCzAdsAnimIn anim, int duration_ms) { InAnim = anim; InDuration = duration_ms; Reset(); } 00079 void setOutAnim(eCzAdsAnimOut anim, int duration_ms) { OutAnim = anim; OutDuration = duration_ms; } 00080 void setStayAnim(eCzAdsAnimStay anim) { StayAnim = anim; } 00081 void setStayDuration(int duration_ms) { StayDuration = duration_ms; } 00082 void setCanvasSize(int width, int height) { Width = width; Height = height; } 00083 void setAdSize(int width, int height) { AdWidth = width; AdHeight = height; } 00084 void setAdViewDataIndex(int index) { AdViewDataIndex = index; } 00085 void setLooped(bool looped) { Looped = looped; } 00086 eCzAdsAnimPhase getPhase() const { return AnimPhase; } 00087 // Properties end 00088 00089 protected: 00090 CzIVec2 TargetPosition; 00091 float TargetAngle; 00092 float TargetScale; 00093 CzColour TargetColour; 00094 CzIVec2 StartPosition; 00095 float StartAngle; 00096 float StartScale; 00097 CzColour StartColour; 00098 eCzAdsAnimPhase AnimPhase; 00099 CzTimer AnimTimer; 00100 void State_PhaseIn(); 00101 void State_PhaseOut(); 00102 void State_PhaseStay(); 00103 00104 public: 00105 CzAdsViewAnimator() {} 00106 virtual ~CzAdsViewAnimator() {} 00107 virtual void Init(); 00108 virtual void Update(float dt); // Updates the anim view manager 00109 virtual void Reset(); // Reset the animation 00110 00111 // Utility 00112 }; 00113 00114 00115 00116 #endif // _CZ_ADS_VIEW_ANIMATOR_H_