aboutsummaryrefslogtreecommitdiff
path: root/src/AnimatingUiElement.h
diff options
context:
space:
mode:
authorSamu Laaksonen <laaksonen.sj@gmail.com>2012-09-29 22:21:14 +0300
committerSamu Laaksonen <laaksonen.sj@gmail.com>2012-09-29 22:21:14 +0300
commita8934f323fd7e48014addb55ff25ef0486aebbd1 (patch)
tree914cd44e012f498b0d1fc610659049085f8b7a11 /src/AnimatingUiElement.h
parent87618947d1de7cdd1ff9a8047acec3279ef253b4 (diff)
downloadprism-a8934f323fd7e48014addb55ff25ef0486aebbd1.tar.gz
prism-a8934f323fd7e48014addb55ff25ef0486aebbd1.zip
MenuScene changes
Changed MenuScene to use buttons based on new AnimatingUiElement - buttons now have scale animation allowing them to be a bit more "lively" Added hero_concept as png ":D"
Diffstat (limited to 'src/AnimatingUiElement.h')
-rw-r--r--src/AnimatingUiElement.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/AnimatingUiElement.h b/src/AnimatingUiElement.h
new file mode 100644
index 0000000..c02c7af
--- /dev/null
+++ b/src/AnimatingUiElement.h
@@ -0,0 +1,42 @@
+#ifndef AnimatingUiElement_h
+#define AnimatingUiElement_h
+
+#include <QObject>
+#include <QGraphicsPixmapItem>
+
+class QPropertyAnimation;
+
+class AnimatingUiElement : public QObject, public QGraphicsPixmapItem
+{
+ Q_OBJECT
+
+ Q_PROPERTY(qreal scale READ scale WRITE setScale)
+public:
+ AnimatingUiElement(const QString& text, QObject *parent = 0, QGraphicsItem* graphicsParent = 0);
+ virtual ~AnimatingUiElement();
+
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+
+ void initialize();
+
+signals:
+ void clicked();
+
+public slots:
+
+private slots:
+ void animationFinished();
+
+private:
+ QPropertyAnimation* m_animation;
+ QString m_text;
+ bool m_released;
+ int m_durationPressed;
+ int m_durationReleased;
+
+ static QPixmap *s_tmpGfx;
+ static int s_ref;
+};
+
+#endif // AnimatingUiElement_h