From a8934f323fd7e48014addb55ff25ef0486aebbd1 Mon Sep 17 00:00:00 2001 From: Samu Laaksonen Date: Sat, 29 Sep 2012 22:21:14 +0300 Subject: 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" --- src/MenuScene.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/MenuScene.cpp') diff --git a/src/MenuScene.cpp b/src/MenuScene.cpp index 241f423..a7c2a75 100644 --- a/src/MenuScene.cpp +++ b/src/MenuScene.cpp @@ -4,6 +4,8 @@ #include "GraphicsButtonObject.h" #include "GameView.h" +#include "AnimatingUiElement.h" + #include "MenuScene.h" MenuScene::MenuScene(const QString &name, const QRectF &rect, GameView *parent) @@ -40,6 +42,30 @@ void MenuScene::initializeScene() { int yoff = 200; + AnimatingUiElement *btn1 = new AnimatingUiElement("Play"); + + btn1->setOffset(-btn1->boundingRect().width() / 2, + -btn1->boundingRect().height() / 2); + btn1->setPos(sceneRect().width() / 2, yoff); + addItem(btn1); + + AnimatingUiElement *btn2 = new AnimatingUiElement("Credits"); + btn2->setOffset(-btn2->boundingRect().width() / 2, + -btn2->boundingRect().height() / 2); + btn2->setPos(sceneRect().width() / 2, btn1->pos().y() + btn1->boundingRect().height() + 20); + addItem(btn2); + + AnimatingUiElement *btn3 = new AnimatingUiElement("Quit"); + btn3->setOffset(-btn3->boundingRect().width() / 2, + -btn3->boundingRect().height() / 2); + btn3->setPos(sceneRect().width() / 2, btn2->pos().y() + btn2->boundingRect().height() + 20); + addItem(btn3); + + connect(btn1, SIGNAL(clicked()), gameView(), SLOT(showLevelSelectionScene())); + connect(btn2, SIGNAL(clicked()), gameView(), SLOT(showCreditsScene())); + connect(btn3, SIGNAL(clicked()), qApp, SLOT(quit())); + + /* GraphicsButtonObject *btn1 = new GraphicsButtonObject("Play", 0, this); btn1->setPos(260, yoff); @@ -52,6 +78,7 @@ void MenuScene::initializeScene() connect(btn1, SIGNAL(clicked()), gameView(), SLOT(showLevelSelectionScene())); connect(btn2, SIGNAL(clicked()), gameView(), SLOT(showCreditsScene())); connect(btn3, SIGNAL(clicked()), qApp, SLOT(quit())); + */ addTitle("prism"); } -- cgit v1.2.3