I'm having troubles attaching the Device to a window using its hWnd, and I
have some troubles with getting transparancy to work with a DDOverlay... if
anyone could help it would be greatlay appreasated. Here is some of my
code.
The Transparancy isn't working because the ColorSpaceLow/HighValue isn't
set... The Line" overFX.DestinationColorKey.ColorSpaceLowValue =
Color.White" returns the error "Cannot Modify the return value because it is
not a variable"... Any help would be greatly appreasated hehe.
As for the "SetCooperativeLevel(???, CooperativeLevelFlags.Normal);" The
??? wants a control... I have a hWnd, could someone tell me how I get the
Control using the hWnd? (I'v tried just putting the hWnd in the ??? and it
says "is inaccessible due to its protection level".
Any help would be greatly appreasated, thanks [[Here is my code]]
---------------------------------------
private Device directDraw = null;
private Surface primary = null;
private Surface overlay = null;
private Surface backBuffer = null;
---------------------------------------
directDraw = new Device();
directDraw.SetCooperativeLevel(this, CooperativeLevelFlags.Normal);
SurfaceDescription desc = new SurfaceDescription();
SurfaceCaps caps = new SurfaceCaps();
desc.SurfaceCaps.PrimarySurface = true;
primary = new Surface(desc, directDraw);
desc.Clear();
desc.SurfaceCaps.Overlay = true;
desc.SurfaceCaps.Flip = true;
desc.SurfaceCaps.Complex = true;
desc.Width = 640;
desc.Height = 480;
desc.BackBufferCount = 1;
overlay = new Surface(desc, directDraw);
caps.BackBuffer = true;
backBuffer = overlay.GetAttachedSurface(caps);
OverlayEffects overFX = new OverlayEffects();
overFX.DestinationColorKey.ColorSpaceLowValue = Color.White;
overFX.DestinationColorKey.ColorSpaceHighValue = Color.White;
overlay.UpdateOverlay(primary, OverlayFlags.Show | OverlayFlags.Effects |
OverlayFlags.KeyDestinationOverride, overFX);
string text = "Please Work!";
while(Created)
{
backBuffer.ForeColor = Color.Yellow;
backBuffer.ColorFill(Color.White);
backBuffer.DrawText(10, 10, text, false);
overlay.Flip(backBuffer, FlipFlags.DoNotWait);
Application.DoEvents();
}
---------------------------------------
As small question... does DDraw Surface.DrawText(int,int,string,bool) not
allow you to somehow set the font like the DD7 COM allow you to?