File indexing completed on 2024-04-28 07:54:13

0001 /***************************************************************************
0002                           armysprite.h  -  
0003                           A sprite representing armies
0004                              -------------------
0005     begin                : 
0006     copyright            : (C) 2003-2007 by Gael de Chalendar
0007     email                : kleag@free.fr
0008  ***************************************************************************/
0009 
0010 /***************************************************************************
0011  *                                                                         *
0012  *   This program is free software; you can redistribute it and/or modify  *
0013  *   it under the terms of the GNU General Public License as published by  *
0014  *   the Free Software Foundation; either either version 2
0015    of the License, or (at your option) any later version.of the License, or     *
0016  *   (at your option) any later version.                                   *
0017  *                                                                         *
0018  *   You should have received a copy of the GNU General Public License
0019  *   along with this program; if not, write to the Free Software
0020  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0021  *   02110-1301, USA
0022  ***************************************************************************/
0023  
0024 #ifndef KSIRKARMYSPRITE_H
0025 #define KSIRKARMYSPRITE_H
0026 
0027 #include "animsprite.h"
0028 
0029 namespace Ksirk {
0030 
0031 /**
0032   * An ArmySprite is a sprite that represents a certain number of armies
0033   * @author Gaƫl de Chalendar (aka Kleag)
0034   */
0035 class ArmySprite : public AnimSprite
0036 {
0037 public:
0038   /**
0039     * This constructor allows to create a new @ref ArmySprite whose images are
0040     * taken from the given file name with the given number of frames and
0041     * number of look directions
0042     * @param svgid The id of the SVG element from which to load images
0043     * @param aBackGnd The background giving info about the world geometry and
0044     * access to the underlying QGraphicsScene
0045     * @param nbFrames The number of different frames in this sprite animation, 
0046     * thus the number of columns in the sprite image
0047     * @param nbDirs The number of different views on the sprite, 
0048     * thus the number of rows in the sprite image
0049     * @param visibility Measures how much this sprite is visible. It gives its
0050     * Z value on the graphics scene.
0051     */
0052   ArmySprite(const QString &svgid,
0053               unsigned int width,
0054               unsigned int height,
0055               unsigned int nbFrames,
0056               unsigned int nbDirs, double zoom,
0057               BackGnd* aBackGnd,
0058               unsigned int visibility = 200) :
0059               AnimSprite(svgid, width, height, nbFrames, nbDirs, zoom, aBackGnd, visibility)
0060   {
0061     setStatic();
0062   }
0063 
0064   /** The default destructor */
0065   ~ArmySprite() override {};
0066 
0067   /**
0068     * Gets the number of armies represented by this sprite. Concrete subclasses
0069     * should implement this abstract method.
0070     */
0071   virtual unsigned int nbArmies() const = 0 ;
0072 };
0073 
0074 }
0075 
0076 #endif