author | harlekin <harlekin> | 2002-05-15 17:33:19 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-05-15 17:33:19 (UTC) |
commit | 968718335dd546fcb0f7cd27094d151a247f6c48 (patch) (unidiff) | |
tree | 2cd22f9a78477f09bf58eb341dd1eb96eabc6cbd /noncore/games | |
parent | a1f53542132be75295e52b17661204860bc486d4 (diff) | |
download | opie-968718335dd546fcb0f7cd27094d151a247f6c48.zip opie-968718335dd546fcb0f7cd27094d151a247f6c48.tar.gz opie-968718335dd546fcb0f7cd27094d151a247f6c48.tar.bz2 |
image relocation
-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) : | |||
60 | toolbar->setStretchableWidget( scorelabel ); | 60 | toolbar->setStretchableWidget( scorelabel ); |
61 | 61 | ||
62 | setFocusPolicy(StrongFocus); | 62 | setFocusPolicy(StrongFocus); |
63 | 63 | ||
64 | setCentralWidget(cv); | 64 | setCentralWidget(cv); |
65 | 65 | ||
66 | welcomescreen(); | 66 | QTimer::singleShot( 16, this, SLOT(welcomescreen()) ); |
67 | gamestopped = true; | 67 | gamestopped = true; |
68 | waitover = true; | 68 | waitover = true; |
69 | } | 69 | } |
70 | 70 | ||
71 | SnakeGame::~SnakeGame() | 71 | SnakeGame::~SnakeGame() |
72 | { | 72 | { |
@@ -85,13 +85,13 @@ void SnakeGame::welcomescreen() | |||
85 | QCanvasText* title = new QCanvasText(tr("SNAKE!"), &canvas); | 85 | QCanvasText* title = new QCanvasText(tr("SNAKE!"), &canvas); |
86 | title->setColor(yellow); | 86 | title->setColor(yellow); |
87 | title->setFont( QFont("times", 18, QFont::Bold) ); | 87 | title->setFont( QFont("times", 18, QFont::Bold) ); |
88 | int w = title->boundingRect().width(); | 88 | int w = title->boundingRect().width(); |
89 | title->move(canvas.width()/2 -w/2, canvas.height()/2-110); | 89 | title->move(canvas.width()/2 -w/2, canvas.height()/2-110); |
90 | title->show(); | 90 | title->show(); |
91 | QCanvasPixmapArray* titlearray = new QCanvasPixmapArray(Resource::findPixmap("title")); | 91 | QCanvasPixmapArray* titlearray = new QCanvasPixmapArray(Resource::findPixmap("snake/title")); |
92 | QCanvasSprite* titlepic = new QCanvasSprite(titlearray, &canvas); | 92 | QCanvasSprite* titlepic = new QCanvasSprite(titlearray, &canvas); |
93 | titlepic->move(canvas.width()/2 - 33, canvas.height()/2-85); | 93 | titlepic->move(canvas.width()/2 - 33, canvas.height()/2-85); |
94 | titlepic->show(); | 94 | titlepic->show(); |
95 | QCanvasText* instr = new QCanvasText(tr("Use the arrow keys to guide the\n" | 95 | QCanvasText* instr = new QCanvasText(tr("Use the arrow keys to guide the\n" |
96 | "snake to eat the mouse. You must not\n" | 96 | "snake to eat the mouse. You must not\n" |
97 | "crash into the walls, edges or its tail."), | 97 | "crash into the walls, edges or its tail."), |
@@ -99,13 +99,13 @@ void SnakeGame::welcomescreen() | |||
99 | w = instr->boundingRect().width(); | 99 | w = instr->boundingRect().width(); |
100 | instr->move(canvas.width()/2-w/2, canvas.height()/2-20); | 100 | instr->move(canvas.width()/2-w/2, canvas.height()/2-20); |
101 | instr->setColor(white); | 101 | instr->setColor(white); |
102 | instr->show(); | 102 | instr->show(); |
103 | QCanvasText* cont = new QCanvasText(tr("Press Any Key To Start"), &canvas); | 103 | QCanvasText* cont = new QCanvasText(tr("Press Any Key To Start"), &canvas); |
104 | w = cont->boundingRect().width(); | 104 | w = cont->boundingRect().width(); |
105 | cont->move(canvas.width()/2-w/2, canvas.height()/2+80); | 105 | cont->move(canvas.width()/2-w/2, canvas.height()-20); |
106 | cont->setColor(yellow); | 106 | cont->setColor(yellow); |
107 | cont->show(); | 107 | cont->show(); |
108 | 108 | ||
109 | } | 109 | } |
110 | 110 | ||
111 | void SnakeGame::newGame() | 111 | void SnakeGame::newGame() |
@@ -121,18 +121,15 @@ void SnakeGame::newGame() | |||
121 | notargets = 1; | 121 | notargets = 1; |
122 | level = 1; | 122 | level = 1; |
123 | stage = 1; | 123 | stage = 1; |
124 | showScore(0); | 124 | showScore(0); |
125 | gamestopped = false; | 125 | gamestopped = false; |
126 | waitover = true; | 126 | waitover = true; |
127 | int x = canvas.width()/2 - 70; | ||
128 | x = x - x % 16; | ||
129 | int y = canvas.height()-50; | 127 | int y = canvas.height()-50; |
130 | y = y - y % 16; | 128 | (void)new Obstacle(&canvas, 32); |
131 | (void)new Obstacle(&canvas, x, 32); | 129 | (void)new Obstacle(&canvas, y); |
132 | (void)new Obstacle(&canvas, x, y); | ||
133 | createTargets(); | 130 | createTargets(); |
134 | } | 131 | } |
135 | 132 | ||
136 | 133 | ||
137 | void SnakeGame::showScore(int score) | 134 | void SnakeGame::showScore(int score) |
138 | { | 135 | { |
@@ -189,13 +186,13 @@ void SnakeGame::gameOver() | |||
189 | gameover->setFont( QFont("times", 18, QFont::Bold) ); | 186 | gameover->setFont( QFont("times", 18, QFont::Bold) ); |
190 | int w = gameover->boundingRect().width(); | 187 | int w = gameover->boundingRect().width(); |
191 | gameover->move(canvas.width()/2 -w/2, canvas.height()/2 -50); | 188 | gameover->move(canvas.width()/2 -w/2, canvas.height()/2 -50); |
192 | gameover->show(); | 189 | gameover->show(); |
193 | gamestopped = true; | 190 | gamestopped = true; |
194 | waitover = false; | 191 | waitover = false; |
195 | pauseTimer->start(2500); | 192 | pauseTimer->start(1500); |
196 | } | 193 | } |
197 | 194 | ||
198 | void SnakeGame::wait() | 195 | void SnakeGame::wait() |
199 | { | 196 | { |
200 | waitover = true; | 197 | waitover = true; |
201 | pauseTimer->stop(); | 198 | pauseTimer->stop(); |