File indexing completed on 2024-04-21 04:03:16

0001 /*
0002     SPDX-FileCopyrightText: 2007 Paolo Capriotti <p.capriotti@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef KBSRENDERER_H
0008 #define KBSRENDERER_H
0009 
0010 #include <KGameRenderer>
0011 
0012 class Coord;
0013 
0014 /**
0015   * Class to render KBattleShip graphical elements.
0016   */
0017 class KBSRenderer : public KGameRenderer
0018 {
0019 public:
0020     /**
0021       * Create a new renderer instance. Each instance has a different cache.
0022       */
0023     KBSRenderer();
0024 
0025     ~KBSRenderer() override;
0026 
0027     /**
0028       * Set a new size for the elements.
0029       */
0030     void resize(int sz);
0031     void resize(const QSize& sz);
0032 
0033     /**
0034       * Return current pixmap size.
0035       */
0036     QSize size() const;
0037    
0038     Coord toLogical(const QPointF& p) const;
0039     QPointF toReal(const Coord& p) const;
0040 
0041 private:
0042     QSize m_size;
0043 };
0044 
0045 #endif // KBSRENDERER_H