Snake/back-end/guiobject.cpp

95 lines
1.3 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 {
2018-11-25 03:24:41 +03:00
return QRectF(m_x, m_y, m_w, m_h);
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);
}
2018-11-25 03:24:41 +03:00
double GuiObject::x() const {
return m_x;
}
2018-11-25 03:24:41 +03:00
double GuiObject::y() const {
return m_y;
}
double GuiObject::w() const {
return m_w;
}
double GuiObject::h() const {
return m_h;
}
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-11-25 03:24:41 +03:00
void GuiObject::setH(double h) {
m_h = h;
emit hChanged(m_h);
}
void GuiObject::setW(double w) {
m_w = w;
emit wChanged(m_w);
}
void GuiObject::setY(double y) {
m_y = y;
emit yChanged(m_y);
}
void GuiObject::setX(double x) {
m_x = x;
emit xChanged(m_x);
}
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
}