romanhoehne Posted December 25, 2003 Posted December 25, 2003 Hi, I've downloaded some samples for directdraw, but only in directx7 (SpaceBreakout) or I've found some for dx9 in C or C++ on this pages here. I want to move some small bitmaps (50 times 50 Pixs) with black as transparent color over a map (400 times 400 Pixs visible, 1000 times 1000 virtual). All in mode "display.SetCooperativeLevel(this, CooperativeLevelFlags.Normal);" . FullScreen maybe later... Are here some good hints in csharp for directx9 here or has someone an example? Here is, what I have tried so far (the "knight" has still a black Border...): private void Draw() .... primary.Draw(destination, offscreen, new Rectangle(i,j,300,300), Microsoft.DirectX.DirectDraw.DrawFlags.Wait, new DrawEffects() ) ; primary.Draw(destination1, knight, DrawFlags.Wait); private void CreateSurfaces() { display = new Device(); display.SetCooperativeLevel(this, CooperativeLevelFlags.Normal); SurfaceDescription description = new SurfaceDescription(); description.SurfaceCaps.PrimarySurface = true; primary = new Surface(description, display); description.Clear(); clip = new Clipper(display); clip.Window = this; primary.Clipper = clip; description.Clear(); offscreen = new Surface("card.bmp", description, display); description.Clear(); ColorKey CC = new ColorKey(); CC.ColorSpaceHighValue = 0; CC.ColorSpaceLowValue = 0; knight = new Surface("knight.bmp", description, display); knight.SetColorKey(Microsoft.DirectX.DirectDraw.ColorKeyFlags.SourceDraw, CC); } Maybe, I have forgotten something Best regards Roman Quote
slantz Posted December 27, 2003 Posted December 27, 2003 It looks like you've got just about everything, but when you draw your knight, try this: primary.Draw(destination1, knight, DrawFlags.Wait | DrawFlags.KeySource); My understanding is that the DrawFlags.KeySource flag tells the Draw() function to use the transparency you set up with your ColorKey. Hope that helps. -Hiro_Antagonist Quote
romanhoehne Posted December 28, 2003 Author Posted December 28, 2003 Thanx alot! It works :) :) Regards, Roman Quote
slantz Posted December 29, 2003 Posted December 29, 2003 Glad to be of service. =) -Hiro_Antagonist Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.