Snake/back-end/guiobject.cpp

69 lines
1.0 KiB
C++
Raw Normal View History

#include "guiobject.h"
GuiObject::GuiObject(QObject *ptr):
2018-10-11 00:04:52 +03:00
QObject (ptr) {
generateId();
2018-10-11 00:04:52 +03:00
}
2018-10-11 18:09:35 +03:00
double GuiObject::angle() const {
return m_angle;
}
2018-10-08 21:10:07 +03:00
2018-10-11 18:09:35 +03:00
QString GuiObject::texture() const {
return m_texture;
2018-10-08 21:10:07 +03:00
}
2018-10-11 18:09:35 +03:00
void GuiObject::render() {
2018-10-08 21:10:07 +03:00
}
2018-10-11 18:09:35 +03:00
QRectF GuiObject::rect() const {
return m_rect;
2018-10-08 21:10:07 +03:00
}
2018-10-11 18:09:35 +03:00
QRectF& GuiObject::getRect() {
return m_rect;
2018-10-08 21:10:07 +03:00
}
2018-10-11 18:09:35 +03:00
void GuiObject::setAngle(double angle) {
m_angle = angle;
emit angleChanged(m_angle);
2018-10-08 21:10:07 +03:00
}
2018-10-11 18:09:35 +03:00
int GuiObject::guiId() const {
return m_guiId;
2018-10-11 00:04:52 +03:00
}
2018-11-14 23:15:36 +03:00
QString GuiObject::color() const {
return m_color;
}
void GuiObject::setColor(QString color) {
if (m_color == color)
return;
m_color = color;
emit colorChanged(m_color);
}
void GuiObject::setRect(QRectF rect) {
if (m_rect == rect)
return;
m_rect = rect;
emit rectChanged(m_rect);
}
2018-10-11 18:09:35 +03:00
void GuiObject::generateId() {
static int id = 0;
m_guiId = id++;
2018-10-11 00:04:52 +03:00
}
2018-10-08 21:10:07 +03:00
void GuiObject::setTexture(const QString &texture) {
2018-10-11 18:09:35 +03:00
m_texture = texture;
emit textureChanged(m_texture);
2018-10-08 21:10:07 +03:00
}