Sign in to follow this  
xM1k3x

Small problem( Direct X )**SOLVED**

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this