• Advertisement
Sign in to follow this  

Small problem( Direct X )**SOLVED**

This topic is 3489 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement