1 /* This file is part of KsirK.
2    Copyright (C) 2007 Gael de Chalendar <kleag@free.fr>
3 
4    KsirK is free software; you can redistribute it and/or
5    modify it under the terms of the GNU General Public
6    License as published by the Free Software Foundation, either version 2
7    of the License, or (at your option) any later version.
8 
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    General Public License for more details.
13 
14 *   You should have received a copy of the GNU General Public License
15 *   along with this program; if not, write to the Free Software
16 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 *   02110-1301, USA
18 */
19 
20 /*  begin                : Thu Feb 22 2007  */
21 
22 
23 #ifndef ANIMSPRITESPOOL_H
24 #define ANIMSPRITESPOOL_H
25 
26 #include "KsirkGlobalDefinitions.h"
27 
28 #include <QTimer>
29 
30 namespace Ksirk
31 {
32 
33 class AnimSprite;
34 
35 class AnimSpritePool : public QObject
36 {
37   Q_OBJECT
38 public:
39   void addSprite(AnimSprite* sprite);
40   void removeSprite(AnimSprite* sprite);
41 
42   /** static method to retrive the singleton as const */
43   static const AnimSpritePool& single();
44 
45   /** static method to retrive the singleton as variable */
46   static AnimSpritePool& changeable();
47 
48 private slots:
49   void update();
50 
51 private:
52   AnimSpritePool();
~AnimSpritePool()53   ~AnimSpritePool() override {}
54 
55   static AnimSpritePool* m_pool;
56   /** All sprites are regularly updated */
57   QTimer m_timer;
58   QList<AnimSprite*> m_sprites;
59 };
60 
61 
62 } // closing namespace Ksirk
63 
64 #endif // ANIMSPRITESPOOL_H
65