Jump to content
  • Advertisement
Sign in to follow this  
Naigewron

Getting a RECT from a directdraw surface? [RESOLVED]

This topic is 5035 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! Does anyone know if there's a way of getting a size RECT from a surface in DirectDraw? I need one for clipping, because at the moment I use the bitmap size at loadtime, but it's not very efficient or dynamic. Thanks for any help [Edited by - Naigewron on October 9, 2004 12:04:45 AM]

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Call something like GetSurfaceDesc on the surface you want, and the DDSD structure it returns will have the width and height.

Share this post


Link to post
Share on other sites
do you mean the size of the whole surface or just a section of the surface? if you mean the whole surface, you would have needed to specify the size on creation of the surface anyway... but if you need to find the size still, try the dwWidth and dwHeight properties of the surface description you needed to use to make the surface. for example:

//you would have your surface description declared:
DDSURFACEDESC2 ddsd;
//..and your RECT structure declared:
RECT size;
/*now you would set up dx and sizes and everything else... OR
load the bitmap onto a surface (which is what i understand ur doing)*/

//...
/*now you've set up dx/image surface and are ready to set 'size' up:
you would use 'ddsd''s dwWidth and dwHeight properties to get the surface size:*/

size.Left = 0;
size.Top = 0;
size.Right = ddsd.dwWidth;
size.Bottom = ddsd.dwHeight;

/*now you have the size of the surface in your 'size' RECT struct!*/




i really hope that all made sense and that its what ur asking for! if not, please specify more clearly what u r trying to achieve ;)

the_moo

edit: hey a fellow aussie! its nice to see someone on here from the same country!

Share this post


Link to post
Share on other sites
Off Topic:

Quote:

edit: hey a fellow aussie! its nice to see someone on here from the same country!


AUSSIE! AUSSIE! AUSSIE!

Heh, there's a few of us around.

Share this post


Link to post
Share on other sites
kazgaroth - woooooo AUSSIE! *ahem* i guess there's more of us around than i thought ;) pity you all seem to live in melbourne... ;)

Share this post


Link to post
Share on other sites
Melbourne rocks, and you know it, hehe!

Thanks for the code sample, I'll try that out and come back whining for more if I can't figure it out [grin]

Share this post


Link to post
Share on other sites
not a problem Naigewron ;) glad it worked for ya.

just one last thing: i find it very ironic that this thread had posts from almost only aussies...!

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!