directxplane2d.cpp

来自「这个是我第一次完成的一个简单的3D ALIEN SHOOTING GAME的RE」· C++ 代码 · 共 84 行

CPP
84 行
字号
// 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 + =
减小字号Ctrl + -
显示快捷键?