Menu

#22 Problem with AlphaBlending and sprites

6.1.1_(beta)
open
nobody
5
2012-12-28
2011-03-31
Anonymous
No

I managed to get the problem with Transparency working. The only change I
made was to remove the actual settings of the Transparency Properties. It
actually does exactly what I want now, without me setting either
Transparent=true or TransparentColor=TransColor;

Sorry to say, the problem now moved to being a AlphaBlending problem.
This code is used:
if (blendingMode == 0x01)
{
// currentSprite.Alpha = 0x80;
// currentSprite.AlphaBlending = true;
}

When the two lines above are uncommented an error message shows up upon
executing:
-snip-
An unhandled exception of type 'SdlDotNet.Core.SdlException' occurred in
SdlDotNet.dll

Additional information: Surfaces must not be locked during blit
-snip-

The error does not occur at these lines but later when blitting (the last
line blitting sprites):
screen.Blit(layer1);
screen.Blit(layer2);
screen.Blit(sprites);

I never do Lock on Surface, but i do update the sprite data with:
-snip-
currentSprite.Surface.SetPixels(new Point(0, 0), newSpriteData);
-snip-

The Color array newSpriteData is populated with data before the live
above.

Discussion


Log in to post a comment.