SDL highlighting rectangle

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
pythip
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 33
Joined: Sat Apr 24, 2010 11:25 pm

SDL highlighting rectangle

Post by pythip »

I was wondering if there was a way to make SDL_FillRect() semitransparent so that I can highlight the image behind it, anyone know of a way?
User avatar
ibly31
Chaos Rift Junior
Chaos Rift Junior
Posts: 312
Joined: Thu Feb 19, 2009 8:47 pm
Current Project: Like... seven different ones
Favorite Gaming Platforms: Xbox 360, Gamecube
Programming Language of Choice: C++, ObjC
Location: New Jersey.

Re: SDL highlighting rectangle

Post by ibly31 »

You need to blit an image that is transparent to do that. SDL_FillRect has no built in funcitonality to do transparency. If its a set size that you want to highlight, you can just make an image that size and blit it over the object to highlight it. If its not a set size, there are other ways. Just ask if thats the case.
Image
Twitter
Website/Tumblr
My Projects

The best thing about UDP jokes is that I don’t care if you get them or not.
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: SDL highlighting rectangle

Post by Ginto8 »

well, you could do SDL_FillRect for a slightly larger size BEFORE blitting the image. This would have the same effect as a separate surface with a large colorkeyed section, and may have better performance.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
Post Reply