Hello,
i'm trying to create 2D Collision Mask for A8R8G8B8 Texture, i'm not sure whats wrong, here is the code:
D3DLOCKED_RECT rect;
HRESULT hResult = _currentTexture->LockRect(0, &rect, NULL, D3DLOCK_READONLY);
if (SUCCEEDED(hResult))
{
for (int y = 0; y < GetHeight(); ++y)
{
for (int x = 0; x < GetWidth(); ++x)
{
//Should i keep getting this or just put it up outside of the loops will do?
D3DCOLOR* pixels = (D3DCOLOR*)rect.pBits;
//It fails here sometimes, there is something off when getting the pixel
D3DCOLOR a = (pixels[y * rect.Pitch + x] & 0xFF000000) >> 24;
}
}
}
i appreciate all the help, thanks.