From 76f05625d5dabd44d88650364a88a87c5a772dab Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 30 Nov 2005 23:11:31 +0000 Subject: [PATCH] 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. --- stepmania/src/Actor.cpp | 15 +++++++++++++++ stepmania/src/Actor.h | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) 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; }