|
From: Greg <evo...@us...> - 2005-12-19 20:31:54
|
Update of /cvsroot/evolutionlejeu/evolutionlejeu/Evolution/Ulysses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10860/Evolution/Ulysses Modified Files: ELandscape.cpp ELandscape.h EWorldview.cpp EWorldview.h Log Message: ADD : Province fit the governor minimap (end) & some zoom improvements Index: ELandscape.cpp =================================================================== RCS file: /cvsroot/evolutionlejeu/evolutionlejeu/Evolution/Ulysses/ELandscape.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ELandscape.cpp 19 Dec 2005 17:53:52 -0000 1.6 --- ELandscape.cpp 19 Dec 2005 20:31:38 -0000 1.7 *************** *** 406,410 **** --- 406,418 ---- } + GeoCode ELandscape::GetMapCenter() + { + AiInterface aiInterface; + Order oGetSpotCenter; + OGeoCode& oSpotCenter = (OGeoCode&) aiInterface.SendOrder( e_orderGetSpotCenter, oGetSpotCenter, m_spotId ); + + return oSpotCenter.value; + } void ELandscape::Zoom( bool bUnzoom ) *************** *** 420,423 **** --- 428,437 ---- } + void ELandscape::Zoom( double dRatio ) + { + SetZoom( m_config.m_fTileSizeRatio * dRatio ); + } + + void ELandscape::SetZoom( double fZoom ) { *************** *** 488,493 **** // number of iterations to show a dimLength x dimHeight rect. ! double dHorizontalSquareSizeToReach = ( (double) GetWidth() ) / (double) dimLength; ! double dVerticalSquareSizeToReach = ( (double) GetHeight() ) / (double) dimHeight / cos( m_config.m_fMapPlaneRadius * PI / 180.0f ); // Take the minimum of the two => we are sure to display the rect even if Landscape --- 502,508 ---- // number of iterations to show a dimLength x dimHeight rect. ! double dMargin = 0.6f; ! double dHorizontalSquareSizeToReach = ( (double) GetWidth() ) / ( (double) dimLength + 2.0f ); ! double dVerticalSquareSizeToReach = ( (double) GetHeight() ) / ( (double) dimHeight + 2.0f ) / cos( m_config.m_fMapPlaneRadius * PI / 180.0f ); // Take the minimum of the two => we are sure to display the rect even if Landscape *************** *** 495,498 **** --- 510,515 ---- double dSquareSizeToReach = min( dHorizontalSquareSizeToReach, dVerticalSquareSizeToReach ); + dSquareSizeToReach *= dMargin; + // Now, we adjust the number of iteration in order TileSize is between 1/2 max and max *************** *** 957,963 **** } ! void ELandscape::OnResize( ) { ! EControl::OnResize(); if( m_poCurrentSpot ) --- 974,980 ---- } ! void ELandscape::OnResize( int iOldWidth, int iOldHeight ) { ! EControl::OnResize( iOldWidth, iOldHeight ); if( m_poCurrentSpot ) Index: ELandscape.h =================================================================== RCS file: /cvsroot/evolutionlejeu/evolutionlejeu/Evolution/Ulysses/ELandscape.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ELandscape.h 19 Dec 2005 17:53:52 -0000 1.7 --- ELandscape.h 19 Dec 2005 20:31:38 -0000 1.8 *************** *** 61,64 **** --- 61,65 ---- virtual void OnRButtonDown( int x, int y ) { GetParent()->OnRButtonDown( x, y ); } virtual void OnRButtonUp( int x, int y ) { GetParent()->OnRButtonUp( x, y ); } + virtual void OnResize( int iOldWidth, int iOldHeight ); void Invalidate(); *************** *** 74,79 **** --- 75,83 ---- void Zoom( bool bUnzoom ); + void Zoom( double dRatio ); + int GetSquareSizeInTile() { return m_iSquareSizeInTile; } double GetMapRadius() { return m_config.m_fMapPlaneRadius; } + GeoCode GetMapCenter(); void SetSpotValues( OSpotResult *pSpot ) { m_poCurrentSpot = pSpot; } *************** *** 88,92 **** bool ConvertRelGeocodeInScreenCoord( OpenGl &gl, GeoCode gc, int *x, int *y ); - virtual void OnResize( ); private: --- 92,95 ---- Index: EWorldview.cpp =================================================================== RCS file: /cvsroot/evolutionlejeu/evolutionlejeu/Evolution/Ulysses/EWorldview.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** EWorldview.cpp 19 Dec 2005 17:53:52 -0000 1.10 --- EWorldview.cpp 19 Dec 2005 20:31:38 -0000 1.11 *************** *** 112,116 **** - void EWorldview::PaintProvinceInfos( OpenGl &gl ) { --- 112,115 ---- *************** *** 550,560 **** } ! void EWorldview::OnResize( ) { ! ECanvas::OnResize(); if( m_poCurrentSpot ) { m_Landscape.SetDimension( GetWidth(), GetHeight() ); Invalidate(); } --- 549,573 ---- } ! void EWorldview::OnResize( int iOldWidth, int iOldHeight ) { ! ECanvas::OnResize( iOldWidth, iOldHeight ); if( m_poCurrentSpot ) { m_Landscape.SetDimension( GetWidth(), GetHeight() ); + + // Ajust zoom in order new view show exactly the same + + if( (iOldWidth!=0) && (iOldHeight!=0) ) + { + double dHorizontalRatio = (double) GetWidth() / (double) iOldWidth; + double dVerticalRatio = (double) GetHeight() / (double) iOldHeight; + + double dZoomRatio = min( dHorizontalRatio, dVerticalRatio ); + // we take the minimum, thus we always have the entire old scene in the new view + + m_Landscape.Zoom( dZoomRatio ); + } + Invalidate(); } Index: EWorldview.h =================================================================== RCS file: /cvsroot/evolutionlejeu/evolutionlejeu/Evolution/Ulysses/EWorldview.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** EWorldview.h 18 Dec 2005 21:37:03 -0000 1.7 --- EWorldview.h 19 Dec 2005 20:31:38 -0000 1.8 *************** *** 36,40 **** virtual void OnRButtonDown( int x, int y ) { GetParent()->OnRButtonDown( x, y ); } virtual void OnRButtonUp( int x, int y ) { GetParent()->OnRButtonUp( x, y ); } ! MainMapScreenItem * GetMainMapScreenItem( int x, int y ); --- 36,41 ---- virtual void OnRButtonDown( int x, int y ) { GetParent()->OnRButtonDown( x, y ); } virtual void OnRButtonUp( int x, int y ) { GetParent()->OnRButtonUp( x, y ); } ! virtual void OnResize( int iOldWidth, int iOldHeight ); ! MainMapScreenItem * GetMainMapScreenItem( int x, int y ); *************** *** 50,54 **** void UpdateSelectionAgent( AgentIdentifier agentSelected ); - virtual void OnResize( ); private: --- 51,54 ---- |