Original Post
I am using a sprite to show a texture which is the title screen for my game. My window is 1024x768 and the jpg is 1024x768 however when I show the sprite with the texture loaded from my jpg, it does not fit in the window. It appears as if the jpg is too big. Has anyone seen this before? Here is my sprite code: I call this function first to load the jpg as a texture: This is the code I use to show the sprite: And here are some extra class members I use in the code above: I checked and double checked that my jpg is indeed 1024x768. Any help would be appreciated.
void CWindow::showPicture(LPCTSTR filename)
{
if( !FAILED(D3DXCreateTextureFromFile(g_pd3dDevice, filename, &g_pTexture)))
{
g_pd3dDevice->SetTexture(0, g_pTexture);
D3DXCreateSprite(g_pd3dDevice, &sprite);
sprite->Draw(g_pTexture, NULL, (512, 384, 0), (0, 0, 0), 0xFFFFFFFF);
}
}
if(myWindow.getTexture() == NULL)
myWindow.showPicture("title.jpg");
myWindow.BeginRender();
myWindow.getSprite()->Begin(NULL);
myWindow.getSprite()->Draw(myWindow.getTexture(), NULL, NULL, NULL, 0xffffffff);
myWindow.getSprite()->End();
myWindow.EndRender();
SendMessage(myWindow.getHwnd(), WM_PAINT,0,0);
LPDIRECT3DTEXTURE9 g_pTexture; // Texture
ID3DXSprite* sprite;
ID3DXSprite* CWindow::getSprite()
{
return sprite;
}
LPDIRECT3DTEXTURE9 CWindow::getTexture()
{
return g_pTexture;
}