File indexing completed on 2025-03-16 03:51:21
0001 /* This file is part of KsirK. 0002 Copyright (C) 2007 Gael de Chalendar <kleag@free.fr> 0003 0004 KsirK is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU General Public 0006 License as published by the Free Software Foundation, either version 2 0007 of the License, or (at your option) any later version. 0008 0009 This program is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 General Public License for more details. 0013 0014 * You should have received a copy of the GNU General Public License 0015 * along with this program; if not, write to the Free Software 0016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 0017 * 02110-1301, USA 0018 */ 0019 0020 /* begin : Thu Feb 22 2007 */ 0021 0022 0023 #ifndef ANIMSPRITESPOOL_H 0024 #define ANIMSPRITESPOOL_H 0025 0026 #include "KsirkGlobalDefinitions.h" 0027 0028 #include <QTimer> 0029 0030 namespace Ksirk 0031 { 0032 0033 class AnimSprite; 0034 0035 class AnimSpritePool : public QObject 0036 { 0037 Q_OBJECT 0038 public: 0039 void addSprite(AnimSprite* sprite); 0040 void removeSprite(AnimSprite* sprite); 0041 0042 /** static method to retrive the singleton as const */ 0043 static const AnimSpritePool& single(); 0044 0045 /** static method to retrive the singleton as variable */ 0046 static AnimSpritePool& changeable(); 0047 0048 private slots: 0049 void update(); 0050 0051 private: 0052 AnimSpritePool(); 0053 ~AnimSpritePool() override {} 0054 0055 static AnimSpritePool* m_pool; 0056 /** All sprites are regularly updated */ 0057 QTimer m_timer; 0058 QList<AnimSprite*> m_sprites; 0059 }; 0060 0061 0062 } // closing namespace Ksirk 0063 0064 #endif // ANIMSPRITESPOOL_H