1 /*************************************************************************** 2 armysprite.h - 3 A sprite representing armies 4 ------------------- 5 begin : 6 copyright : (C) 2003-2007 by Gael de Chalendar 7 email : kleag@free.fr 8 ***************************************************************************/ 9 10 /*************************************************************************** 11 * * 12 * This program is free software; you can redistribute it and/or modify * 13 * it under the terms of the GNU General Public License as published by * 14 * the Free Software Foundation; either either version 2 15 of the License, or (at your option) any later version.of the License, or * 16 * (at your option) any later version. * 17 * * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 21 * 02110-1301, USA 22 ***************************************************************************/ 23 24 #ifndef KSIRKARMYSPRITE_H 25 #define KSIRKARMYSPRITE_H 26 27 #include "animsprite.h" 28 29 namespace Ksirk { 30 31 /** 32 * An ArmySprite is a sprite that represents a certain number of armies 33 * @author Gaël de Chalendar (aka Kleag) 34 */ 35 class ArmySprite : public AnimSprite 36 { 37 public: 38 /** 39 * This constructor allows to create a new @ref ArmySprite whose images are 40 * taken from the given file name with the given number of frames and 41 * number of look directions 42 * @param svgid The id of the SVG element from which to load images 43 * @param aBackGnd The background giving info about the world geometry and 44 * access to the underlying QGraphicsScene 45 * @param nbFrames The number of different frames in this sprite animation, 46 * thus the number of columns in the sprite image 47 * @param nbDirs The number of different views on the sprite, 48 * thus the number of rows in the sprite image 49 * @param visibility Measures how much this sprite is visible. It gives its 50 * Z value on the graphics scene. 51 */ 52 ArmySprite(const QString &svgid, 53 unsigned int width, 54 unsigned int height, 55 unsigned int nbFrames, 56 unsigned int nbDirs, double zoom, 57 BackGnd* aBackGnd, 58 unsigned int visibility = 200) : AnimSprite(svgid,width,height,nbFrames,nbDirs,zoom,aBackGnd,visibility)59 AnimSprite(svgid, width, height, nbFrames, nbDirs, zoom, aBackGnd, visibility) 60 { 61 setStatic(); 62 } 63 64 /** The default destructor */ ~ArmySprite()65 ~ArmySprite() override {}; 66 67 /** 68 * Gets the number of armies represented by this sprite. Concrete subclasses 69 * should implement this abstract method. 70 */ 71 virtual unsigned int nbArmies() const = 0 ; 72 }; 73 74 } 75 76 #endif 77