From 640d964cfdc7467f6cacb513087cd3acda2c04f0 Mon Sep 17 00:00:00 2001 From: kergoth Date: Fri, 07 Jun 2002 18:53:14 +0000 Subject: Backing out unintentional merge from TT branch. --- (limited to 'noncore/games/snake') diff --git a/noncore/games/snake/interface.h b/noncore/games/snake/interface.h index 30c7f84..454d4ee 100644 --- a/noncore/games/snake/interface.h +++ b/noncore/games/snake/interface.h @@ -36,7 +36,6 @@ public: void clear(); void createTargets(); - void welcomescreen(); protected: virtual void keyPressEvent(QKeyEvent*); @@ -51,6 +50,7 @@ private slots: void wait(); void levelUp(); void scoreInc(); + void welcomescreen(); private: void showScore(int); diff --git a/noncore/games/snake/obstacle.cpp b/noncore/games/snake/obstacle.cpp index 2d07fe7..4bdefa5 100644 --- a/noncore/games/snake/obstacle.cpp +++ b/noncore/games/snake/obstacle.cpp @@ -23,20 +23,39 @@ #include -Obstacle::Obstacle(QCanvas* canvas, int x, int y) - : QCanvasSprite(0, canvas) + + +Obstacle::Obstacle(QCanvas* canvas, int y) + : QCanvasSprite(0,canvas) { - newObstacle(x, y); + newObstacle(y); } -void Obstacle::newObstacle(int x, int y) +void Obstacle::newObstacle(int y) { - QCanvasPixmapArray* obstaclearray = new QCanvasPixmapArray(Resource::findPixmap("snake/wall.png")); - + QPixmap obstaclePix( Resource::findPixmap("snake/wall.png") ); + + if ( obstaclePix.width() > canvas()->width()*3/5 ) { + int w = canvas()->width()*3/5; + w = w - w % 16; + obstaclePix.resize( w, obstaclePix.height() ); + } + + QList pixl; + pixl.append( &obstaclePix ); + + QPoint nullp; + QList pl; + pl.append( &nullp ); + + QCanvasPixmapArray* obstaclearray = new QCanvasPixmapArray(pixl, pl); setSequence(obstaclearray); - + + int x = ( canvas()->width() - obstaclePix.width() )/2; + x = x - x % 16; + y = y - y % 16; move(x, y); - + setZ( -100 ); show(); canvas()->update(); } diff --git a/noncore/games/snake/obstacle.h b/noncore/games/snake/obstacle.h index 838917f..b3c7846 100644 --- a/noncore/games/snake/obstacle.h +++ b/noncore/games/snake/obstacle.h @@ -23,8 +23,8 @@ class Obstacle : public QCanvasSprite { public: - Obstacle(QCanvas*, int x, int y); + Obstacle(QCanvas*, int y); ~Obstacle(); - void newObstacle(int x, int y); + void newObstacle(int y); int rtti() const; }; -- cgit v0.9.0.2