netpanzer-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netPanzer-CVS] netpanzer/src/NetPanzer/Views/Game MiniMapView....


From: Matthias Braun
Subject: [netPanzer-CVS] netpanzer/src/NetPanzer/Views/Game MiniMapView....
Date: Sun, 12 Oct 2003 16:06:30 -0400

CVSROOT:        /cvsroot/netpanzer
Module name:    netpanzer
Branch:         
Changes by:     Matthias Braun <address@hidden> 03/10/12 16:06:30

Modified files:
        src/NetPanzer/Views/Game: MiniMapView.cpp 
                                  VehicleSelectionView.cpp 

Log message:
        fixed an issue where the minimap was drawing stuff outside it's view 
area (off by 1 pixel)

Patches:
Index: netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp:1.15 
netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp:1.16
--- netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp:1.15     Sun Oct 12 
14:56:19 2003
+++ netpanzer/src/NetPanzer/Views/Game/MiniMapView.cpp  Sun Oct 12 16:06:29 2003
@@ -74,7 +74,7 @@
     //int xOffset = size.x;
     //int yOffset = 0;
 
-    MiniMapInterface::setMapScale(getViewRect().getSize());
+    MiniMapInterface::setMapScale(getSize() - iXY(2,2));
 
     minMapSize =  64;
     maxMapSize = 480;
@@ -116,10 +116,10 @@
         scaleGroupWait += dt;
 
         if (scaleGroupWait > 1.0f) {
-            miniMapSurface.create(getViewRect().getSize(), 
getViewRect().getSize().x , 1);
+            miniMapSurface.create(getSize(), getSize().x , 1);
 
             //miniMapSurface.scale(getViewRect().getSize());
-            iRect r(iXY(0, 0), getViewRect().getSize());
+            iRect r(iXY(0, 0), getSize());
 
             miniMapSurface.bltScale(*miniMap, r);
 
@@ -128,7 +128,7 @@
         }
     }
 
-    iRect r(getViewRect().min, getViewRect().max);
+    iRect r(iXY(0,0), getSize());
 
     if (needScale) {
         // Draw the slow on the fly scaled map.
@@ -184,7 +184,9 @@
     MiniMapInterface::annotateMiniMap((Surface &) clientArea);
 
     // Draw the world view box corners.
-    clientArea.drawBoxCorners(MiniMapInterface::getWorldWindow(), 5, 
Color::white);
+    iRect boxpos = MiniMapInterface::getWorldWindow();
+    boxpos.translate(iXY(1,1));
+    clientArea.drawBoxCorners(boxpos, 5, Color::white);
 
     // Draw an inner black rect inside the outer white rect, for visibility 
reasons.
     //iRect innerRect(MiniMapInterface::getWorldWindow());
@@ -220,12 +222,9 @@
 {
     assert(this != 0);
 
-    iXY size(getViewRect().getSize());
-
-    if ((pos.x >= 0) && (pos.x < size.x) && (pos.y >= 0) && (pos.y < size.y)) {
-        MiniMapInterface::setWorldWindowPosition( iXY( pos.x, pos.y ) );
+    if (iRect(iXY(0,0), getSize()).contains(pos)) {
+        MiniMapInterface::setWorldWindowPosition( pos - iXY(1,1) );
     }
-
 } // end MiniMapView::setViewWindow
 
 // drawMouseBox
@@ -313,7 +312,7 @@
 //--------------------------------------------------------------------------
 void MiniMapView::doIncreaseSize(int value)
 {
-    iXY destSize(getViewRect().getSize());
+    iXY destSize(getSize());
 
     if (value == -1) {
         float dt = TimerInterface::getTimeSlice();
@@ -358,26 +357,26 @@
     }
 
     // Resize the x dimension.
-    if (destSize.x > getViewRect().getSize().x) {
+    if (destSize.x > getSize().x) {
         if (destSize.x > maxMapSize) {
-            resize(iXY(maxMapSize, getViewRect().getSize().y));
+            resize(iXY(maxMapSize, getSize().y));
 
         } else {
-            resize(iXY(destSize.x, getViewRect().getSize().y));
+            resize(iXY(destSize.x, getSize().y));
         }
     }
 
     // Resize the y dimension.
-    if (destSize.y > getViewRect().getSize().y) {
+    if (destSize.y > getSize().y) {
         if (destSize.x > maxMapSize) {
-            resize(iXY(getViewRect().getSize().x, maxMapSize));
+            resize(iXY(getSize().x, maxMapSize));
 
         } else {
-            resize(iXY(getViewRect().getSize().x, destSize.x));
+            resize(iXY(getSize().x, destSize.x));
         }
     }
 
-    MiniMapInterface::setMapScale(getViewRect().getSize());
+    MiniMapInterface::setMapScale(getSize() - iXY(2,2));
 
     needScale      = true;
     scaleGroupWait = 0.0f;
@@ -388,7 +387,7 @@
 //--------------------------------------------------------------------------
 void MiniMapView::doDecreaseSize(int value)
 {
-    iXY destSize(getViewRect().getSize());
+    iXY destSize(getSize());
 
     if (value == -1) {
         float dt = TimerInterface::getTimeSlice();
@@ -404,7 +403,7 @@
         resize(iXY(minMapSize, minMapSize));
     }
 
-    MiniMapInterface::setMapScale(getViewRect().getSize());
+    MiniMapInterface::setMapScale(getSize() - iXY(2,2));
 
     needScale      = true;
     scaleGroupWait = 0.0f;
Index: netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp
diff -u netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp:1.16 
netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp:1.17
--- netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp:1.16    Sun Oct 
12 15:22:12 2003
+++ netpanzer/src/NetPanzer/Views/Game/VehicleSelectionView.cpp Sun Oct 12 
16:06:30 2003
@@ -673,6 +673,9 @@
         case _objective_disposition_player: {
 
                 iXY objectiveScreenPos(objectiveBounds.min - gameViewRect.min);
+                printf("GameViewRect: %d %d %d %d\n", gameViewRect.min.x,
+                        gameViewRect.min.y, gameViewRect.max.x,
+                        gameViewRect.max.y);
                 printf("ObjectiveScreenPos: %d %d\n", objectiveBounds.min.x,
                         objectiveBounds.min.y);
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]