Sprite copy ctor, same reason (refcounted textures)

this is the sort of thing HiddenPtr is meant to avoid, but I'm not ready to
start using it on refcounted objects just yet ...
This commit is contained in:
Glenn Maynard
2005-07-15 04:16:31 +00:00
parent ff2c101d82
commit 2aa932ca3a
2 changed files with 22 additions and 0 deletions
+21
View File
@@ -14,6 +14,7 @@
#include "Foreach.h"
#include "LuaBinding.h"
#include "LuaManager.h"
#include "RageUtil_AutoPtr.h"
REGISTER_ACTOR_CLASS( Sprite )
@@ -40,6 +41,26 @@ Sprite::~Sprite()
UnloadTexture();
}
Sprite::Sprite( const Sprite &cpy )
{
#define CPY(a) a = cpy.a
CPY( m_sSpritePath );
CPY( m_bDrawIfTextureNull );
CPY( m_States );
CPY( m_iCurState );
CPY( m_fSecsIntoState );
CPY( m_bUsingCustomTexCoords );
CPY( m_bSkipNextUpdate );
memcpy( m_CustomTexCoords, cpy.m_CustomTexCoords, sizeof(m_CustomTexCoords) );
CPY( m_fRememberedClipWidth );
CPY( m_fRememberedClipHeight );
CPY( m_fTexCoordVelocityX );
CPY( m_fTexCoordVelocityY );
#undef CPY
m_pTexture = TEXTUREMAN->CopyTexture( cpy.m_pTexture );
}
RageTextureID Sprite::SongBGTexture( RageTextureID ID )
{
ID.bMipMaps = true;
+1
View File
@@ -12,6 +12,7 @@ class Sprite: public Actor
{
public:
Sprite();
Sprite( const Sprite &cpy );
virtual ~Sprite();
void LoadFromNode( const CString& sDir, const XNode* pNode );