I'm working on getting a full-functioning module version of the Snow/Rain plugin, but I appear to have come across a problem. At the moment (bear in mind this is WIP!!) all of the particles should be falling straight down. Which is working great, so long as I don't try and draw them with any transparency on the DrawingSurface. If there is any transparency at all, from 1 to 100, the particle is never drawn.
I am using the D3D9 graphics driver, I have the GUI and sprite alpha rendering styles set to proper alpha blending, and I am doing essentially this:
DynamicSprite *guiSprite; // used as GUI background image
void Render()
{
if (guiSprite == null)
{
guiSprite = DynamicSprite.Create(myGUI.Width, myGUI.Height, true);
myGUI.BackgroundGraphic = guiSprite.Graphic;
}
DrawingSurface *surface = guiSprite.GetDrawingSurface();
surface.Clear();
int i = 0;
while (i < particleCount)
{
// calculate particle position, etc.
surface.DrawImage(x, y, img, Random(maxTrans - minTrans) + minTrans); // DOES NOT WORK
// surface.DrawImage(x, y, img); // WORKS PERFECTLY
i++;
}
surface.Release();
}
function repeatedly_execute_always()
{
// check if snowing/raining, other sanity checks, etc.
Render();
}
Any ideas why the semi-transparent particles are disappearing entirely?
P.S. The particle sprite in question is 32-bit, no alpha.