• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

kmahjongg

  • sources
  • kde-4.14
  • kdegames
  • kmahjongg
TileSprite.h
Go to the documentation of this file.
1 /*
2  Copyright 2006 Mauricio Piacentini <mauricio@tabuleiro.com>
3  begin : Oct 31 2006
4 
5  Kmahjongg is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef TILESPRITE_H
21 #define TILESPRITE_H
22 
23 #include "KmTypes.h"
24 
25 #define USE_UNSTABLE_LIBKDEGAMESPRIVATE_API
26 #include <libkdegamesprivate/kgamecanvas.h>
27 
28 #include <QPixmap>
29 #include <QObject>
30 
31 //This class wraps tile drawing, so it can blit the selected or unselected background, plus
32 //the tileface, positioned in the correct orientation.
33 
41 class TileSprite : public QObject, public KGameCanvasItem
42 {
43  Q_OBJECT
44 public:
45 
56  TileSprite ( KGameCanvasAbstract* canvas, QPixmap& backunselected, QPixmap& backselected, QPixmap& face, TileViewAngle angle, bool selected);
57 
60  ~TileSprite();
70  virtual void paintInternal(QPainter* p, const QRect& prect, const QRegion& preg,
71  const QPoint& delta, double cumulative_opacity);
74  virtual void paint(QPainter* p);
77  virtual QRect rect() const;
84  void setAngle(TileViewAngle angle, QPixmap& backunselected, QPixmap& backselected);
85 
88  inline void setScale (double scale){ m_scale=scale;}
91  inline double scale(){ return m_scale;}
94  inline void setSelected (bool enabled){ m_selected = enabled; changed();}
97  inline double selected(){ return m_selected;}
98 public slots:
101  void fadeOut();
104  void fadeIn();
105 
106 private:
107  void updateOffset();
108 
109  QPixmap m_backselected;
110  QPixmap m_backunselected;
111  QPixmap m_face;
112  double m_scale;
113  bool m_selected;
114  bool m_dying;
115  short m_woffset;
116  short m_hoffset;
117  TileViewAngle m_angle;
118  QPoint m_faceoffset;
119 };
120 
121 #endif // TILESPRITE_H
TileSprite::fadeOut
void fadeOut()
Slot Description.
Definition: TileSprite.cpp:93
KGameCanvasItem
TileSprite::setScale
void setScale(double scale)
Method Description.
Definition: TileSprite.h:88
KmTypes.h
QPoint
TileSprite::~TileSprite
~TileSprite()
Deafault destructor.
Definition: TileSprite.cpp:39
TileSprite::fadeIn
void fadeIn()
Slot Description.
Definition: TileSprite.cpp:105
TileSprite::setAngle
void setAngle(TileViewAngle angle, QPixmap &backunselected, QPixmap &backselected)
Method Description.
Definition: TileSprite.cpp:43
TileViewAngle
TileViewAngle
Tile angles for face composition.
Definition: KmTypes.h:57
QRect
TileSprite::TileSprite
TileSprite(KGameCanvasAbstract *canvas, QPixmap &backunselected, QPixmap &backselected, QPixmap &face, TileViewAngle angle, bool selected)
Constructor.
Definition: TileSprite.cpp:24
TileSprite::setSelected
void setSelected(bool enabled)
Method Description.
Definition: TileSprite.h:94
QObject
TileSprite::paintInternal
virtual void paintInternal(QPainter *p, const QRect &prect, const QRegion &preg, const QPoint &delta, double cumulative_opacity)
Method Description.
Definition: TileSprite.cpp:69
QPainter
QPixmap
TileSprite
This class wraps tile drawing, so it can blit the selected or unselected background, plus the tileface, positioned in the correct orientation.
Definition: TileSprite.h:41
TileSprite::selected
double selected()
Method Description.
Definition: TileSprite.h:97
TileSprite::paint
virtual void paint(QPainter *p)
Method Description.
Definition: TileSprite.cpp:83
TileSprite::rect
virtual QRect rect() const
Method Description.
Definition: TileSprite.cpp:116
TileSprite::scale
double scale()
Method Description.
Definition: TileSprite.h:91
QRegion
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:33 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kmahjongg

Skip menu "kmahjongg"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal