File indexing completed on 2024-10-13 06:41:41
0001 /* 0002 SPDX-FileCopyrightText: 2009 Mathias Kraus <k.hias@gmx.de> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef BLOCKITEM_H 0008 #define BLOCKITEM_H 0009 0010 #include "elementitem.h" 0011 0012 class Block; 0013 class QTimer; 0014 class KGameRenderer; 0015 0016 /** 0017 * @brief This class is the graphical representation of a Block. 0018 */ 0019 class BlockItem : public ElementItem 0020 { 0021 0022 Q_OBJECT 0023 0024 protected: 0025 0026 /** Timer used to animate explosion */ 0027 QTimer* m_destructionTimer; 0028 0029 /** Number of frames for the destruction */ 0030 int m_destructionCounter; 0031 0032 public: 0033 0034 /** 0035 * Creates a new BlockItem instance. 0036 * @param p_model the Block model 0037 * @param renderer the KGameRenderer 0038 */ 0039 BlockItem(Block* p_model, KGameRenderer* renderer); 0040 0041 /** 0042 * Deletes the BlockItem instance. 0043 */ 0044 ~BlockItem() override; 0045 0046 private Q_SLOTS: 0047 /** 0048 * Starts the destruction animation 0049 */ 0050 void startDestructionAnimation(); 0051 0052 /** 0053 * destruction animation 0054 */ 0055 void destructionAnimation(); 0056 0057 Q_SIGNALS: 0058 /** 0059 * signals the end of the destruction animation 0060 * @param blockItem this block item 0061 */ 0062 void blockItemDestroyed(BlockItem* blockItem); 0063 }; 0064 0065 #endif