473,405 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

C# and Managed DirectX (DDraw and Overlay)

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?
Nov 16 '05 #1
0 5640

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tom | last post by:
The Microsoft update page scans my computer which has Windos XP Home Edition. The website recommends installing both DirectX 9.0A end-user runtime and Managed DirectX. The problem is I have...
2
by: Michael Mayer | last post by:
First of all, sorry for the cross-post. Seems like there should be a managed directx newsgroup. I'm trying to open the following sample application that comes with the DirectX SDK....
0
by: Noel Cower | last post by:
This problem has been bugging me for a bit now: I recently purchased Visual C# 2003 Standard and installed the DirectX 9 SDK (Summer 2004), and got along fairly well looking over the samples and...
0
by: wraith | last post by:
Hi to all, I would just like to ask a simple question... Could Managed DirectX 9 (SDK Summer 2004) be used in MVC++ 2003? I ask this question coz, I get an error when using Managed DirectX in...
3
by: John Hann | last post by:
Hi, A friend of mine is in the process of building a 3d game engine using native DirectX in C++. I would like to contribute to the development of an editor for this engine, but I would prefer to...
12
by: Greg | last post by:
For all new desktop apps is managed/CLR recommended? I.e. Native MFC/Win32 not recommended in general for new desktop apps? Speaking in general, not referring to exceptions (e.g. drivers) -- Greg...
0
by: odie5533 | last post by:
I am looking to make a program similar to Xfire which will overlay information while playing a directx game. For an example of what xfire is capable of, see the image below:...
3
by: Robert Hooker | last post by:
Does anyone have any information on when MDX2.0 will come out of Beta? It seems like its been in Beta for a looong time... Rob
15
by: =?Utf-8?B?Sm9hY2hpbQ==?= | last post by:
How can I pass a C++ HWND to and from C# and Managed C++?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.