Revision: 2608
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2608&view=rev
Author:   ulteq
Date:     2012-05-20 02:22:22 +0000 (Sun, 20 May 2012)
Log Message:
-----------
-Bugfix: Survey map (WIP)
correct aspect ratio for the survey map window
co-author: theshark

Modified Paths:
--------------
    trunk/source/main/gameplay/RoRFrameListener.cpp
    trunk/source/main/gui/MapControl.cpp
    trunk/source/main/gui/MapControl.h

Modified: trunk/source/main/gameplay/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.cpp     2012-05-20 02:19:14 UTC 
(rev 2607)
+++ trunk/source/main/gameplay/RoRFrameListener.cpp     2012-05-20 02:22:22 UTC 
(rev 2608)
@@ -3082,10 +3082,10 @@
                                {
                                        if (surveyMapMode == SURVEY_MAP_SMALL)
                                        {
-                                               surveyMap->setPosition(0, 0.81, 
0.14, 0.19, mWindow);
+                                               surveyMap->setPosition(-1, 1, 
0.3f, mWindow);
                                        } else if (surveyMapMode == 
SURVEY_MAP_BIG)
                                        {
-                                               surveyMap->setPosition(0.2, 0, 
0.8, 0.8, mWindow);
+                                               surveyMap->setPosition(0, 0, 
0.98f, mWindow);
                                        }
                                        surveyMap->setVisibility(true);
                                }

Modified: trunk/source/main/gui/MapControl.cpp
===================================================================
--- trunk/source/main/gui/MapControl.cpp        2012-05-20 02:19:14 UTC (rev 
2607)
+++ trunk/source/main/gui/MapControl.cpp        2012-05-20 02:22:22 UTC (rev 
2608)
@@ -111,13 +111,38 @@
        mMainWidget->setAlpha(value);
 }
 
-void MapControl::setPosition(float x, float y, float w, float h, RenderWindow* 
rw)
+void MapControl::setPosition(int x, int y, float size, Ogre::RenderWindow* rw)
 {
        updateRenderMetrics(rw);
 
-       mScale = w;
-       mMainWidget->setCoord(x * rWinWidth, y * rWinHeight, w * rWinWidth, h * 
rWinHeight);
+       int realx, realy, realw, realh;
+       
+       realw = realh = size * std::min(rWinWidth, rWinHeight);
+       mScale = size;
 
+       if (x == -1)
+       {
+               realx = 0;
+       } else if (x == 0)
+       {
+               realx = (rWinWidth - realw) / 2;
+       } else if (x == 1)
+       {
+               realx = rWinWidth - realw;
+       }
+
+       if (y == -1)
+       {
+               realy = 0;
+       } else if (y == 0)
+       {
+               realy = (rWinHeight - realh) / 2;
+       } else if (y == 1)
+       {
+               realy = rWinHeight - realh;
+       }
+
+       mMainWidget->setCoord(realx, realy, realw, realh);
        updateEntityPositions();
 }
 

Modified: trunk/source/main/gui/MapControl.h
===================================================================
--- trunk/source/main/gui/MapControl.h  2012-05-20 02:19:14 UTC (rev 2607)
+++ trunk/source/main/gui/MapControl.h  2012-05-20 02:22:22 UTC (rev 2608)
@@ -47,7 +47,7 @@
        void setAlpha(float value);
        void setEntitiesVisibility(bool value);
        void setMapTexture(Ogre::String name);
-       void setPosition(float x, float y, float w, float h, 
Ogre::RenderWindow* rw);
+       void setPosition(int x, int y, float size, Ogre::RenderWindow* rw);
        void setVisibility(bool value);
        void setWorldSize(int x, int z);
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Rigsofrods-devel mailing list
Rigsofrods-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to