1 /*
2     SPDX-FileCopyrightText: 2009 Mathias Kraus <k.hias@gmx.de>
3 
4     SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #ifndef BLOCKITEM_H
8 #define BLOCKITEM_H
9 
10 #include "elementitem.h"
11 
12 class Block;
13 class QTimer;
14 class KGameRenderer;
15 
16 /**
17  * @brief This class is the graphical representation of a Block.
18  */
19 class BlockItem : public ElementItem
20 {
21 
22     Q_OBJECT
23 
24 protected:
25 
26     /** Timer used to animate explosion */
27     QTimer* m_destructionTimer;
28 
29     /** Number of frames for the destruction */
30     int m_destructionCounter;
31 
32 public:
33 
34     /**
35      * Creates a new BlockItem instance.
36      * @param p_model the Block model
37      * @param renderer the KGameRenderer
38      */
39     BlockItem(Block* p_model, KGameRenderer* renderer);
40 
41     /**
42      * Deletes the BlockItem instance.
43      */
44     ~BlockItem() override;
45 
46 private Q_SLOTS:
47     /**
48      * Starts the destruction animation
49      */
50      void startDestructionAnimation();
51 
52      /**
53      * destruction animation
54      */
55      void destructionAnimation();
56 
57 Q_SIGNALS:
58      /**
59      * signals the end of the destruction animation
60      * @param blockItem this block item
61      */
62      void blockItemDestroyed(BlockItem* blockItem);
63 };
64 
65 #endif
66