#include <arenaelement.h>
Signals | |
void | modified (ArenaElement *element) |
void | posChanged (ArenaElement *element, QPoint pos) |
void | rotationChanged (ArenaElement *element, int rotation) |
Public Member Functions | |
bool | isFloor () const |
Convenience method returning true iff. this is a floor element. More... | |
bool | isItem () const |
Convenience method returning true iff. this is an item element (freely movable) More... | |
bool | isMountableItem () const |
Convenience method returning true iff. this is a mountable-item element. More... | |
bool | isWall () const |
Convenience method returning true iff. this is a wall element. More... | |
int | itemMountPoint () const |
QPointF | itemOffset () const |
Returns the item's offset from the grid point with 0 <= x,y <= 1 ( (0,0) is bottom left) More... | |
void | load (const QDomElement &node) |
Deserializes this element from XML. More... | |
QPoint | pos () const |
Returns the position in arena coordinates. More... | |
int | rotation () const |
Returns the rotation in degrees. More... | |
void | save (QXmlStreamWriter &writer) |
Serializes this element in XML. More... | |
void | saveWorld (QXmlStreamWriter &writer) |
Writes .world format-compliant XML. More... | |
void | saveWorldSdf (QXmlStreamWriter &writer) |
void | setArena (Arena *arena) |
Called from Arena::addElement() More... | |
void | setItemMountPoint (int mountPoint) |
See itemMountPoint(). Use -1 to set index to "unspecified". More... | |
void | setItemOffset (const QPointF &offset) |
See itemOffset() More... | |
void | setPos (QPoint pos) |
Sets the position in arena coordinates. More... | |
void | setRotation (int rotation) |
Sets the rotation in degrees. More... | |
ArenaElementType const * | type () const |
Private Member Functions | |
ArenaElement (const ArenaElementType *const type, int id) | |
Only meant for use by ArenaElementType::createInstance() More... | |
Private Attributes | |
Arena * | m_arena |
Arena this element currently belongs to (exactly one) More... | |
const int | m_instanceId |
Unique ID set by ArenaElementType. More... | |
int | m_itemMountPoint |
QPointF | m_itemOffset |
See itemOffset() More... | |
QPoint | m_pos |
int | m_rotation |
rotation in degrees (only multiples of 90 degrees) More... | |
const ArenaElementType *const | m_type |
Friends | |
class | ArenaElementType |
Definition at line 14 of file arenaelement.h.
|
explicitprivate |
Only meant for use by ArenaElementType::createInstance()
Definition at line 11 of file arenaelement.cpp.
bool ArenaElement::isFloor | ( | ) | const |
Convenience method returning true iff. this is a floor element.
Definition at line 24 of file arenaelement.cpp.
bool ArenaElement::isItem | ( | ) | const |
Convenience method returning true iff. this is an item element (freely movable)
Definition at line 34 of file arenaelement.cpp.
bool ArenaElement::isMountableItem | ( | ) | const |
Convenience method returning true iff. this is a mountable-item element.
Definition at line 29 of file arenaelement.cpp.
bool ArenaElement::isWall | ( | ) | const |
Convenience method returning true iff. this is a wall element.
Definition at line 19 of file arenaelement.cpp.
|
inline |
For MountableItemType elements, this returns the index of the item mount point the item is attached to. If no such index was specified and for all other elements, this method returns -1.
Definition at line 62 of file arenaelement.h.
|
inline |
Returns the item's offset from the grid point with 0 <= x,y <= 1 ( (0,0) is bottom left)
Definition at line 55 of file arenaelement.h.
void ArenaElement::load | ( | const QDomElement & | node | ) |
Deserializes this element from XML.
Definition at line 74 of file arenaelement.cpp.
|
signal |
Signal emitted when any property of this element changed
rotation | Rotation in degrees. |
|
inline |
Returns the position in arena coordinates.
Definition at line 22 of file arenaelement.h.
|
signal |
Signal emitted when the element is moved
pos | New position. |
|
inline |
Returns the rotation in degrees.
Definition at line 26 of file arenaelement.h.
|
signal |
Signal emitted when the element is rotated.
rotation | Rotation in degrees. |
void ArenaElement::save | ( | QXmlStreamWriter & | writer | ) |
Serializes this element in XML.
Definition at line 108 of file arenaelement.cpp.
void ArenaElement::saveWorld | ( | QXmlStreamWriter & | writer | ) |
void ArenaElement::saveWorldSdf | ( | QXmlStreamWriter & | writer | ) |
Definition at line 208 of file arenaelement.cpp.
|
inline |
Called from Arena::addElement()
Definition at line 39 of file arenaelement.h.
void ArenaElement::setItemMountPoint | ( | int | mountPoint | ) |
See itemMountPoint(). Use -1 to set index to "unspecified".
Definition at line 68 of file arenaelement.cpp.
void ArenaElement::setItemOffset | ( | const QPointF & | offset | ) |
See itemOffset()
Definition at line 49 of file arenaelement.cpp.
void ArenaElement::setPos | ( | QPoint | pos | ) |
Sets the position in arena coordinates.
Definition at line 39 of file arenaelement.cpp.
void ArenaElement::setRotation | ( | int | rotation | ) |
Sets the rotation in degrees.
Definition at line 55 of file arenaelement.cpp.
|
inline |
Returns a pointer to a global ArenaElementType instance that is the same for all objects of the same type
Definition at line 43 of file arenaelement.h.
|
friend |
Definition at line 18 of file arenaelement.h.
|
private |
Arena this element currently belongs to (exactly one)
Definition at line 83 of file arenaelement.h.
|
private |
Unique ID set by ArenaElementType.
Definition at line 95 of file arenaelement.h.
|
private |
Item mount point this element is attached to. Only applies to MountableItemType elements. -1 indicates that no index has been specified.
Definition at line 93 of file arenaelement.h.
|
private |
See itemOffset()
Definition at line 88 of file arenaelement.h.
|
private |
Definition at line 86 of file arenaelement.h.
|
private |
rotation in degrees (only multiples of 90 degrees)
Definition at line 90 of file arenaelement.h.
|
private |
Definition at line 85 of file arenaelement.h.