diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index fb076e03c6..18e600deab 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -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 ) { diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index e3c17ba5ff..ff22c85c99 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -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; }