Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Using a whole image in a sprite?


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
4 replies to this topic

#1 george7378   Members   -  Reputation: 1251

Like
0Likes
Like

Posted 05 March 2013 - 05:26 AM

I'm trying to create rectangular buttons for my GUI using sprites (I figure that this is the easiest way to display a textured rectangle on screen) but I have a little problem - the sprite drawing interface only lets me select an area of a texture to use as my sprite - there doesn't seem to be an option to compress a whole texture to the correct size so that it fits into an arbitrary rectangle. Does anyone know how I can make a sprite resize the texture so that it fits into my specified rectangle?

 

Thanks!



Sponsor:

#2 Yourself   Crossbones+   -  Reputation: 1153

Like
0Likes
Like

Posted 05 March 2013 - 07:32 AM

Assuming you use this function to draw, read carefully what it says about the pSrcRect.

 



#3 george7378   Members   -  Reputation: 1251

Like
0Likes
Like

Posted 05 March 2013 - 07:47 AM

I did see that, but I think it just uses the image in its native size rather than fitting it to the rectangle I specified. i.e. if the image is 100x200, it won't resize it to fit into my desired rectangle with dimensions of 50x100 for example. That's what I'm trying to do.



#4 Yourself   Crossbones+   -  Reputation: 1153

Like
1Likes
Like

Posted 05 March 2013 - 08:20 AM

use NULL as pSrcRect (to get the full image) and apply a transform to scale it down.



#5 george7378   Members   -  Reputation: 1251

Like
0Likes
Like

Posted 05 March 2013 - 10:32 AM

Thanks, that seems to be the only way. I decided that it's probably a better idea to create my buttons as offscreen textures and then load them in as individual sprites rather than trying to force text on top of a blank sprite.






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