Browse Source

Fehlerhafter Rückgabewert der Tick funktion der Kam3D behoben

Kolja Strohm 4 years ago
parent
commit
a5b48ae8a9
1 changed files with 33 additions and 2 deletions
  1. 33 2
      Kam3D.cpp

+ 33 - 2
Kam3D.cpp

@@ -182,16 +182,29 @@ void Kam3D::removeStyle( __int64 style )
 //  return: true, wenn sich das Bild neu gezeichnet werden muss, false sonnst.
 bool Kam3D::tick( double tv )
 {
+    bool ret = 0;
     if( hatStyle( Style::Rotatable ) )
     {
         if( getTastenStand( T_Oben ) )
+        {
             rotX -= (float)tv;
+            ret = 1;
+        }
         if( getTastenStand( T_Unten ) )
+        {
             rotX += (float)tv;
+            ret = 1;
+        }
         if( getTastenStand( T_Links ) )
+        {
             rotY -= (float)tv;
+            ret = 1;
+        }
         if( getTastenStand( T_Rechts ) )
+        {
             rotY += (float)tv;
+            ret = 1;
+        }
     }
     if( hatStyle( Style::Movable ) )
     {
@@ -206,22 +219,40 @@ bool Kam3D::tick( double tv )
         n3 = tmp * n3;
         n3 = n3 * (float)tv * 60;
         if( getTastenStand( 'w' ) )
+        {
             pos += n;
+            ret = 1;
+        }
         if( getTastenStand( 's' ) )
+        {
             pos -= n;
+            ret = 1;
+        }
         if( getTastenStand( 'd' ) )
+        {
             pos += n2;
+            ret = 1;
+        }
         if( getTastenStand( 'a' ) )
+        {
             pos -= n2;
+            ret = 1;
+        }
         if( getTastenStand( ' ' ) )
+        {
             pos += n3;
+            ret = 1;
+        }
         if( getTastenStand( T_Shift ) )
+        {
             pos -= n3;
+            ret = 1;
+        }
     }
     updateMatrix();
     if( welt && hatStyle( Style::Tick ) )
-        return welt->tick( tv );
-    return 0;
+        return welt->tick( tv ) || ret;
+    return ret;
 }
 
 // Verarbeitet ein Mausereignis