Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

AnimationSet.h

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------
00002 // Lamp : Open source game middleware
00003 // Copyright (C) 2004  Junpei Ohtani ( Email : junpee@users.sourceforge.jp )
00004 //
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 //------------------------------------------------------------------------------
00019 
00020 /** @file
00021  * アニメーションセットヘッダ
00022  * @author Junpee
00023  */
00024 
00025 #ifndef ANIMATION_SET_H_
00026 #define ANIMATION_SET_H_
00027 
00028 #include <Animation/System/Animation.h>
00029 #include <Core/Container/ArrayList.h>
00030 
00031 namespace Lamp{
00032 
00033 //------------------------------------------------------------------------------
00034 /**
00035  * アニメーションセット
00036  */
00037 class AnimationSet : public Animation{
00038 friend class AnimationManager;
00039 public:
00040     //--------------------------------------------------------------------------
00041     // アニメーションインターフェース
00042     //--------------------------------------------------------------------------
00043     /**
00044      * アニメーションの追加
00045      * @param animation 追加するアニメーション
00046      */
00047     virtual void addAnimation(Animation* animation){
00048         animations_.add(animation);
00049     }
00050 
00051     /**
00052      * アニメーションの削除
00053      * @param animation 削除するアニメーション
00054      */
00055     virtual void removeAnimation(Animation* animation){
00056         animations_.removeByValue(animation);
00057     }
00058 
00059     /**
00060      * アニメーション数の取得
00061      * @return アニメーション数
00062      */
00063     virtual int getAnimationCount() const{ return animations_.getCount(); }
00064 
00065     /**
00066      * アニメーションの取得
00067      * @param index インデックス
00068      * @return アニメーション
00069      */
00070     virtual Animation* getAnimation(int index) const{
00071         Assert(index >= 0);
00072         Assert(index < getAnimationCount());
00073         return animations_.get(index);
00074     }
00075 
00076     //--------------------------------------------------------------------------
00077     // バインド
00078     //--------------------------------------------------------------------------
00079     /**
00080      * バインド
00081      * @param scene バインド対象シーン
00082      * @return 全ての下位アニメーションにバインド成功すればtrue
00083      */
00084     virtual bool bind(Scene* scene);
00085 
00086     /**
00087      * バインド解除
00088      */
00089     virtual void unbind();
00090 
00091     //--------------------------------------------------------------------------
00092     // シーケンス
00093     //--------------------------------------------------------------------------
00094     /**
00095      * シーケンス数の取得
00096      * @return シーケンス数
00097      */
00098     virtual int getSequenceCount() const;
00099 
00100     /**
00101      * シーケンスの設定
00102      * @param sequence 設定するシーケンス
00103      * @param time 設定する時間
00104      */
00105     virtual void setSequence(int sequence, float time = 0.f);
00106 
00107     /**
00108      * シーケンスの取得
00109      * @return シーケンス
00110      */
00111     virtual int getSequence() const;
00112 
00113     //--------------------------------------------------------------------------
00114     // 時間
00115     //--------------------------------------------------------------------------
00116     /**
00117      * 時間の設定
00118      * @param time 設定する時間
00119      */
00120     virtual void setTime(float time);
00121 
00122     /**
00123      * 時間の取得
00124      * @return 時間
00125      */
00126     virtual float getTime() const;
00127 
00128     //--------------------------------------------------------------------------
00129     // アニメーション
00130     //--------------------------------------------------------------------------
00131     /**
00132      * アニメーション
00133      * @param deltaTime デルタタイム
00134      * @param mask アニメーションマスク
00135      * @return アニメーションが終了していればtrue
00136      */
00137     virtual bool animate(float deltaTime, AnimationMask mask);
00138 
00139     /**
00140      * 長さの取得
00141      * @return 長さ
00142      */
00143     virtual float getLength() const;
00144 
00145     /**
00146      * 終了しているか
00147      * @return 終了していればtrue
00148      */
00149     virtual bool isFinished() const;
00150 
00151     /**
00152      * ループしているか
00153      * @return ループしていればtrue
00154      */
00155     virtual bool isLooped() const;
00156 
00157     //--------------------------------------------------------------------------
00158     // コピー
00159     //--------------------------------------------------------------------------
00160     /**
00161      * コピー
00162      * @param dataCopyMask データコピーマスク
00163      * @return コピーされたアニメーション
00164      */
00165     virtual Animation* copy(DataCopyMask dataCopyMask = copyNone) const{
00166         return copyAnimationSet(dataCopyMask);
00167     }
00168 
00169     /**
00170      * アニメーションセットのコピー
00171      * @param dataCopyMask データコピーマスク
00172      * @return コピーされたアニメーション
00173      */
00174     virtual AnimationSet* copyAnimationSet(
00175         DataCopyMask dataCopyMask = copyNone) const;
00176 
00177     //--------------------------------------------------------------------------
00178     // RTTI
00179     //--------------------------------------------------------------------------
00180     /**
00181      * アニメーションセットかどうか
00182      * @return アニメーションセットならtrue
00183      */
00184     virtual bool isAnimationSet() const{ return true; }
00185 
00186     //--------------------------------------------------------------------------
00187 protected:
00188     /**
00189      * コンストラクタ
00190      * @param name 名前
00191      * @param manager アニメーションマネージャ
00192      */
00193     AnimationSet(String name, AnimationManager* manager);
00194 
00195     /**
00196      * デストラクタ
00197      */
00198     virtual ~AnimationSet();
00199 
00200 private:
00201     // アニメーション配列
00202     ArrayList<Animation*> animations_;
00203 
00204 };
00205 
00206 //------------------------------------------------------------------------------
00207 } // End of namespace Lamp
00208 #endif // End of ANIMATION_SET_H_
00209 //------------------------------------------------------------------------------
00210 

Generated on Wed Mar 16 10:29:27 2005 for Lamp by doxygen 1.3.2