金鲨银鲨(无错版)【源码】
http://img.woaidaima.com//upload/image/20170523/1495499313225024856.pnghttp://img.woaidaima.com//upload/image/20170523/1495499315708054494.png#include "StdAfx.h"#include ".\d3dtextureindex.h"
CD3DTextureIndex::CD3DTextureIndex(void)
{
m_nWidthNumber = 0;
m_nHeightNumber = 0;
}
CD3DTextureIndex::~CD3DTextureIndex(void)
{
}
//加载判断
bool CD3DTextureIndex::IsNull()
{
return CD3DTexture::IsNull();
}
//加载纹理
bool CD3DTextureIndex::LoadImage( CD3DDevice * pD3DDevice, HINSTANCE hInstance, LPCTSTR pszResource, DWORD dwColorKey, int nWidthNumber, int nHeightNumber )
{
//条件判断
ASSERT(nWidthNumber > 0 && nHeightNumber>0);
//设置变量
m_nWidthNumber = nWidthNumber;
m_nHeightNumber = nHeightNumber;
//载入图片
return CD3DTexture::LoadImage( pD3DDevice, hInstance, pszResource, dwColorKey );
}
//加载纹理
bool CD3DTextureIndex::LoadImage( CD3DDevice * pD3DDevice, HINSTANCE hInstance, LPCTSTR pszResource, LPCTSTR pszTypeName, int nWidthNumber, int nHeightNumber )
{
//条件判断
ASSERT(nWidthNumber > 0 && nHeightNumber>0);
//设置变量
m_nWidthNumber = nWidthNumber;
m_nHeightNumber = nHeightNumber;
//载入图片
return CD3DTexture::LoadImage( pD3DDevice, hInstance, pszResource, pszTypeName );
}
////加载纹理
//bool CD3DTextureIndex::LoadImage( CD3DDevice * pD3DDevice, LPCTSTR pszTextureName, BOOL bCreateCache, int nWidthNumber, int nHeightNumber )
//{
// //条件判断
// ASSERT(nWidthNumber > 0 && nHeightNumber>0);
//
// //设置变量
// m_nWidthNumber = nWidthNumber;
// m_nHeightNumber = nHeightNumber;
//
// //载入图片
// return CD3DTexture::LoadImage( pD3DDevice, pszTextureName, bCreateCache );
//}
//绘画图片
bool CD3DTextureIndex::DrawImage( CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nIndex )
{
//超过索引 画全图
if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest );
//设置变量
int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
int nSourceWidth = GetWidth();
int nSourceHeight = GetHeight();
//画图
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nSourceWidth, nSourceHeight, nXSource, nYSource );
}
//绘画图片
bool CD3DTextureIndex::DrawImage(CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nIndex)
{
//超过索引 画全图
if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest );
//设置变量
int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
int nSourceWidth = GetWidth();
int nSourceHeight = GetHeight();
//画图
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight );
}
//绘画图片
bool CD3DTextureIndex::DrawImage( CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int nSourceWidth, int nSourceHeight )
{
//画图
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight );
}
//绘画图片
bool CD3DTextureIndex::DrawImage( CD3DDevice * pD3DDevice, int nXDest, int nYDest, BYTE cbAlpha, int nIndex )
{
//超过索引 画全图
if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, cbAlpha );
//设置变量
int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
int nSourceWidth = GetWidth();
int nSourceHeight = GetHeight();
//画图
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nSourceWidth, nSourceHeight, nXSource, nYSource, cbAlpha );
}
//绘画图片
bool CD3DTextureIndex::DrawImage(CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nDestWidth, int nDestHeight, BYTE cbAlpha, int nIndex)
{
//超过索引 画全图
if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, cbAlpha );
//设置变量
int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
int nSourceWidth = GetWidth();
int nSourceHeight = GetHeight();
//画图
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight, cbAlpha );
}
//绘画图片
bool CD3DTextureIndex::DrawImage( CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int nSourceWidth, int nSourceHeight, BYTE cbAlpha )
{
//画图
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight, cbAlpha );
}
//绘画图片
bool CD3DTextureIndex::DrawImage( CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nIndex )
{
//超过索引 画全图
if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest );
//设置变量
int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
int nSourceWidth = GetWidth();
int nSourceHeight = GetHeight();
//画图
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nSourceWidth, nSourceHeight, nXSource, nYSource );
}
//绘画图片
bool CD3DTextureIndex::DrawImage(CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nIndex)
{
//超过索引 画全图
if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest );
//设置变量
int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
int nSourceWidth = GetWidth();
int nSourceHeight = GetHeight();
//画图
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight );
}
//绘画图片
bool CD3DTextureIndex::DrawImage( CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int nSourceWidth, int nSourceHeight )
{
//画图
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight );
}
//绘画图片
bool CD3DTextureIndex::DrawImage( CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, BYTE cbAlpha, int nIndex )
{
//超过索引 画全图
if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, cbAlpha );
//设置变量
int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
int nSourceWidth = GetWidth();
int nSourceHeight = GetHeight();
//画图
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nSourceWidth, nSourceHeight, nXSource, nYSource, cbAlpha );
}
//绘画图片
bool CD3DTextureIndex::DrawImage(CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, BYTE cbAlpha, int nIndex)
{
//超过索引 画全图
if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, cbAlpha );
//设置变量
int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
int nSourceWidth = GetWidth();
int nSourceHeight = GetHeight();
//画图
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight, cbAlpha );
}
//绘画图片
bool CD3DTextureIndex::DrawImage( CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int nSourceWidth, int nSourceHeight, BYTE cbAlpha )
{
//画图
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight, cbAlpha );
}
//-------------------------------------------------------------------------------------
//滤色函数
//
//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage( CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nIndex )
{
//超过索引 画全图
if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest );
//设置变量
int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
int nSourceWidth = GetWidth();
int nSourceHeight = GetHeight();
//画图
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nSourceWidth, nSourceHeight, nXSource, nYSource );
}
//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage(CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nIndex)
{
//超过索引 画全图
if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest );
//设置变量
int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
int nSourceWidth = GetWidth();
int nSourceHeight = GetHeight();
//画图
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight );
}
//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage( CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int nSourceWidth, int nSourceHeight )
{
//画图
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight );
}
//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage( CD3DDevice * pD3DDevice, int nXDest, int nYDest, BYTE cbAlpha, int nIndex )
{
//超过索引 画全图
if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, cbAlpha );
//设置变量
int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
int nSourceWidth = GetWidth();
int nSourceHeight = GetHeight();
//画图
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nSourceWidth, nSourceHeight, nXSource, nYSource, cbAlpha );
}
//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage(CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nDestWidth, int nDestHeight, BYTE cbAlpha, int nIndex)
{
//超过索引 画全图
if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, cbAlpha );
//设置变量
int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
int nSourceWidth = GetWidth();
int nSourceHeight = GetHeight();
//画图
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight, cbAlpha );
}
//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage( CD3DDevice * pD3DDevice, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int nSourceWidth, int nSourceHeight, BYTE cbAlpha )
{
//画图
return CD3DTexture::DrawImage( pD3DDevice, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight, cbAlpha );
}
//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage( CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nIndex )
{
//超过索引 画全图
if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest );
//设置变量
int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
int nSourceWidth = GetWidth();
int nSourceHeight = GetHeight();
//画图
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nSourceWidth, nSourceHeight, nXSource, nYSource );
}
//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage(CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nIndex)
{
//超过索引 画全图
if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest );
//设置变量
int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
int nSourceWidth = GetWidth();
int nSourceHeight = GetHeight();
//画图
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight );
}
//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage( CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int nSourceWidth, int nSourceHeight )
{
//画图
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight );
}
//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage( CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, BYTE cbAlpha, int nIndex )
{
//超过索引 画全图
if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, cbAlpha );
//设置变量
int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
int nSourceWidth = GetWidth();
int nSourceHeight = GetHeight();
//画图
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nSourceWidth, nSourceHeight, nXSource, nYSource, cbAlpha );
}
//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage(CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, BYTE cbAlpha, int nIndex)
{
//超过索引 画全图
if ( nIndex >= m_nWidthNumber * m_nHeightNumber )
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, cbAlpha );
//设置变量
int nXSource = (nIndex%m_nWidthNumber) * GetWidth();
int nYSource = (nIndex/m_nWidthNumber) * GetHeight();
int nSourceWidth = GetWidth();
int nSourceHeight = GetHeight();
//画图
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight, cbAlpha );
}
//绘画滤色图片
bool CD3DTextureIndex::DrawColourFilterImage( CD3DDevice * pD3DDevice, CPoint ptRotationOffset, FLOAT fRadian, CHAR chDirection, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int nSourceWidth, int nSourceHeight, BYTE cbAlpha )
{
//画图
return CD3DTexture::DrawImage( pD3DDevice, ptRotationOffset, fRadian, chDirection, nXDest, nYDest, nDestWidth, nDestHeight, nXSource, nYSource, nSourceWidth, nSourceHeight, cbAlpha );
}
页:
[1]