D3DXCreateTextureFromResource有时会导致用户访问冲突。我无法调试它,因为它永远不会发生在我身上。
bool LoadTexture(LPDIRECT3DTEXTURE9* texture, IDirect3DDevice9* pDevice, int resourceID)
{
HRESULT hr = D3DXCreateTextureFromResource(pDevice, dll, MAKEINTRESOURCE(resourceID), texture);
if (hr != D3D_OK)
{
char errorBuf[256];
sprintf(errorBuf, "Error loading texture! Errorcode: %i", hr);
MessageBoxA(NULL, errorBuf, "Error", MB_OK);
return false;
}
return true;
}