//start rendering
if (d3ddev->BeginScene())
{
//erase the entire background
d3ddev->StretchRect(tiles, NULL, backbuffer, NULL, D3DTEXF_NONE);
//start sprite handler
sprite_handler->Begin(D3DXSPRITE_ALPHABLEND);
//create vector to update sprite position
D3DXVECTOR3 position((float)Player.x, (float)Player.y, 0);
//draw the sprite
sprite_handler->Draw(
player_ship,
NULL,
NULL,
&position,
D3DCOLOR_XRGB(255,255,255));
//draw tiles onto the scroll buffer
DrawTiles();
//draw the scroll window onto the back buffer
DrawScrollWindow();
//stop rendering
d3ddev->EndScene();
}
Small problem( Direct X )**SOLVED**
Hey all basically in this small section of code I have a small problem. Simply put my sprite_handler->Draw is being stopped because d3ddev->EndScene(); is being called in the same if statement. However I cant take d3ddev->EndScene(); out because my tiled background needs it so what would be another way of drawing my sprite to the screen?
Thanks!
[Edited by - xM1k3x on July 2, 2008 8:59:21 PM]
I'd say you're not getting past:
If BeginScene is successful, it returns S_OK which = 0.
if( 0 ) never continues.
if (d3ddev->BeginScene())
If BeginScene is successful, it returns S_OK which = 0.
if( 0 ) never continues.
Quote:Original post by Mike.Popoloski
uh, just call sprite_handler->End() before the device end call?
Awesome thank you very much! I am still not completed used to using Direct X I apreciate the help.
Quote:Original post by Buckeye
I'd say you're not getting past:if (d3ddev->BeginScene())
If BeginScene is successful, it returns S_OK which = 0.
if( 0 ) never continues.
Thanks for the help but I just needed to do what the poster above you said.
I appreciate you answering my question either way so thank you.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement