Draw2DImage- AlphaProblem

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Lo_Ord
Posts: 12
Joined: Thu Apr 27, 2006 2:24 pm

Draw2DImage- AlphaProblem

Post by Lo_Ord »

Hi!

I wanted to make a simple crosshair. Therefor I drew a small .png and let it display in the middle of the screen - as simple as it can get.

Now i wanted to add transpirancy and am facing now a little problem:

I set the Backgroundcolor of the file to Transparent by using:

Code: Select all

makeColorKeyTexture(this->crosshair, SColor(0,0,0,0));
But when I wanted to draw it, it was not transparent.
So I did a little research and found out that I only have to set the last argument to = true.

My request to you is:

I need the easiest way to set the third argument (const core::rect< s32 >) to nothing, because I just don't need it (I presume??)
so my code would look like this:

Code: Select all

Draw2DImage(crosshair, position2d(x, y), NOTHING, 0, SColor(255, 255, 255), true);
What would be the easiest way to solve it?

regards

Lo_Ord
Ced666
Posts: 86
Joined: Fri Jan 13, 2006 10:29 am
Location: Belgium

Post by Ced666 »

Make this rectangle the size of your texture:

Code: Select all

core::rect< s32 > SourceRect(0,0,ImageWidth, ImageHeight);
Draw2DImage(crosshair, position2d(x, y), SourceRect, 0, SColor(255, 255, 255), true); 
Lo_Ord
Posts: 12
Joined: Thu Apr 27, 2006 2:24 pm

Post by Lo_Ord »

Thanks, thats exactly what I needed!
Post Reply