4
1
mirror of https://github.com/QuasarApp/Snake.git synced 2025-04-29 03:04:42 +00:00

21 lines
371 B
C++
Raw Normal View History

2018-11-28 22:17:30 +03:00
#include "background.h"
BackGround::BackGround(double x, double y): ItemWorld (x, y) {
2018-12-01 21:06:40 +03:00
this->setSize(200, 400);
this->setTexture("qrc:/texture/asphalt");
2018-11-28 22:17:30 +03:00
setBeckGroundObject(true);
}
void BackGround::render() {
2018-12-01 21:06:40 +03:00
auto wPart = w() / 2;
if (m_x + wPart < 200) {
setX(wPart);
2018-11-28 22:17:30 +03:00
}
}
void BackGround::reset() {
2018-12-01 21:06:40 +03:00
setX(0 - w());
render();
2018-11-28 22:17:30 +03:00
}