本文整理汇总了C++中LPD3DXSPRITE::GetDevice方法的典型用法代码示例。如果您正苦于以下问题:C++ LPD3DXSPRITE::GetDevice方法的具体用法?C++ LPD3DXSPRITE::GetDevice怎么用?C++ LPD3DXSPRITE::GetDevice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPD3DXSPRITE
的用法示例。
在下文中一共展示了LPD3DXSPRITE::GetDevice方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadFromFile
HRESULT Texture::loadFromFile(LPD3DXSPRITE spriteHandle, LPWSTR filePath, D3DXCOLOR color)
{
HRESULT result;
result = D3DXGetImageInfoFromFile(filePath, &this->_imageInfo);
if (result != D3D_OK)
{
return result;
}
LPDIRECT3DDEVICE9 _device = DeviceManager::getInstance()->getDevice();
spriteHandle->GetDevice(&_device);
result = D3DXCreateTextureFromFileEx(
_device,
filePath,
this->_imageInfo.Width,
this->_imageInfo.Height,
1,
D3DUSAGE_DYNAMIC,
D3DFMT_UNKNOWN,
D3DPOOL_DEFAULT,
D3DX_DEFAULT,
D3DX_DEFAULT,
color,
&this->_imageInfo,
nullptr,
&this->_texture);
_color = color;
return result;
}
示例2:
Sprite::Sprite(LPD3DXSPRITE SpriteHandler, char* Path, int Width, int Height, int Count, int SpritePerRow)
{
D3DXIMAGE_INFO info;
HRESULT result;
this->_Image = NULL;
this->_SpriteHandler = SpriteHandler;
this->_Width = Width;
this->_Height = Height;
this->_Count = Count;
this->_SpritePerRow = SpritePerRow;
this->_Index = 0;
this->_CurrentSpriteLocation.x = 0.0f;
this->_CurrentSpriteLocation.y = 0.0f;
this->_CurrentSpriteLocation.z = 0.0f;
result = D3DXGetImageInfoFromFile(Path, &info);
if (result != D3D_OK)
{
int i = 10;
}
LPDIRECT3DDEVICE9 d3ddv;
SpriteHandler->GetDevice(&d3ddv);
result = D3DXCreateTextureFromFileEx(
d3ddv,
Path,
info.Width,
info.Height,
1,
D3DUSAGE_DYNAMIC,
D3DFMT_UNKNOWN,
D3DPOOL_DEFAULT,
D3DX_DEFAULT,
D3DX_DEFAULT,
D3DCOLOR_XRGB(88, 1, 0),
&info,
NULL,
&_Image);
if (result != D3D_OK)
{
int i = 10;
}
}
示例3:
CSprite::CSprite(LPD3DXSPRITE SpriteHandler, LPWSTR FilePath, int Width, int Height, int Count, int SpritePerRow)
{
D3DXIMAGE_INFO info;
HRESULT result;
_Image = NULL;
_SpriteHandler = SpriteHandler;
_Width = Width;
_Height = Height;
_Count = Count;
_SpritePerRow = SpritePerRow;
_Index = 0;
result = D3DXGetImageInfoFromFile(FilePath, &info);
if (result != D3D_OK)
{
//trace(L"[ERROR] Failed to get information from image file '%s'", FilePath);
return;
}
LPDIRECT3DDEVICE9 d3ddv;
SpriteHandler->GetDevice(&d3ddv);
result = D3DXCreateTextureFromFileEx(
d3ddv,
FilePath,
info.Width,
info.Height,
1,
D3DUSAGE_DYNAMIC,
D3DFMT_UNKNOWN,
D3DPOOL_DEFAULT,
D3DX_DEFAULT,
D3DX_DEFAULT,
D3DCOLOR_XRGB(255, 0, 255), // 176, 224, 248
&info,
NULL,
&_Image);
if (result != D3D_OK)
{
//trace(L"[ERROR] Failed to create texture from file '%s'", FilePath);
return;
}
}
示例4:
Sprite::Sprite(LPD3DXSPRITE SpriteHandler, LPWSTR Path, double Width, double Height, int Count, int SpritePerRow, D3DCOLOR TransparentColor)
{
D3DXIMAGE_INFO info;
HRESULT result;
_Image = NULL;
_SpriteHandler = SpriteHandler;
_Width = Width;
_Height = Height;
_Count = Count;
_SpritePerRow = SpritePerRow;
result = D3DXGetImageInfoFromFile(Path, &info);
if (result != D3D_OK)
{
return;
}
LPDIRECT3DDEVICE9 d3ddv;
SpriteHandler->GetDevice(&d3ddv);
result = D3DXCreateTextureFromFileEx(
d3ddv,
Path,
info.Width,
info.Height,
1, //Mipmap levels
D3DUSAGE_DYNAMIC,
D3DFMT_UNKNOWN,
D3DPOOL_DEFAULT,
D3DX_DEFAULT,
D3DX_DEFAULT,
TransparentColor, // Transparent color
&info, // Image information
NULL,
&_Image); // Result
if (result != D3D_OK)
{
return;
}
}