示例#1
0
void ObjectPool::SetBWbools(const char* filename, int NumOfObject)
{
	HGE *hge = hgeCreate(HGE_VERSION);
	HTEXTURE pic = hge->Texture_Load(filename);
	int width = hge->Texture_GetWidth(pic);
	int height = hge->Texture_GetHeight(pic);
	BWpic bwpic;
	bwpic.width = width;
	bwpic.height = height;
	bwpic.bools = (bool**)malloc(sizeof(bool*)*width);
	for (int i = 0; i < width; i++)
		bwpic.bools[i] = (bool*)malloc(sizeof(bool)*height);
	DWORD *color = hge->Texture_Lock(pic);
	for (int i = 0; i < width; i++)
	for (int j = 0; j < height;j++)	
	if (GETR(color[j*width + i]) == 0 && GETG(color[j*width + i]) == 0 && GETB(color[j*width + i]) == 0)
		bwpic.bools[j][i] = true;
	else bwpic.bools[j][i] = false;
	bwpic.number = NumOfObject;
	hge->Texture_Unlock(pic);
	hge->Texture_Free(pic);
	BWpics.push_back(bwpic);
	BWpics.shrink_to_fit();
}
示例#2
0
Missile::~Missile()
{
	HGE* hge = hgeCreate(HGE_VERSION);
	hge->Texture_Free(tex_);
	hge->Release();
}