From 0ab15ed0538e495bd4b995270f0cfdb320a14815 Mon Sep 17 00:00:00 2001 From: sigatrev Date: Thu, 20 Feb 2014 21:17:10 -0600 Subject: [PATCH] TextureTranslate method Allow themes to duplicate the way noteskins are handled. --- src/Actor.cpp | 13 +++++++++++++ src/Actor.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/Actor.cpp b/src/Actor.cpp index d2264cbf32..e1fdd04e63 100644 --- a/src/Actor.cpp +++ b/src/Actor.cpp @@ -127,6 +127,7 @@ void Actor::InitState() m_bTextureWrapping = false; m_bTextureFiltering = true; + m_texTranslate = RageVector2( 0, 0 ); m_BlendMode = BLEND_NORMAL; m_fZBias = 0; @@ -569,6 +570,12 @@ void Actor::BeginDraw() // set the world matrix DISPLAY->SkewY( m_pTempState->fSkewY ); } + if( m_texTranslate.x != 0 || m_texTranslate.y != 0 ) + { + DISPLAY->TexturePushMatrix(); + DISPLAY->TextureTranslate( m_texTranslate.x, m_texTranslate.y ); + } + } void Actor::SetGlobalRenderStates() @@ -600,6 +607,10 @@ void Actor::SetTextureRenderStates() void Actor::EndDraw() { DISPLAY->PopMatrix(); + + if( m_texTranslate.x != 0 || m_texTranslate.y != 0 ) + DISPLAY->TexturePopMatrix(); + } void Actor::UpdateTweening( float fDeltaTime ) @@ -1576,6 +1587,7 @@ public: static int pause( T* p, lua_State * ) { p->EnableAnimation(false); return 0; } static int setstate( T* p, lua_State *L ) { p->SetState(IArg(1)); return 0; } static int GetNumStates( T* p, lua_State *L ) { LuaHelpers::Push( L, p->GetNumStates() ); return 1; } + static int texturetranslate( T* p, lua_State *L ) { p->SetTextureTranslate(FArg(1),FArg(2)); return 0; } static int texturewrapping( T* p, lua_State *L ) { p->SetTextureWrapping(BIArg(1)); return 0; } static int SetTextureFiltering( T* p, lua_State *L ) { p->SetTextureFiltering(BArg(1)); return 0; } static int blend( T* p, lua_State *L ) { p->SetBlendMode( Enum::Check(L, 1) ); return 0; } @@ -1795,6 +1807,7 @@ public: ADD_METHOD( pause ); ADD_METHOD( setstate ); ADD_METHOD( GetNumStates ); + ADD_METHOD( texturetranslate ); ADD_METHOD( texturewrapping ); ADD_METHOD( SetTextureFiltering ); ADD_METHOD( blend ); diff --git a/src/Actor.h b/src/Actor.h index fe3aaaaaa5..9e69fc0fc7 100644 --- a/src/Actor.h +++ b/src/Actor.h @@ -549,6 +549,7 @@ public: // render states void SetBlendMode( BlendMode mode ) { m_BlendMode = mode; } + void SetTextureTranslate( float x, float y ) { m_texTranslate.x = x; m_texTranslate.y = y; } void SetTextureWrapping( bool b ) { m_bTextureWrapping = b; } void SetTextureFiltering( bool b ) { m_bTextureFiltering = b; } void SetClearZBuffer( bool b ) { m_bClearZBuffer = b; } @@ -685,6 +686,7 @@ protected: BlendMode m_BlendMode; ZTestMode m_ZTestMode; CullMode m_CullMode; + RageVector2 m_texTranslate; bool m_bTextureWrapping; bool m_bTextureFiltering; bool m_bClearZBuffer;