Browse Source

Rundungsfehler beim ändern der weltposition von Kamera2D behoben

Kolja Strohm 5 years ago
parent
commit
0961d26126
2 changed files with 9 additions and 9 deletions
  1. 7 7
      Kamera2D.cpp
  2. 2 2
      Kamera2D.h

+ 7 - 7
Kamera2D.cpp

@@ -35,11 +35,11 @@ void Kamera2D::setName( Text *name )
     this->name->setText( name );
 }
 
-void Kamera2D::lookAtWorldPos( int x, int y )
+void Kamera2D::lookAtWorldPos( float x, float y )
 {
-    rend |= wPos != Punkt( x, y );
-    wPos.x = (float)x;
-    wPos.y = (float)y;
+    rend |= wPos != Vertex( x, y );
+    wPos.x = x;
+    wPos.y = y;
     if( welt && welt->getWorldInfo().hasSize && welt->getWorldInfo().circular )
     {
         if( wPos.x < 0 )
@@ -55,12 +55,12 @@ void Kamera2D::lookAtWorldPos( int x, int y )
 
 void Kamera2D::lookAtWorldPos( Vertex pos )
 {
-    lookAtWorldPos( (int)pos.x, (int)pos.y );
+    lookAtWorldPos( pos.x, pos.y );
 }
 
-void Kamera2D::lookAtWorldArea( int width, int height )
+void Kamera2D::lookAtWorldArea( float width, float height )
 {
-    zoom = (float)getBreite() / (float)width;
+    zoom = (float)getBreite() / width;
     // TODO have two scaling factors
 }
 

+ 2 - 2
Kamera2D.h

@@ -26,8 +26,8 @@ namespace Framework
         __declspec( dllexport ) void setName( const char *name );
         __declspec( dllexport ) void setName( Text *name );
         __declspec( dllexport ) void lookAtWorldPos( Vertex pos );
-        __declspec( dllexport ) void lookAtWorldPos( int x, int y );
-        __declspec( dllexport ) void lookAtWorldArea( int width, int height );
+        __declspec( dllexport ) void lookAtWorldPos( float x, float y );
+        __declspec( dllexport ) void lookAtWorldArea( float width, float height );
         __declspec( dllexport ) void setDrehung( float rotation );
         __declspec( dllexport ) void setZoom( float zoom );
         __declspec( dllexport ) void setWelt( Welt2D *welt, bool tick );