granatier
elementitem.cpp
Go to the documentation of this file.
26 ElementItem::ElementItem(Element* p_model, KGameRenderer* renderer) : KGameRenderedItem(renderer, "")
79 QPoint viewBottomRight = scene()->views().first()->mapFromScene(m_itemSizeSet.width(), m_itemSizeSet.height());
84 //for better alignment, if the item size is different from the cell size, make the difference between the cell size and item size always even
85 if(m_itemSizeSet.width() != Granatier::CellSize || m_itemSizeSet.height() != Granatier::CellSize)
87 viewBottomRight = scene()->views().first()->mapFromScene(Granatier::CellSize, Granatier::CellSize);
void addEllipse(const QRectF &boundingRectangle)
int width() const
ElementItem(Element *p_model, KGameRenderer *renderer)
Creates a new ElementItem instance.
Definition: elementitem.cpp:26
virtual void update(qreal p_x, qreal p_y)
Updates the ElementItem coordinates.
Definition: elementitem.cpp:55
int x() const
int y() const
qreal x() const
qreal y() const
Element * m_model
The instance of Element the ElementItem will represent.
Definition: elementitem.h:40
virtual void updateGraphicsInternal(qreal svgScaleFactor)
Definition: elementitem.cpp:70
This class describes the common characteristics and behaviour of any game Element (character or item)...
Definition: element.h:32
QPainterPath shape() const
Reimplement QGraphicsItem::shape() to return an ellipse to improve collisions.
Definition: elementitem.cpp:48
int height() const
virtual void updateGraphics(qreal svgScaleFactor)
Updates the graphics after a resize.
Definition: elementitem.cpp:65
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
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
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.