From 2cbcca0db1343e1c40e52af729a5eb34ca8a7e37 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Thu, 27 Jun 2024 21:53:17 +0900 Subject: Rename date and time nt* related files to equivalent tq* Signed-off-by: Michele Calgaro --- doc/html/tutorial1-11.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'doc/html/tutorial1-11.html') diff --git a/doc/html/tutorial1-11.html b/doc/html/tutorial1-11.html index e4e977a6e..ce5de2a61 100644 --- a/doc/html/tutorial1-11.html +++ b/doc/html/tutorial1-11.html @@ -59,7 +59,7 @@ implementation. void moveShot();

This private slot is used to move the shot while it is in the air, -using a TQTimer. +using a TQTimer.

    private:
         void  paintShot( TQPainter * );
 
@@ -69,7 +69,7 @@ using a TQTimer.

This private function returns the shot's enclosing rectangle if one is in the air; otherwise the returned rectangle is undefined.

        int timerCount;
-        TQTimer * autoShootTimer;
+        TQTimer * autoShootTimer;
         float shoot_ang;
         float shoot_f;
     };
@@ -91,24 +91,24 @@ when the shot was fired.
         ang = 45;
         f = 0;
         timerCount = 0;
-        autoShootTimer = new TQTimer( this, "movement handler" );
-        connect( autoShootTimer, TQ_SIGNAL(timeout()),
+        autoShootTimer = new TQTimer( this, "movement handler" );
+        connect( autoShootTimer, TQ_SIGNAL(timeout()),
                  this, TQ_SLOT(moveShot()) );
         shoot_ang = 0;
         shoot_f = 0;
         setPalette( TQPalette( TQColor( 250, 250, 200) ) );
     }
 
-

We initialize our new private variables and connect the TQTimer::timeout() signal to our moveShot() slot. We'll move the +

We initialize our new private variables and connect the TQTimer::timeout() signal to our moveShot() slot. We'll move the shot every time the timer times out.

    void CannonField::shoot()
     {
-        if ( autoShootTimer->isActive() )
+        if ( autoShootTimer->isActive() )
             return;
         timerCount = 0;
         shoot_ang = ang;
         shoot_f = f;
-        autoShootTimer->start( 50 );
+        autoShootTimer->start( 50 );
     }
 

This function shoots a shot unless a shot is in the air. The timerCount @@ -122,14 +122,14 @@ cannon angle and force. Finally, we start the timer. TQRect shotR = shotRect(); if ( shotR.x() > width() || shotR.y() > height() ) - autoShootTimer->stop(); + autoShootTimer->stop(); else r = r.unite( TQRegion( shotR ) ); repaint( r ); }

moveShot() is the slot that moves the shot, called every 50 -milliseconds when the TQTimer fires. +milliseconds when the TQTimer fires.

Its tasks are to compute the new position, repaint the screen with the shot in the new position, and if necessary, stop the timer.

First we make a TQRegion that holds the old shotRect(). A TQRegion @@ -150,7 +150,7 @@ for just the one or two rectangles that need updating. if ( updateR.intersects( cannonRect() ) ) paintCannon( &p ); - if ( autoShootTimer->isActive() && + if ( autoShootTimer->isActive() && updateR.intersects( shotRect() ) ) paintShot( &p ); } -- cgit v1.2.3