Diffstat (limited to 'noncore/games/snake/interface.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/games/snake/interface.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/noncore/games/snake/interface.cpp b/noncore/games/snake/interface.cpp index c9b4931..c824543 100644 --- a/noncore/games/snake/interface.cpp +++ b/noncore/games/snake/interface.cpp @@ -60,13 +60,13 @@ SnakeGame::SnakeGame(QWidget* parent, const char* name, WFlags f) : toolbar->setStretchableWidget( scorelabel ); setFocusPolicy(StrongFocus); setCentralWidget(cv); - welcomescreen(); + QTimer::singleShot( 16, this, SLOT(welcomescreen()) ); gamestopped = true; waitover = true; } SnakeGame::~SnakeGame() { @@ -85,13 +85,13 @@ void SnakeGame::welcomescreen() QCanvasText* title = new QCanvasText(tr("SNAKE!"), &canvas); title->setColor(yellow); title->setFont( QFont("times", 18, QFont::Bold) ); int w = title->boundingRect().width(); title->move(canvas.width()/2 -w/2, canvas.height()/2-110); title->show(); - QCanvasPixmapArray* titlearray = new QCanvasPixmapArray(Resource::findPixmap("title")); + QCanvasPixmapArray* titlearray = new QCanvasPixmapArray(Resource::findPixmap("snake/title")); QCanvasSprite* titlepic = new QCanvasSprite(titlearray, &canvas); titlepic->move(canvas.width()/2 - 33, canvas.height()/2-85); titlepic->show(); QCanvasText* instr = new QCanvasText(tr("Use the arrow keys to guide the\n" "snake to eat the mouse. You must not\n" "crash into the walls, edges or its tail."), @@ -99,13 +99,13 @@ void SnakeGame::welcomescreen() w = instr->boundingRect().width(); instr->move(canvas.width()/2-w/2, canvas.height()/2-20); instr->setColor(white); instr->show(); QCanvasText* cont = new QCanvasText(tr("Press Any Key To Start"), &canvas); w = cont->boundingRect().width(); - cont->move(canvas.width()/2-w/2, canvas.height()/2+80); + cont->move(canvas.width()/2-w/2, canvas.height()-20); cont->setColor(yellow); cont->show(); } void SnakeGame::newGame() @@ -121,18 +121,15 @@ void SnakeGame::newGame() notargets = 1; level = 1; stage = 1; showScore(0); gamestopped = false; waitover = true; - int x = canvas.width()/2 - 70; - x = x - x % 16; int y = canvas.height()-50; - y = y - y % 16; - (void)new Obstacle(&canvas, x, 32); - (void)new Obstacle(&canvas, x, y); + (void)new Obstacle(&canvas, 32); + (void)new Obstacle(&canvas, y); createTargets(); } void SnakeGame::showScore(int score) { @@ -189,13 +186,13 @@ void SnakeGame::gameOver() gameover->setFont( QFont("times", 18, QFont::Bold) ); int w = gameover->boundingRect().width(); gameover->move(canvas.width()/2 -w/2, canvas.height()/2 -50); gameover->show(); gamestopped = true; waitover = false; - pauseTimer->start(2500); + pauseTimer->start(1500); } void SnakeGame::wait() { waitover = true; pauseTimer->stop(); |