diff options
Diffstat (limited to 'doc/html/tutorial1-12.html')
-rw-r--r-- | doc/html/tutorial1-12.html | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/doc/html/tutorial1-12.html b/doc/html/tutorial1-12.html index 7aef83897..3a90243c8 100644 --- a/doc/html/tutorial1-12.html +++ b/doc/html/tutorial1-12.html @@ -161,10 +161,10 @@ hit the target). <p> <pre> void paintTarget( <a href="tqpainter.html">TQPainter</a> * ); </pre> <p> This private function paints the target. -<p> <pre> <a href="ntqrect.html">TQRect</a> targetRect() const; +<p> <pre> <a href="tqrect.html">TQRect</a> targetRect() const; </pre> <p> This private function returns the enclosing rectangle of the target. -<p> <pre> <a href="ntqpoint.html">TQPoint</a> target; +<p> <pre> <a href="tqpoint.html">TQPoint</a> target; </pre> <p> This private variable contains the center point of the target. <p> <h3> <a href="t12-cannon-cpp.html">t12/cannon.cpp</a> @@ -192,10 +192,10 @@ repaint() on a hidden widget. <a href="tqtime.html">TQTime</a> midnight( 0, 0, 0 ); <a name="x2399"></a><a name="x2398"></a> srand( midnight.<a href="tqtime.html#secsTo">secsTo</a>(TQTime::<a href="tqtime.html#currentTime">currentTime</a>()) ); } - <a href="ntqregion.html">TQRegion</a> r( targetRect() ); + <a href="tqregion.html">TQRegion</a> r( targetRect() ); target = TQPoint( 200 + rand() % 190, 10 + rand() % 255 ); - <a name="x2395"></a> <a href="tqwidget.html#repaint">repaint</a>( r.<a href="ntqrect.html#unite">unite</a>( targetRect() ) ); + <a name="x2395"></a> <a href="tqwidget.html#repaint">repaint</a>( r.<a href="tqrect.html#unite">unite</a>( targetRect() ) ); } </pre> <p> This private function creates a target center point at a new "random" @@ -225,13 +225,13 @@ the left edge and with x values increasing to the right. <p> Note that rand() returns a random integer >= 0. <p> <pre> void CannonField::moveShot() { - <a href="ntqregion.html">TQRegion</a> r( shotRect() ); + <a href="tqregion.html">TQRegion</a> r( shotRect() ); timerCount++; - <a href="ntqrect.html">TQRect</a> shotR = shotRect(); + <a href="tqrect.html">TQRect</a> shotR = shotRect(); </pre> <p> This part of the timer event has not changed from the previous chapter. -<p> <pre> if ( shotR.<a href="ntqrect.html#intersects">intersects</a>( targetRect() ) ) { +<p> <pre> if ( shotR.<a href="tqrect.html#intersects">intersects</a>( targetRect() ) ) { <a name="x2400"></a> autoShootTimer-><a href="tqtimer.html#stop">stop</a>(); emit hit(); </pre> @@ -242,7 +242,7 @@ world that a target was destroyed, and return. <p> Note that we could have created a new target on the spot, but because the CannonField is a component we leave such decisions to the user of the component. -<p> <pre> <a name="x2397"></a><a name="x2396"></a> } else if ( shotR.<a href="ntqrect.html#x">x</a>() > width() || shotR.<a href="ntqrect.html#y">y</a>() > height() ) { +<p> <pre> <a name="x2397"></a><a name="x2396"></a> } else if ( shotR.<a href="tqrect.html#x">x</a>() > width() || shotR.<a href="tqrect.html#y">y</a>() > height() ) { autoShootTimer-><a href="tqtimer.html#stop">stop</a>(); emit missed(); </pre> @@ -254,7 +254,7 @@ failure. <p> And the rest of the function is as before. <p> CannonField::paintEvent() is as before, except that this has been added: -<p> <pre> <a name="x2393"></a> if ( updateR.<a href="ntqrect.html#intersects">intersects</a>( targetRect() ) ) +<p> <pre> <a name="x2393"></a> if ( updateR.<a href="tqrect.html#intersects">intersects</a>( targetRect() ) ) paintTarget( &p ); </pre> <p> These two lines make sure that the target is also painted when necessary. @@ -269,15 +269,15 @@ added: with a black outline. <p> <pre> TQRect CannonField::targetRect() const { - <a href="ntqrect.html">TQRect</a> r( 0, 0, 20, 10 ); - <a name="x2394"></a> r.<a href="ntqrect.html#moveCenter">moveCenter</a>( TQPoint(target.x(),height() - 1 - target.y()) ); + <a href="tqrect.html">TQRect</a> r( 0, 0, 20, 10 ); + <a name="x2394"></a> r.<a href="tqrect.html#moveCenter">moveCenter</a>( TQPoint(target.x(),height() - 1 - target.y()) ); return r; } </pre> <p> This private function returns the enclosing rectangle of the target. Remember from newTarget() that the <tt>target</tt> point uses y coordinate 0 at the bottom of the widget. We calculate the point in widget coordinates -before we call <a href="ntqrect.html#moveCenter">TQRect::moveCenter</a>(). +before we call <a href="tqrect.html#moveCenter">TQRect::moveCenter</a>(). <p> The reason we have chosen this coordinate mapping is to fix the distance between the target and the bottom of the widget. Remember that the widget can be resized by the user or the program at any time. @@ -305,7 +305,7 @@ makefile and build the application.) <a name="3"></a><p> Make a cheat button that, when pressed, makes the CannonField display the shot trajectory for five seconds. <p> If you did the "round shot" exercise from the previous chapter, try -changing the shotRect() to a shotRegion() that returns a <a href="ntqregion.html">TQRegion</a> so +changing the shotRect() to a shotRegion() that returns a <a href="tqregion.html">TQRegion</a> so you can have really accurate collision detection. <p> Make a moving target. <p> Make sure that the target is always created entirely on-screen. |