PDA

View Full Version : Alpha blended sprites?



dogy D.
10-01-2004, 08:36 PM
Hi everyone.
I am a newbie DelphiX programmer and i started working on my game.
I made a road for the background, and i want to make a water sprite on the road, but it just looks silly being only blue, so I would like to make it kind of transparent (about 60%?)

Is there any way to do this?

Useless Hacker
10-01-2004, 09:46 PM
Use the DrawAlpha or DrawRotateAlpha methods to draw the image, passing in a value of between 0 and 255 for the Alpha.

dogy D.
11-01-2004, 01:39 AM
Thank you, I'll try that.

dogy D.
11-01-2004, 09:55 PM
I did it, but it is very VERY slow.
I tried what I could think of (not much) to speed it up, but still fps goes way down when alphablending. :cry: :evil:
Is there any way to speed it up?

Useless Hacker
11-01-2004, 10:47 PM
The trouble is, DelphiX does the alphablending (and rotation) in software, since DirectDraw does not support this in hardware.

You could try creating a combined road/water image initially, then just redrawing that using the normal draw method, but this would only be of use if the image was fairly static.

dogy D.
12-01-2004, 12:24 AM
Thanks for suggestion, but it's not static, so I made something else instead of water. Now I would like to make fadein/out effect between levels for my game. I tried AlphaBlending and ofcourse result was very slow. So the question is: How to make fadein/out effect in Delphix?

Useless Hacker
12-01-2004, 01:04 AM
Apart from alpha blending, you can use gamma ramps or palette animation.
Palette animation is only available if you are using 8-bit or less colour, but there is a sample in the DelphiX package showing how to do this.
Gamma ramps are rather more complicated, though Alimonster wrote an article about how to do it in straight DirectDraw (here (http://terraqueous.f2o.org/dgdev/viewtopic.php?t=17)).

dogy D.
12-01-2004, 01:11 AM
Thank you for your help.

Finch
16-02-2004, 07:25 PM
Try PowerDraw (http://turbo.gamedev.net/powerdraw.asp). PowerDraw can draw TGA images, which support transparency, and does it in hardware, because it uses DirectX 9. :wink: