AANIM.H 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. //===========================================================================//
  2. // Copyright (C) Microsoft Corporation. All rights reserved. //
  3. //===========================================================================//
  4. #ifndef AANIMATION_H
  5. #define AANIMATION_H
  6. class aAnimation;
  7. class FitIniFile;
  8. class aAnimation
  9. {
  10. public:
  11. aAnimation();
  12. ~aAnimation();
  13. aAnimation( const aAnimation& );
  14. aAnimation& operator=( const aAnimation& src );
  15. long init(FitIniFile* file, const char* prependName);
  16. long initWithBlockName( FitIniFile* file, const char* blockName );
  17. void destroy();
  18. void begin();
  19. void reverseBegin();
  20. void end();
  21. void update();
  22. bool isAnimating() const { return currentTime != -1.f; }
  23. bool isDone() const;
  24. float getXDelta() const;
  25. float getYDelta() const;
  26. float getScaleX() const;
  27. float getScaleY() const;
  28. unsigned long getColor() const;
  29. unsigned long getColor( float time ) const;
  30. void setReferencePoints( float X, float Y );
  31. float getDirection(){ return direction; }
  32. float getCurrentTime() { return currentTime; }
  33. float getMaxTime();
  34. protected:
  35. float currentTime;
  36. struct MoveInfo
  37. {
  38. float time; // in seconds
  39. float positionX; // x pixels
  40. float positionY; // pixels
  41. float scaleX;
  42. float scaleY;
  43. long color;
  44. };
  45. MoveInfo* infos;
  46. long infoCount;
  47. float refX;
  48. float refY;
  49. float direction;
  50. bool bLoops;
  51. private:
  52. void copyData( const aAnimation& );
  53. };
  54. // animations for the states we use everywhere
  55. class aAnimGroup
  56. {
  57. public:
  58. enum STATE
  59. {
  60. NORMAL = 0,
  61. PRESSED = 1,
  62. HIGHLIGHT = 2,
  63. PRESSEDHIGHLIGHT = 3,
  64. DISABLED = 4,
  65. MAX_ANIMATION_STATE
  66. };
  67. aAnimGroup(){curState = NORMAL; }
  68. long init( FitIniFile* file, const char* blockName );
  69. void setState( STATE );
  70. STATE getState() const;
  71. long getCurrentColor( STATE ) const;
  72. long getXDelta( STATE ) const;
  73. long getYDelta( STATE ) const;
  74. float getCurrnetScale( STATE ) const;
  75. void update();
  76. private:
  77. aAnimation animations[MAX_ANIMATION_STATE];
  78. STATE curState;
  79. };
  80. #endif