• Advertisement
Sign in to follow this  

StretchRect Problems

This topic is 1271 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

Hello all,

 

First off, I want to give a warm heart thank you for all that posted on my last post.

 

I have a problem. I have decided to go with the DirectX API and want to begin getting a graphic (a character sprite) on the screen. My goal is to get it moving. In my book, "Beginning DirectX 9" it uses the StretchRect method to draw a sprite.

 

It is written as:

 

pd3dDevice->StretchRect(surface,

                                          src,

                                          backbuffer,

                                          dest

                                          D3DTEXF_NONE);

 

src and dest are variables of int with values. I understand how all this works.

 

However, in VS2012 it tells me that src and dest should be referenced (&). When I do this I get no image come up. If I set these to NULL and have D3DXLoadSurfaceFromFile load a file then it displays.

 

All I want is to get a sprite in a certain position on the sreen.

 

Thank you,

 

Lewis.

 

If anymore information is required to help than I will post it if asked.

 

Share this post


Link to post
Share on other sites
Advertisement

The StretchRect function takes pointers to a RECT struct, which means you will need to use the address-of operator (&) on src and dest when calling it.  If you pass NULL for both parameters it will copy the entire source image and stretch it to the entire dest image. It might be helpful to see what values you are setting in src and dest, as well as the dimensions of surface and backbuffer.  Also there are some restrictions with using StretchRect with regards to the formats and memory pools used for the surfaces.  You can check those out here to make sure you meet the requirements.

Share this post


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

  • Advertisement