diff options
| author | Michele Calgaro <michele.calgaro@yahoo.it> | 2025-05-30 14:27:29 +0900 |
|---|---|---|
| committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2025-06-25 16:43:08 +0900 |
| commit | 35ced32e331ee29fda1642616c803637952f5b22 (patch) | |
| tree | da44726777f814e19c7ef1e43854f6a1693dd6fb /doc/html/tutorial1-13.html | |
| parent | 7dd4848d61e4c52091d6c644356c84c67536bde2 (diff) | |
| download | tqt-35ced32e.tar.gz tqt-35ced32e.zip | |
Replace TRUE/FALSE with boolean values true/false - part 1
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit a7f1e6e2552d9cdbb3d76bff089db522248b9a24)
Diffstat (limited to 'doc/html/tutorial1-13.html')
| -rw-r--r-- | doc/html/tutorial1-13.html | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/doc/html/tutorial1-13.html b/doc/html/tutorial1-13.html index 4e92f4642..4f69d23f3 100644 --- a/doc/html/tutorial1-13.html +++ b/doc/html/tutorial1-13.html @@ -106,7 +106,7 @@ not. <p> <pre> bool gameOver() const { return gameEnded; } </pre> -<p> This function returns TRUE if the game is over or FALSE if a game +<p> This function returns true if the game is over or false if a game is going on. <p> <pre> void setGameOver(); void restartGame(); @@ -119,13 +119,13 @@ shoot() slot makes sense. We'll use it below to enable/disable the Shoot button. <p> <pre> bool gameEnded; </pre> -<p> This private variable contains the game state. TRUE means that the -game is over, and FALSE means that a game is going on. +<p> This private variable contains the game state. true means that the +game is over, and false means that a game is going on. <p> <h3> <a href="t13-cannon-cpp.html">t13/cannon.cpp</a> </h3> <a name="1-4"></a><p> -<p> <pre> gameEnded = FALSE; +<p> <pre> gameEnded = false; </pre> <p> This line has been added to the constructor. Initially, the game is not over (luckily for the player :-). @@ -137,7 +137,7 @@ over (luckily for the player :-). shoot_ang = ang; shoot_f = f; <a name="x2407"></a> autoShootTimer-><a href="ntqtimer.html#start">start</a>( 50 ); - emit canShoot( FALSE ); + emit canShoot( false ); } </pre> <p> We added a new isShooting() function, so shoot() uses it instead of @@ -149,7 +149,7 @@ cannot shoot now. return; if ( isShooting() ) autoShootTimer-><a href="ntqtimer.html#stop">stop</a>(); - gameEnded = TRUE; + gameEnded = true; <a href="ntqwidget.html#repaint">repaint</a>(); } </pre> @@ -166,14 +166,14 @@ widget. { if ( isShooting() ) <a name="x2408"></a> autoShootTimer-><a href="ntqtimer.html#stop">stop</a>(); - gameEnded = FALSE; + gameEnded = false; <a href="ntqwidget.html#repaint">repaint</a>(); - emit canShoot( TRUE ); + emit canShoot( true ); } </pre> <p> This slot starts a new game. If a shot is in the air, we stop shooting. We then reset the <tt>gameEnded</tt> variable and repaint the widget. -<p> moveShot() too emits the new canShoot(TRUE) signal at the same time as +<p> moveShot() too emits the new canShoot(true) signal at the same time as either hit() or miss(). <p> Modifications in CannonField::paintEvent(): <p> <pre> void CannonField::<a href="ntqwidget.html#paintEvent">paintEvent</a>( <a href="qpaintevent.html">TQPaintEvent</a> *e ) @@ -188,7 +188,7 @@ either hit() or miss(). } </pre> <p> The paint event has been enhanced to display the text "Game Over" if -the game is over, i.e., <tt>gameEnded</tt> is TRUE. We don't bother to +the game is over, i.e., <tt>gameEnded</tt> is true. We don't bother to check the update rectangle here because speed is not critical when the game is over. <p> To draw the text we first set a black pen; the pen color is used |
