File indexing completed on 2024-04-21 04:04:45

0001 /***************************************************************************
0002                           backgnd.h  -  description
0003                              -------------------
0004     begin                : Wed Jul 18 2001
0005     copyright            : (C) 2001-2006 by Gael de Chalendar (aka Kleag)
0006     email                : kleag@free.fr
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either either version 2
0014    of the License, or (at your option) any later version.of the License, or     *
0015  *   (at your option) any later version.                                   *
0016  *                                                                         *
0017  *   You should have received a copy of the GNU General Public License
0018  *   along with this program; if not, write to the Free Software
0019  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0020  *   02110-1301, USA
0021  ***************************************************************************/
0022 
0023 #ifndef BACKGND_H
0024 #define BACKGND_H
0025 
0026 #include "decoratedgameframe.h"
0027 #include <QGraphicsItem>
0028 #include <QGraphicsScene>
0029 #include <KConfig>
0030 #include <KConfigGroup>
0031 
0032 namespace Ksirk
0033 {
0034 namespace GameLogic
0035 {
0036   class ONU;
0037 }
0038 
0039 /**
0040  * BackGnd is the sprite used to display the background map image
0041  */
0042 class BackGnd : public QGraphicsPixmapItem
0043 {
0044 public:
0045   /**
0046     * Constructor.
0047     * @param scene The canvas where all the sprites are set up.
0048     * @param theWorld The world represented by this background 
0049     */
0050   BackGnd(QGraphicsScene *scene, const GameLogic::ONU* theWorld, bool arena = false);
0051 
0052   /**
0053     * Default destructor
0054     */
0055   ~BackGnd() override;
0056 
0057   inline const GameLogic::ONU* onu() const {return m_theWorld;}
0058 
0059   inline bool bgIsArena() const {return m_bgIsArena;}
0060   
0061 protected:
0062   /**
0063     * Reimplemented of the inherited one to let the event be transmitted to the 
0064     * parent widget.
0065     * @param unused
0066     * @return false: the event is not handled here.
0067     */
0068   bool sceneEvent ( QEvent * ) override {return false;}
0069 
0070 private:
0071   const GameLogic::ONU* m_theWorld;
0072   bool m_bgIsArena;
0073 };
0074 }
0075 #endif //  BACKGND_H
0076