Programming 2D Games

The official forum for "Programming 2D Games" the book by: Charles Kelly

It is currently Fri Nov 16, 2018 2:54 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sun Jun 04, 2017 8:14 pm 
Offline

Joined: Wed Mar 22, 2017 10:33 pm
Posts: 14
I made a sprite that is supposed to have transparency but it deosnt. The background even has the same magenta color as the planet , FF00FF. How come it is not transparent?


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jun 04, 2017 10:56 pm 
Offline
Site Admin
User avatar

Joined: Sat Jan 28, 2012 4:36 pm
Posts: 547
It is probably the alpha channel value. A color is defined by 4 bytes, Alpha, Red, Green, Blue.
If the alpha channel value used for the transparent color is different than the defined value of
TRANSCOLOR then it will not be transparent. Make sure TRANSCOLOR is defined to the same
color value as the magenta used in the background of the image.


const COLOR_ARGB MAGENTA = D3DCOLOR_ARGB(255,255, 0,255);
const COLOR_ARGB TRANSCOLOR = MAGENTA; // transparent color

Another alternative is to use a paint program that supports alpha channel transparency. I
recommend paint.net.

Chuck

_________________
Professor Kelly


Top
 Profile  
Reply with quote  
PostPosted: Mon Jun 05, 2017 12:06 am 
Offline

Joined: Wed Mar 22, 2017 10:33 pm
Posts: 14
Thanks a ton


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group