Skip to content

Commit

Permalink
Add AnimatedSprite
Browse files Browse the repository at this point in the history
A simpler sprite image element for the simple usecase. Because sometimes
an engine with stochastic capabilities is overkill.

Change-Id: I2b76c5d417719e92a548f6266bffd563dc016983
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
  • Loading branch information
Alan Alpert authored and Qt by Nokia committed Feb 28, 2012
1 parent e380969 commit f7dae39
Show file tree
Hide file tree
Showing 11 changed files with 1,170 additions and 7 deletions.
Expand Up @@ -46,14 +46,29 @@ Item {
anchors.fill: parent
color: "white"
}
SpriteImage {
AnimatedSprite {
id: sprite
anchors.fill: parent
Sprite{
source: "content/speaker.png"
frames: 60
frameSync: true
frameWidth: 170
frameHeight: 170
source: "content/speaker.png"
frameCount: 60
frameSync: true
frameWidth: 170
frameHeight: 170
loops: 3
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
if (!sprite.running)
sprite.start();
if (!sprite.paused)
sprite.pause();
if ( mouse.button == Qt.LeftButton ) {
sprite.advance(1);
} else {
sprite.advance(-1);
}
}
}
}
2 changes: 2 additions & 0 deletions src/quick/items/items.pri
Expand Up @@ -66,6 +66,7 @@ HEADERS += \
$$PWD/qquickspriteengine_p.h \
$$PWD/qquicksprite_p.h \
$$PWD/qquickspriteimage_p.h \
$$PWD/qquickanimatedsprite_p.h \
$$PWD/qquickdrag_p.h \
$$PWD/qquickdroparea_p.h \
$$PWD/qquickmultipointtoucharea_p.h \
Expand Down Expand Up @@ -117,6 +118,7 @@ SOURCES += \
$$PWD/qquickspriteengine.cpp \
$$PWD/qquicksprite.cpp \
$$PWD/qquickspriteimage.cpp \
$$PWD/qquickanimatedsprite.cpp \
$$PWD/qquickaccessibleattached.cpp \
$$PWD/qquickdrag.cpp \
$$PWD/qquickdroparea.cpp \
Expand Down

0 comments on commit f7dae39

Please sign in to comment.