Heres the intialisation code for the panel texture.
Code:
bool CHardball::InitGame()
{
//Setup panels for 2D
m_pPanel1 = new CPanel(pD3D->getD3DDevice(),16,16,pWindow->getWidth(),pWindow->getHeight());
m_pPanel1->setTexture("ball.bmp", D3DCOLOR_XRGB(255, 255, 255)); //Load the texture and set the key colour
return true;
}
bool CPanel::setTexture(const char *szTextureFilePath, DWORD dwKeyColour)
{
if(FAILED(D3DXCreateTextureFromFileEx(m_pD3DDevice, szTextureFilePath, 0, 0, 0, 0,
D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT,
D3DX_DEFAULT, dwKeyColour, NULL, NULL, &m_pTexture)))
{
return false;
}
return true;
}