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

granatier

  • sources
  • kde-4.14
  • kdegames
  • granatier
  • src
elementitem.h
Go to the documentation of this file.
1 /*
2  * Copyright 2009 Mathias Kraus <k.hias@gmx.de>
3  * Copyright 2007-2008 Thomas Gallinari <tg8187@yahoo.fr>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of
8  * the License, or (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, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef ELEMENTITEM_H
20 #define ELEMENTITEM_H
21 
22 #include <KGameRenderedItem>
23 
24 class Element;
25 class KGameRenderer;
26 
30 class ElementItem : public QObject, public KGameRenderedItem
31 {
32 
33 Q_OBJECT
34 
35 private:
36 
37 protected:
38 
40  Element* m_model;
41 
42  QSize m_renderSize;
43 
44  QSize m_itemSizeSet;
45  QSize m_itemSizeReal;
46 
47 public:
48 
54  ElementItem(Element* p_model, KGameRenderer* renderer);
55 
59  ~ElementItem();
60 
65  Element* getModel() const;
66 
70  QPainterPath shape() const;
71 
72 public slots:
73 
79  virtual void update(qreal p_x, qreal p_y);
80 
85  virtual void updateGraphics(qreal svgScaleFactor);
86 
87 protected:
88  virtual void updateGraphicsInternal(qreal svgScaleFactor);
89 };
90 
91 #endif
92 
ElementItem::ElementItem
ElementItem(Element *p_model, KGameRenderer *renderer)
Creates a new ElementItem instance.
Definition: elementitem.cpp:26
ElementItem::update
virtual void update(qreal p_x, qreal p_y)
Updates the ElementItem coordinates.
Definition: elementitem.cpp:55
ElementItem::~ElementItem
~ElementItem()
Deletes the ElementItem instance.
Definition: elementitem.cpp:39
ElementItem::getModel
Element * getModel() const
Gets the Element model.
Definition: elementitem.cpp:43
ElementItem::m_itemSizeSet
QSize m_itemSizeSet
Definition: elementitem.h:44
ElementItem::m_model
Element * m_model
The instance of Element the ElementItem will represent.
Definition: elementitem.h:40
QObject
ElementItem::updateGraphicsInternal
virtual void updateGraphicsInternal(qreal svgScaleFactor)
Definition: elementitem.cpp:70
ElementItem
This class is the graphical representation of a game Element.
Definition: elementitem.h:30
Element
This class describes the common characteristics and behaviour of any game Element (character or item)...
Definition: element.h:32
QSize
QPainterPath
ElementItem::shape
QPainterPath shape() const
Reimplement QGraphicsItem::shape() to return an ellipse to improve collisions.
Definition: elementitem.cpp:48
KGameRenderedItem
ElementItem::m_renderSize
QSize m_renderSize
Definition: elementitem.h:42
ElementItem::updateGraphics
virtual void updateGraphics(qreal svgScaleFactor)
Updates the graphics after a resize.
Definition: elementitem.cpp:65
ElementItem::m_itemSizeReal
QSize m_itemSizeReal
Definition: elementitem.h:45
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

granatier

Skip menu "granatier"
  • Main Page
  • Namespace List
  • Namespace Members
  • 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