⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 directxplane2d.cpp

📁 这个是我第一次完成的一个简单的3D ALIEN SHOOTING GAME的RESOURCE MANAGER部分,大家可以看看,然后提点意见~THX
💻 CPP
字号:
// DirectXPlane2D.cpp
//

// Author:			Lea Hayes
// Date Created:	10/03/2006
// Date Modified:	10/03/2006

#include "Common.h"
#include "DirectXPlane2D.h"

using namespace Resources;


// DirectXPlane2D - Construction and destruction.

DirectXPlane2D::DirectXPlane2D(LPCSTR lpszFilename /*=NULL*/)
{
	// If filename and path were specified then attempt to
	// load this texture.
	if(lpszFilename != NULL)
	{
		// If read failed then throw an exception.
		if(FAILED(ReadFromFile(lpszFilename)))
		{
			// Generate exception and then throw it.
			ResException e = ResException::UnableToOpenFile EXTRA_DEBUGINFO;
			e.SetExtraInfo(lpszFilename);
			throw e;
		}
	}
}

DirectXPlane2D::~DirectXPlane2D()
{
}


// DirectXPlane2D - Functions which must be overriden.

void DirectXPlane2D::OnProcess(float nTime)
{
}

void DirectXPlane2D::OnRender(float nTime)
{
	// Retrieve DirectX device.
	LPDIRECT3DDEVICE9 pDevice = ResourceManager::GetActiveDevice();

	// Render your plane to screen.
}

DWORD DirectXPlane2D::GetUniqueID() const
{
	return CUSTOM_DIRECTX_PLANE2D;
}


// DirectXPlane2D - Functions which can be overriden.

void DirectXPlane2D::OnDestroy()
{
	// Release resources.
	m_hTexture->Release();
}

// Function Name:	ReadFromFile
//
// Author:			Lea Hayes
// Date Created:	13/03/2006
// Date Modified:	13/03/2006
//
// Description:		Attempt to read object resource from an x file.
//					Note: Result is returned.
//
HRESULT DirectXPlane2D::ReadFromFile(LPCSTR lpszFilename)
{
	// Retrieve required texture resource.
	m_hTexture = ResourceManager::AquireTexture(lpszFilename);

	// Create plane geometry.

	return hResult;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -