Small problem( Direct X )**SOLVED**

Started by
3 comments, last by xM1k3x 15 years, 9 months ago
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!
//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();
		}

[Edited by - xM1k3x on July 2, 2008 8:59:21 PM]
Advertisement
uh, just call sprite_handler->End() before the device end call?
Mike Popoloski | Journal | SlimDX
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.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

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