Jump to content

  • Log In with Google      Sign In   
  • Create Account

StretchRect Problems


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 PvtFreddy   Members   -  Reputation: 97

Like
0Likes
Like

Posted 30 July 2014 - 02:51 PM

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.

 



#2 aregee   Members   -  Reputation: 1072

Like
0Likes
Like

Posted 30 July 2014 - 06:26 PM

Seems to me that all of the first four parameters are pointers.  Hard to tell what is wrong, but have you read the remarks to the command?

 

http://msdn.microsoft.com/en-us/library/windows/desktop/bb174471(v=vs.85).aspx



#3 megadan   GDNet+   -  Reputation: 758

Like
0Likes
Like

Posted 30 July 2014 - 06:27 PM

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.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.




PARTNERS