File indexing completed on 2023-10-01 08:02:04
0001 /* 0002 SPDX-FileCopyrightText: 2007-2008 Thomas Gallinari <tg8187@yahoo.fr> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "element.h" 0008 0009 Element::Element(qreal p_x, qreal p_y, Maze *p_maze) 0010 : m_xInit(p_x) 0011 , m_yInit(p_y) 0012 , m_maze(p_maze) 0013 { 0014 m_points = 0; 0015 initCoordinate(); 0016 } 0017 0018 Element::~Element() = default; 0019 0020 void Element::doActionOnCollision(Kapman *) 0021 { 0022 // Do nothing by default : will be redefined within the subclasses 0023 } 0024 0025 qreal Element::getX() const 0026 { 0027 return m_x; 0028 } 0029 0030 qreal Element::getY() const 0031 { 0032 return m_y; 0033 } 0034 0035 void Element::setX(qreal p_x) 0036 { 0037 m_x = p_x; 0038 Q_EMIT moved(m_x, m_y); 0039 } 0040 0041 void Element::setY(qreal p_y) 0042 { 0043 m_y = p_y; 0044 Q_EMIT moved(m_x, m_y); 0045 } 0046 0047 int Element::getPoints() const 0048 { 0049 return m_points; 0050 } 0051 0052 Element::Type Element::getType() const 0053 { 0054 return m_type; 0055 } 0056 0057 QString Element::getImageId() const 0058 { 0059 return m_imageId; 0060 } 0061 0062 void Element::setImageId(const QString &p_imageId) 0063 { 0064 m_imageId = p_imageId; 0065 } 0066 0067 void Element::initCoordinate() 0068 { 0069 setX(m_xInit); 0070 setY(m_yInit); 0071 } 0072 0073 #include "moc_element.cpp"