From: Heli Hyvättinen Date: Tue, 14 Jun 2011 08:23:07 +0000 (+0300) Subject: Now sets random seed X-Git-Tag: v0.1.0~12^2~1 X-Git-Url: http://vcs.maemo.org/git/?a=commitdiff_plain;h=67de57658293f2ee720579e510d5f9a67be3c1bf;p=ghostsoverboard Now sets random seed And moved setting the background to the constructor of SeaScene. --- diff --git a/mainwindow.cpp b/mainwindow.cpp index 1bbd123..6efb243 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -16,8 +16,7 @@ MainWindow::MainWindow(QWidget *parent) pScene_ = new SeaScene (); pView_ = new QGraphicsView (); - QPixmap waves (":/pix/meri.png"); - pScene_->setBackgroundBrush(QBrush(waves)); + pView_->setScene(pScene_); setCentralWidget(pView_); diff --git a/seascene.cpp b/seascene.cpp index b6ba59b..fa2735f 100644 --- a/seascene.cpp +++ b/seascene.cpp @@ -4,6 +4,7 @@ #include #include #include +#include const QString ghostImageFilename_ = ":/pix/aave.png"; const QString rockImageFilename_ =":/pix/kari.png"; @@ -13,7 +14,15 @@ const QString octopusImageFilename_= ":/pix/tursas.png"; SeaScene::SeaScene(QObject *parent) : QGraphicsScene(parent) { + //set background + QPixmap waves (":/pix/meri.png"); + waves.scaled(20,20); + setBackgroundBrush(QBrush(waves)); + + //set random seed + + qsrand(QTime::currentTime().msec()+2); //+2 to avoid setting it to 1 }