From a9c98610bafa30807745d4b1e7664d583125cdb3 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 30 Oct 2003 22:56:45 +0000 Subject: [PATCH] add StretchTexCoords, StretchTexCoords command --- stepmania/src/Sprite.cpp | 15 +++++++++++++++ stepmania/src/Sprite.h | 1 + 2 files changed, 16 insertions(+) diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index 0d1d62074f..39b97b67c7 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -585,6 +585,20 @@ bool Sprite::IsDiagonalBanner( int iWidth, int iHeight ) return iWidth >= 100 && abs(iWidth - iHeight) < 2; } +void Sprite::StretchTexCoords( float fX, float fY ) +{ + float fTexCoords[8]; + GetActiveTextureCoords( fTexCoords ); + + for( int j=0; j<8; j+=2 ) + { + fTexCoords[j ] += fX; + fTexCoords[j+1] += fY; + } + + SetCustomTextureCoords( fTexCoords ); +} + void Sprite::HandleCommand( const CStringArray &asTokens ) { HandleParams; @@ -596,6 +610,7 @@ void Sprite::HandleCommand( const CStringArray &asTokens ) if( sName=="customtexturerect" ) SetCustomTextureRect( RectF(fParam(1),fParam(2),fParam(3),fParam(4)) ); else if( sName=="texcoordvelocity" ) SetTexCoordVelocity( fParam(1),fParam(2) ); else if( sName=="scaletoclipped" ) ScaleToClipped( fParam(1),fParam(2) ); + else if( sName=="stretchtexcoords" ) StretchTexCoords( fParam(1),fParam(2) ); /* Texture commands; these could be moved to RageTexture* (even though that's * not an Actor) if these are needed for other things that use textures. diff --git a/stepmania/src/Sprite.h b/stepmania/src/Sprite.h index 0d7b8c9a4c..b0a3995ed4 100644 --- a/stepmania/src/Sprite.h +++ b/stepmania/src/Sprite.h @@ -48,6 +48,7 @@ public: const RectF *GetCurrentTextureCoordRect() const; void StopUsingCustomCoords(); void GetActiveTextureCoords(float fTexCoordsOut[8]) const; + void StretchTexCoords( float fX, float fY ); void SetTexCoordVelocity(float fVelX, float fVelY) { m_fTexCoordVelocityX = fVelX; m_fTexCoordVelocityY = fVelY; }