1 | /*************************************************************************** |
2 | * KBlocks, a falling blocks game for KDE * |
3 | * Copyright (C) 2009 Mauricio Piacentini <mauricio@tabuleiro.com> * |
4 | * Zhongjie Cai <squall.leonhart.cai@gmail.com> * |
5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License as published by * |
8 | * the Free Software Foundation; either version 2 of the License, or * |
9 | * (at your option) any later version. * |
10 | ***************************************************************************/ |
11 | #ifndef KBLOCKSANIMATOR_H |
12 | #define KBLOCKSANIMATOR_H |
13 | |
14 | #include <QTimeLine> |
15 | |
16 | #include "KBlocksAnimFade.h" |
17 | #include "KBlocksAnimDrop.h" |
18 | |
19 | #include "KBlocksSvgItem.h" |
20 | |
21 | enum KBlocks_Animation_Type { |
22 | KBlocks_Animation_None = 0, |
23 | KBlocks_Animation_Fade_In, |
24 | KBlocks_Animation_Fade_Out, |
25 | KBlocks_Animation_Drop, |
26 | KBlocks_Animation_Max_Count |
27 | }; |
28 | |
29 | class KBlocksAnimator : public QObject |
30 | { |
31 | Q_OBJECT |
32 | |
33 | public: |
34 | KBlocksAnimator(); |
35 | ~KBlocksAnimator(); |
36 | |
37 | bool createFadeAnim(const QList<KBlocksSvgItem*> & items, int duration, QTimeLine::Direction direction); |
38 | bool deleteFadeAnim(); |
39 | KBlocksAnimFade* getFadeAnim(); |
40 | |
41 | bool createDropAnim(const QList<KBlocksSvgItem*> & items, int duration, QTimeLine::Direction direction); |
42 | bool deleteDropAnim(); |
43 | KBlocksAnimDrop* getDropAnim(); |
44 | |
45 | private slots: |
46 | void endFadeInAnim(); |
47 | void endFadeOutAnim(); |
48 | void endDropAnim(); |
49 | |
50 | signals: |
51 | void animFinished(int animType); |
52 | |
53 | protected: |
54 | KBlocksAnimFade* mpAnimFade; |
55 | KBlocksAnimDrop* mpAnimDrop; |
56 | }; |
57 | |
58 | #endif |
59 | |