From 685fe05def77b039221edf06c74af74915d536c5 Mon Sep 17 00:00:00 2001 From: Samu Laaksonen Date: Tue, 25 Sep 2012 20:00:41 +0300 Subject: Initial code commit Added some stuff for project base - tiled sources - few Qt based classes for gfx --- src/ParallaxScrollerStatic.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/ParallaxScrollerStatic.cpp (limited to 'src/ParallaxScrollerStatic.cpp') diff --git a/src/ParallaxScrollerStatic.cpp b/src/ParallaxScrollerStatic.cpp new file mode 100644 index 0000000..c2642e9 --- /dev/null +++ b/src/ParallaxScrollerStatic.cpp @@ -0,0 +1,29 @@ +#include "ParallaxScrollerItem.h" + +#include "ParallaxScrollerStatic.h" + +ParallaxScrollerStatic::ParallaxScrollerStatic(QGraphicsScene *scene) +{ + m_parent = scene; +} + +ParallaxScrollerStatic::~ParallaxScrollerStatic() +{ + +} + +void ParallaxScrollerStatic::setLayerWidth(int width) +{ + m_layerWidth = width; +} + +void ParallaxScrollerStatic::addParallaxScrollItem(const QString &layer, QPointF pos, qreal depth, qreal slowingFactor) +{ + ParallaxScrollerItem* firstPartOfLayer = new ParallaxScrollerItem(layer, QPointF(pos.x(), pos.y()), + depth, 1, slowingFactor, m_parent); + ParallaxScrollerItem* secondPartOfLayer = new ParallaxScrollerItem(layer, QPointF(pos.x()+m_layerWidth, 0), + depth, 1, slowingFactor, m_parent); + + m_layersFirstWave.append(firstPartOfLayer); + m_layerSecondWave.append(secondPartOfLayer); +} -- cgit v1.2.3