author | zecke <zecke> | 2003-05-14 08:33:57 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-05-14 08:33:57 (UTC) |
commit | 79e34e9dc4870885c58f80c29a723d0227f7b788 (patch) (unidiff) | |
tree | 1e91a0e6d698c782ef975e023288d4b9817e82c6 | |
parent | 81a58bae78d693b67679d94d2f7fcdb300e12d4f (diff) | |
download | opie-79e34e9dc4870885c58f80c29a723d0227f7b788.zip opie-79e34e9dc4870885c58f80c29a723d0227f7b788.tar.gz opie-79e34e9dc4870885c58f80c29a723d0227f7b788.tar.bz2 |
patch by Scott Bronson.
Add a little game description in the about messagebox
-rw-r--r-- | noncore/games/bounce/kbounce.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/noncore/games/bounce/kbounce.cpp b/noncore/games/bounce/kbounce.cpp index f703f74..5d8aba3 100644 --- a/noncore/games/bounce/kbounce.cpp +++ b/noncore/games/bounce/kbounce.cpp | |||
@@ -68,97 +68,106 @@ KJezzball::KJezzball() : QMainWindow(0), m_gameWidget( 0 ) | |||
68 | FilledLabel->setText( tr( "Filled: 00%" ) ); | 68 | FilledLabel->setText( tr( "Filled: 00%" ) ); |
69 | FilledLabel->setAlignment( int( QLabel::AlignCenter ) ); | 69 | FilledLabel->setAlignment( int( QLabel::AlignCenter ) ); |
70 | 70 | ||
71 | m_layout->addWidget( FilledLabel, 1, 1 ); | 71 | m_layout->addWidget( FilledLabel, 1, 1 ); |
72 | 72 | ||
73 | TimeLabel = new QLabel( m_view, "TimeLabel" ); | 73 | TimeLabel = new QLabel( m_view, "TimeLabel" ); |
74 | TimeLabel->setText( tr( "Time: 00" ) ); | 74 | TimeLabel->setText( tr( "Time: 00" ) ); |
75 | TimeLabel->setAlignment( int( QLabel::AlignCenter ) ); | 75 | TimeLabel->setAlignment( int( QLabel::AlignCenter ) ); |
76 | 76 | ||
77 | m_layout->addWidget( TimeLabel, 1, 3 ); | 77 | m_layout->addWidget( TimeLabel, 1, 3 ); |
78 | 78 | ||
79 | // create timers | 79 | // create timers |
80 | m_nextLevelTimer = new QTimer( this, "m_nextLevelTimer" ); | 80 | m_nextLevelTimer = new QTimer( this, "m_nextLevelTimer" ); |
81 | connect( m_nextLevelTimer, SIGNAL(timeout()), this, SLOT(switchLevel()) ); | 81 | connect( m_nextLevelTimer, SIGNAL(timeout()), this, SLOT(switchLevel()) ); |
82 | 82 | ||
83 | m_gameOverTimer = new QTimer( this, "m_gameOverTimer" ); | 83 | m_gameOverTimer = new QTimer( this, "m_gameOverTimer" ); |
84 | connect( m_gameOverTimer, SIGNAL(timeout()), this, SLOT(gameOverNow()) ); | 84 | connect( m_gameOverTimer, SIGNAL(timeout()), this, SLOT(gameOverNow()) ); |
85 | 85 | ||
86 | m_timer = new QTimer( this, "m_timer" ); | 86 | m_timer = new QTimer( this, "m_timer" ); |
87 | connect( m_timer, SIGNAL(timeout()), this, SLOT(second()) ); | 87 | connect( m_timer, SIGNAL(timeout()), this, SLOT(second()) ); |
88 | 88 | ||
89 | // create demo game | 89 | // create demo game |
90 | createLevel( 1 ); | 90 | createLevel( 1 ); |
91 | } | 91 | } |
92 | 92 | ||
93 | void KJezzball::newGame() | 93 | void KJezzball::newGame() |
94 | { | 94 | { |
95 | // Check for running game | 95 | // Check for running game |
96 | closeGame(); | 96 | closeGame(); |
97 | if ( m_state==Idle ) | 97 | if ( m_state==Idle ) |
98 | { | 98 | { |
99 | // update displays | 99 | // update displays |
100 | m_game.level = 1; | 100 | m_game.level = 1; |
101 | m_game.score = 0; | 101 | m_game.score = 0; |
102 | 102 | ||
103 | setCaption(tr("Bounce Level %1").arg(m_game.level)); | 103 | setCaption(tr("Bounce Level %1").arg(m_game.level)); |
104 | ScoreLabel->setText( tr( "Score: %1" ).arg(m_game.score) ); | 104 | ScoreLabel->setText( tr( "Score: %1" ).arg(m_game.score) ); |
105 | 105 | ||
106 | // start new game | 106 | // start new game |
107 | m_state = Running; | 107 | m_state = Running; |
108 | 108 | ||
109 | createLevel( m_game.level ); | 109 | createLevel( m_game.level ); |
110 | startLevel(); | 110 | startLevel(); |
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
114 | void KJezzball::about() | 114 | void KJezzball::about() |
115 | { | 115 | { |
116 | QMessageBox::information( this, "About", "Written by: Stefan Schimanski\nPorted by: Martin Imobersteg\n\nThis program is distributed under\nthe terms of the GPL v2." ); | 116 | QMessageBox::information( this, "About", |
117 | "Written by: Stefan Schimanski\n" | ||
118 | "Ported by: Martin Imobersteg\n" | ||
119 | "\n" | ||
120 | "Click to form walls.\n" | ||
121 | "Hit space to switch wall direction.\n" | ||
122 | "Try to reduce total space by 75%.\n" | ||
123 | "\n" | ||
124 | "This program is distributed under\n" | ||
125 | "the terms of the GPL v2." ); | ||
117 | } | 126 | } |
118 | 127 | ||
119 | void KJezzball::closeGame() | 128 | void KJezzball::closeGame() |
120 | { | 129 | { |
121 | if ( m_state!=Idle ) | 130 | if ( m_state!=Idle ) |
122 | { | 131 | { |
123 | stopLevel(); | 132 | stopLevel(); |
124 | m_state = Idle; | 133 | m_state = Idle; |
125 | } | 134 | } |
126 | } | 135 | } |
127 | 136 | ||
128 | void KJezzball::pauseGame() | 137 | void KJezzball::pauseGame() |
129 | { | 138 | { |
130 | switch ( m_state ) | 139 | switch ( m_state ) |
131 | { | 140 | { |
132 | case Running: | 141 | case Running: |
133 | m_state = Paused; | 142 | m_state = Paused; |
134 | m_gameWidget->display( tr("Game paused.\nPress P to continue!") ); | 143 | m_gameWidget->display( tr("Game paused.\nPress P to continue!") ); |
135 | stopLevel(); | 144 | stopLevel(); |
136 | break; | 145 | break; |
137 | 146 | ||
138 | case Paused: | 147 | case Paused: |
139 | case Suspend: | 148 | case Suspend: |
140 | m_state = Running; | 149 | m_state = Running; |
141 | m_gameWidget->display( QString::null ); | 150 | m_gameWidget->display( QString::null ); |
142 | startLevel(); | 151 | startLevel(); |
143 | break; | 152 | break; |
144 | 153 | ||
145 | case Idle: | 154 | case Idle: |
146 | break; | 155 | break; |
147 | } | 156 | } |
148 | } | 157 | } |
149 | 158 | ||
150 | void KJezzball::gameOver() | 159 | void KJezzball::gameOver() |
151 | { | 160 | { |
152 | stopLevel(); | 161 | stopLevel(); |
153 | m_gameOverTimer->start( 100, TRUE ); | 162 | m_gameOverTimer->start( 100, TRUE ); |
154 | } | 163 | } |
155 | 164 | ||
156 | 165 | ||
157 | void KJezzball::gameOverNow() | 166 | void KJezzball::gameOverNow() |
158 | { | 167 | { |
159 | m_state = Idle; | 168 | m_state = Idle; |
160 | 169 | ||
161 | QString score; | 170 | QString score; |
162 | score.setNum( m_game.score ); | 171 | score.setNum( m_game.score ); |
163 | QMessageBox::information( this, "Game Over", tr("Game Over!\nScore: %1").arg(score) ); | 172 | QMessageBox::information( this, "Game Over", tr("Game Over!\nScore: %1").arg(score) ); |
164 | } | 173 | } |