Chaos Project

Game Development => Sea of Code => Topic started by: G_G on April 19, 2010, 10:38:16 am

Title: [XNA] Setting Background Color Transparent?
Post by: G_G on April 19, 2010, 10:38:16 am
So I just ran into this. I tried drawing a sprite, it worked successfully but the background color of the sprite is showing when it shouldn't be.

Is there anyway to make a certain sprite's background transparent? Help is appreciated.
Title: Re: [XNA] Setting Background Color Transparent?
Post by: Aqua on April 19, 2010, 11:04:47 am
XNA's sprite drawing doesn't have an alpha channel?
Title: Re: [XNA] Setting Background Color Transparent?
Post by: winkio on April 19, 2010, 11:09:10 am
it does, he is just trying to change a solid background color to a transparent one from inside XNA.

There's nothing that jumps out from my memory, because I always worked with images setup the way I wanted to display them.  You'd probably have to use GetData on the Texture2D and set the alpha of all pixels of a certain color to 0.
Title: Re: [XNA] Setting Background Color Transparent?
Post by: G_G on April 19, 2010, 11:51:58 am
Well in that case I think it might be easier to just open photoshop and make the background transparent. Haha thanks anyways!