diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2012-01-18 11:15:56 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-27 06:17:53 +0100 |
commit | 335aa328622523c17b36e676cb1aa37283ce8fda (patch) | |
tree | c4507c50cd48f226fb0f365aff35ce32d3a777bd /src/quick/items/qquickspriteengine.cpp | |
parent | 15c00d747e24dae3b2681e6af07cfba3bdb6f74c (diff) |
Implement proper sprite sheet functionality
Uses frameX/frameY from the new Sprite API. You can now specify your
sprites as a single sprite sheet and just specify the offset for
individual animations.
Change-Id: I3a33d8329e6b9d65e5578669388e3115de992803
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/quick/items/qquickspriteengine.cpp')
-rw-r--r-- | src/quick/items/qquickspriteengine.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/quick/items/qquickspriteengine.cpp b/src/quick/items/qquickspriteengine.cpp index 470aa6d160..42904b2fb5 100644 --- a/src/quick/items/qquickspriteengine.cpp +++ b/src/quick/items/qquickspriteengine.cpp @@ -322,13 +322,14 @@ QImage QQuickSpriteEngine::assembledImage() if (img.height() == frameHeight && img.width() < maxSize){//Simple case p.drawImage(0,y,img); state->m_rowY = y; + state->m_rowStartX = state->m_frameX;//In case it was offset, but we took the simple route of not chopping out the other bits y += frameHeight; }else{//Chopping up image case state->m_framesPerRow = image.width()/frameWidth; state->m_rowY = y; int x = 0; - int curX = 0; - int curY = 0; + int curX = state->m_frameX; + int curY = state->m_frameY; int framesLeft = state->frames(); while (framesLeft > 0){ if (image.width() - x + curX <= img.width()){//finish a row in image (dest) |