コード例 #1
0
ファイル: RageTexture.cpp プロジェクト: ycaihua/fingermania
void RageTexture::CreateFrameRects()
{
	GetFrameDimensionsFromFileName(GetID().filename, &m_iFramesWide, &m_iFramesHigh);

	m_TextureCoordRects.clear();

	for (int j = 0; j < m_iFramesHigh; j++)
	{
		for (int i = 0; i < m_iFramesWide; i++)
		{
			RectF frect((i + 0) / (float)m_iFramesWide * m_iImageWidth / (float)m_iTextureWidth,
						(j + 0) / (float)m_iFramesHigh * m_iImageHeight / (float)m_iTextureHeight,
						(i + 1) / (float)m_iFramesWide * m_iImageWidth / (float)m_iTextureWidth,
						(j + 1) / (float)m_iFramesHigh * m_iImageHeight / (float)m_iTextureHeight);
			m_TextureCoordRects.push_back(frect);
		}
	}
}
コード例 #2
0
ファイル: RageTexture.cpp プロジェクト: augustg/stepmania-3.9
void RageTexture::CreateFrameRects()
{
	GetFrameDimensionsFromFileName( GetID().filename, &m_iFramesWide, &m_iFramesHigh );

	///////////////////////////////////
	// Fill in the m_FrameRects with the bounds of each frame in the animation.
	///////////////////////////////////
	m_TextureCoordRects.clear();

	for( int j=0; j<m_iFramesHigh; j++ )		// traverse along Y
	{
		for( int i=0; i<m_iFramesWide; i++ )	// traverse along X (important that this is the inner loop)
		{
			RectF frect( (i+0)/(float)m_iFramesWide*m_iImageWidth /(float)m_iTextureWidth,	// these will all be between 0.0 and 1.0
						 (j+0)/(float)m_iFramesHigh*m_iImageHeight/(float)m_iTextureHeight, 
						 (i+1)/(float)m_iFramesWide*m_iImageWidth /(float)m_iTextureWidth, 
						 (j+1)/(float)m_iFramesHigh*m_iImageHeight/(float)m_iTextureHeight );
			m_TextureCoordRects.push_back( frect );	// the index of this array element will be (i + j*m_iFramesWide)
			
			//LOG->Trace( "Adding frect%d %f %f %f %f", (i + j*m_iFramesWide), frect.left, frect.top, frect.right, frect.bottom );
		}
	}
}
コード例 #3
0
ファイル: RageTexture.cpp プロジェクト: augustg/stepmania-3.9
int RageTexture::GetFrameCountFromFileName( CString sPath )
{
	int wide, high;
	GetFrameDimensionsFromFileName(sPath, &wide, &high );
	return wide*high;
}
コード例 #4
0
ファイル: RageTexture.cpp プロジェクト: DataBeaver/openitg
int RageTexture::GetFrameCountFromFileName( CString sPath )
{
	int iWide, iHigh;
	GetFrameDimensionsFromFileName( sPath, &iWide, &iHigh );
	return iWide * iHigh;
}