Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

Animation.h

Go to the documentation of this file.
00001 
00007 #ifndef _ANIMATION_H_
00008 #define _ANIMATION_H_
00009 
00010 #include "AnimationManager.h"
00011 #include "GameDXListener.h"
00012 #include "IsoBomb.h"
00013 
00024 class Animation : public GameDXListener {
00025 
00026 private:
00027     // Holds the sprite
00028     LPD3DXSPRITE m_sprite; 
00029 
00030     // Stores x and y values for scaling the sprite
00031     D3DXVECTOR2* scaleSprite;
00032     // Stores x and y values for translating the sprite
00033     D3DXVECTOR2* translateSprite; 
00034         
00035     // Total number of textures in the animation
00036     int totalTextures; 
00037     // Current frame to be drawn
00038     int currentFrame; 
00039 
00040     // Total amount of time the animation should take to run
00041     float totalAnimationRuntime; 
00042     
00043     // The current time when running the animation, used to keep track of
00044     // the current frame
00045     float frameTime;
00046     
00047     // Length of each frame, frameLength = totalAnimationRuntime / totalTextures 
00048     float frameLength;
00049 
00050     // Keeps track if the animation is running or not, so updates don't happen
00051     bool animStopped;
00052 
00053     // A pointer to the current set of animation frames
00054     AnimationFrames* animation;
00055 
00056     // The x and y offsets
00057     int offsetX;
00058     int offsetY;
00059 
00060     // Value used to for alpha blending
00061     int alphaValue;
00062 
00063     // The value alphaStarts at for blending
00064     int alphaStartValue;
00065 
00066     // False means do not use alpha
00067     bool useAlpha;
00068 
00069     // Value to control how fast the alpha decreases
00070     float alphaSpeed;
00071 
00075     int red, green, blue;
00076 
00077 public:
00078 
00084     void draw( const Point& anchor );
00085 
00094     void update( float dt );
00095 
00101     int getNumTextures();
00102 
00108     AnimationFrames* getAnimationFrames();
00109 
00115     void setAnimationFrames( AnimationFrames* frames );
00116     
00122     float getAnimRuntime();
00123 
00129     void setAnimRuntime( float runtime );
00130 
00136     void setScaleFactor( float factor );
00137 
00142     void stop();
00143 
00148     void start();
00149 
00156     void setOffsets( int x, int y );
00157 
00164     bool isAnimStopped();
00165 
00171     void setUsingAlpha( bool alpha );
00172 
00179     void setAlphaBlendSpeed( float speed );
00180 
00187     void setStartAlphaValue( int a );
00188 
00194     void setAlphaValue( int a );
00195 
00203     void setColor( int r, int g, int b );
00204 
00205     // Constructors
00206     Animation();
00207 
00208     // Destructor
00209     ~Animation();
00210 
00211 public:
00216     void init();
00217 
00218 public:
00222     virtual void OnLostDevice();
00223 
00227     virtual void OnResetDevice();
00228 
00229 };
00230 
00231 #endif

Generated on Tue Mar 4 02:29:25 2003 for SuperIsoBomb by doxygen1.2.18