1 /* This file is part of KsirK.
2    Copyright (C) 2003-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 #ifndef KSIRKFLAGSPRITE_H
21 #define KSIRKFLAGSPRITE_H
22 
23 #include "animsprite.h"
24 #include "skinSpritesData.h"
25 
26 namespace Ksirk {
27 
28 class AnimSprite;
29 /**
30   * A FlagSprite is a sprite that represents a flag. It adds no new member but
31   * is defined for semantic reasons
32   * @author Gaël de Chalendar (aka Kleag)
33   */
34 class FlagSprite : public AnimSprite
35 {
36 public:
37   /**
38     * This simplified constructor allows to create a new @ref FlagSprite with
39     * default values for skin elements names
40     * @param svgid The id of the SVG element from which to load images, usually
41     * the flag's country id
42     * @param zoom The current zoom factor
43     * @param aBackGnd The background giving info about the world geometry and
44     * access to the underlying QGraphicsScene
45     */
FlagSprite(const QString & svgid,double zoom,BackGnd * aBackGnd)46   FlagSprite(const QString &svgid,
47                 double zoom,
48                 BackGnd* aBackGnd) :
49               AnimSprite(svgid,
50                   Sprites::SkinSpritesData::single().intData("flag-width"),
51                   Sprites::SkinSpritesData::single().intData("flag-height"),
52                   Sprites::SkinSpritesData::single().intData("flag-frames"),
53                   Sprites::SkinSpritesData::single().intData("flag-versions"),
54                   zoom, aBackGnd)
55   {
56     setAnimated();
57   }
58 
59   /**
60     * This constructor allows to create a new @ref FlagSprite whose images are
61     * taken from the given file name with the given number of frames and
62     * number of look directions
63     * @param svgid The id of the SVG element from which to load images
64     * @param aBackGnd The background giving info about the world geometry and
65     * access to the underlying QGraphicsScene
66     * @param nbFrames The number of different frames in this sprite animation,
67     * thus the number of columns in the sprite image
68     * @param nbDirs The number of different views on the sprite,
69     * thus the number of rows in the sprite image
70     * @param visibility Measures how much this sprite is visible. It gives its
71     * Z value on the graphics scene.
72     */
FlagSprite(const QString & svgid,unsigned int width,unsigned int height,unsigned int nbFrames,unsigned int nbDirs,double zoom,BackGnd * aBackGnd)73   FlagSprite(const QString &svgid,
74               unsigned int width,
75               unsigned int height,
76               unsigned int nbFrames,
77               unsigned int nbDirs,
78               double zoom,
79               BackGnd* aBackGnd) :
80               AnimSprite(svgid, width, height, nbFrames, nbDirs, zoom, aBackGnd)
81   {
82     setAnimated();
83   }
84 
85   /** The default destructor */
~FlagSprite()86   ~FlagSprite() override {}
87 };
88 
89 }
90 
91 #endif
92