ZoomToWidth/ZoomToHeight obeys crop. This way,
CropToAspectRatio,16/9; ZoomToWidth,SCREEN_WIDTH; ZoomToHeight,SCREEN_HEIGHT will zoom to the center 16:9 area of the image.
This commit is contained in:
@@ -845,6 +845,21 @@ void Actor::CropToAspectRatio( float fAspect )
|
||||
}
|
||||
}
|
||||
|
||||
/* Zoom the uncropped region to the given size. */
|
||||
void Actor::ZoomToWidth( float zoom )
|
||||
{
|
||||
float fWidth = GetUnzoomedWidth();
|
||||
fWidth *= 1-(GetCropLeft()+GetCropRight());
|
||||
SetZoomX( zoom / fWidth );
|
||||
}
|
||||
|
||||
void Actor::ZoomToHeight( float zoom )
|
||||
{
|
||||
float fHeight = GetUnzoomedHeight();
|
||||
fHeight *= 1-(GetCropTop()+GetCropBottom());
|
||||
SetZoomY( zoom / fHeight );
|
||||
}
|
||||
|
||||
|
||||
void Actor::SetHorizAlignString( const CString &s )
|
||||
{
|
||||
|
||||
@@ -145,8 +145,8 @@ public:
|
||||
void SetZoomY( float zoom ) { DestTweenState().scale.y = zoom; }
|
||||
void SetZoomZ( float zoom ) { DestTweenState().scale.z = zoom; }
|
||||
void ZoomTo( float fX, float fY ) { ZoomToWidth(fX); ZoomToHeight(fY); }
|
||||
void ZoomToWidth( float zoom ) { SetZoomX( zoom / GetUnzoomedWidth() ); }
|
||||
void ZoomToHeight( float zoom ){ SetZoomY( zoom / GetUnzoomedHeight() ); }
|
||||
void ZoomToWidth( float zoom );
|
||||
void ZoomToHeight( float zoom );
|
||||
|
||||
float GetRotationX() { return DestTweenState().rotation.x; }
|
||||
float GetRotationY() { return DestTweenState().rotation.y; }
|
||||
|
||||
Reference in New Issue
Block a user