mirror of
https://github.com/QuasarApp/Snake.git
synced 2025-04-26 17:54:42 +00:00
21 lines
371 B
C++
21 lines
371 B
C++
#include "background.h"
|
|
|
|
BackGround::BackGround(double x, double y): ItemWorld (x, y) {
|
|
this->setSize(200, 400);
|
|
this->setTexture("qrc:/texture/asphalt");
|
|
setBeckGroundObject(true);
|
|
}
|
|
|
|
void BackGround::render() {
|
|
auto wPart = w() / 2;
|
|
|
|
if (m_x + wPart < 200) {
|
|
setX(wPart);
|
|
}
|
|
}
|
|
|
|
void BackGround::reset() {
|
|
setX(0 - w());
|
|
render();
|
|
}
|