File indexing completed on 2025-03-16 03:51:21
0001 /* This file is part of KsirK. 0002 Copyright (C) 2003-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 #ifndef KSIRKFLAGSPRITE_H 0021 #define KSIRKFLAGSPRITE_H 0022 0023 #include "animsprite.h" 0024 #include "skinSpritesData.h" 0025 0026 namespace Ksirk { 0027 0028 class AnimSprite; 0029 /** 0030 * A FlagSprite is a sprite that represents a flag. It adds no new member but 0031 * is defined for semantic reasons 0032 * @author Gaƫl de Chalendar (aka Kleag) 0033 */ 0034 class FlagSprite : public AnimSprite 0035 { 0036 public: 0037 /** 0038 * This simplified constructor allows to create a new @ref FlagSprite with 0039 * default values for skin elements names 0040 * @param svgid The id of the SVG element from which to load images, usually 0041 * the flag's country id 0042 * @param zoom The current zoom factor 0043 * @param aBackGnd The background giving info about the world geometry and 0044 * access to the underlying QGraphicsScene 0045 */ 0046 FlagSprite(const QString &svgid, 0047 double zoom, 0048 BackGnd* aBackGnd) : 0049 AnimSprite(svgid, 0050 Sprites::SkinSpritesData::single().intData("flag-width"), 0051 Sprites::SkinSpritesData::single().intData("flag-height"), 0052 Sprites::SkinSpritesData::single().intData("flag-frames"), 0053 Sprites::SkinSpritesData::single().intData("flag-versions"), 0054 zoom, aBackGnd) 0055 { 0056 setAnimated(); 0057 } 0058 0059 /** 0060 * This constructor allows to create a new @ref FlagSprite whose images are 0061 * taken from the given file name with the given number of frames and 0062 * number of look directions 0063 * @param svgid The id of the SVG element from which to load images 0064 * @param aBackGnd The background giving info about the world geometry and 0065 * access to the underlying QGraphicsScene 0066 * @param nbFrames The number of different frames in this sprite animation, 0067 * thus the number of columns in the sprite image 0068 * @param nbDirs The number of different views on the sprite, 0069 * thus the number of rows in the sprite image 0070 * @param visibility Measures how much this sprite is visible. It gives its 0071 * Z value on the graphics scene. 0072 */ 0073 FlagSprite(const QString &svgid, 0074 unsigned int width, 0075 unsigned int height, 0076 unsigned int nbFrames, 0077 unsigned int nbDirs, 0078 double zoom, 0079 BackGnd* aBackGnd) : 0080 AnimSprite(svgid, width, height, nbFrames, nbDirs, zoom, aBackGnd) 0081 { 0082 setAnimated(); 0083 } 0084 0085 /** The default destructor */ 0086 ~FlagSprite() override {} 0087 }; 0088 0089 } 0090 0091 #endif