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

📄 testresource.cpp

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

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

#include "Common.h"
#include "TestResource.h"

using namespace Resources;


// TestResource - Construction and destruction.

TestResource::TestResource()
: x(NULL)
, y(NULL)
, z(NULL)
{
	// Random value will lie between -300.0f and 300.0f.
	float nMin = -300.0f, nMax = 300.0f;
	float nWidth = fabs(nMin) + fabs(nMax);

	// Generate three random values.
	float rand0and1 = (float)rand() / (float)RAND_MAX;
	x = rand0and1 * nWidth + nMin;

	rand0and1 = (float)rand() / (float)RAND_MAX;
	y = rand0and1 * nWidth + nMin;

	rand0and1 = (float)rand() / (float)RAND_MAX;
	z = rand0and1 * nWidth + nMin;
}

TestResource::~TestResource()
{
}


// TestResource - Functions which must be overriden.

void TestResource::OnProcess(float nTime)
{
}

void TestResource::OnRender(float nTime)
{
	// Render resource contents.
	printf("X = %+.2f,\tY = %+.2f,\tZ = %+.2f\n", x, y, z);
}

DWORD TestResource::GetUniqueID() const
{
	return CUSTOM_TESTRESOURCE;
}


// TestResource - Functions which can be overriden.

void TestResource::OnDestroy()
{
	// Test event call.
	printf("Destroying TestResource { X: %+.2f,\tY: %+.2f,\tZ: %+.2f }...\n",
		x, y, z);
}

⌨️ 快捷键说明

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