当前位置: 首页>>代码示例>>C++>>正文


C++ LPD3DXSPRITE::GetDevice方法代码示例

本文整理汇总了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;
}
开发者ID:ryanaleksander,项目名称:NMGAME,代码行数:33,代码来源:Texture.cpp

示例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;
    }

}
开发者ID:NguyenVanNguyen,项目名称:GameBattleCity,代码行数:48,代码来源:Sprite.cpp

示例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;
    }
}
开发者ID:DinhPhucTran,项目名称:NewSuperMarioBrosPC,代码行数:46,代码来源:sprite.cpp

示例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;
	}
}
开发者ID:nguyenhaidang94,项目名称:GameMario,代码行数:42,代码来源:Sprite.cpp


注:本文中的LPD3DXSPRITE::GetDevice方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。