void popupWindow::setXOffset(int offset) { if(m_xOffset != offset) { m_yOffset = offset; updateSize(); emit xOffsetChanged(); } }
void GameLayers::setXOffset(const qreal &xOffset) { if (m_xOffset != xOffset) { m_xOffset = xOffset; emit xOffsetChanged(); } }
void ShadowEffect::setXOffset(qreal value) { if (qFuzzyCompare(m_xOffset, value)) { return; } m_xOffset = value; m_shadow = QImage(); updateBoundingRect(); xOffsetChanged(m_xOffset); }
void Viewport::setXOffset(float xOffset) { xOffset = xOffset > m_maxXOffset ? m_maxXOffset : xOffset; if (xOffset < 0.0f) xOffset = 0.0f; if (m_xOffset != xOffset) { m_xOffset = xOffset; if (m_scene) m_scene->setX(-m_xOffset); emit xOffsetChanged(); } }
GameLayers::GameLayers(GameScene *parent) : GameItem(parent) , m_tileWidth(32) , m_tileHeight(32) , m_totalColumns(0) , m_drawType(Quasi::TiledDrawType) , m_xOffset(0) , m_yOffset(0) { connect(this, SIGNAL(xOffsetChanged()), this, SLOT(changeXOffset())); connect(this, SIGNAL(yOffsetChanged()), this, SLOT(changeYOffset())); // control variables m_drawGrid = false; m_gridColor = Qt::red; }
void Viewport::setXOffset(float xOffset) { xOffset = qBound<float>(0.0f, xOffset, m_maxXOffset); // TODO create a heuristic function to calculate the animation duration // when m_animationDuration < 0, according to this delta // (bigger delta -> bigger animation duration) //qreal delta = qAbs(m_xOffset - xOffset); if (m_xOffset != xOffset) { m_xOffset = xOffset; if (m_scene) { m_xGroupAnimation->clear(); QPropertyAnimation *xAnim = new QPropertyAnimation(m_scene, "x"); xAnim->setDuration(m_animationDuration); // TODO set duration according the offset value xAnim->setEasingCurve(m_animationEasingCurve); xAnim->setStartValue(m_scene->x()); xAnim->setEndValue(-m_xOffset); m_xGroupAnimation->addAnimation(xAnim); /* TODO: Fix this according to current layer scheme QPropertyAnimation *xLayerAnimation = new QPropertyAnimation(m_scene->gameLayers(), "xOffset"); // TODO xLayerAnimation->setDuration(m_animationDuration); // TODO xLayerAnimation->setEasingCurve(m_animationEasingCurve); xLayerAnimation->setStartValue(m_scene->gameLayers()->xOffset()); xLayerAnimation->setEndValue(m_xOffset); m_xGroupAnimation->addAnimation(xLayerAnimation); */ m_xGroupAnimation->start(); } emit xOffsetChanged(); } }