How do I overlay graphics on DirectX games?

O

odie5533

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:
http://media.xfire.com/xfire/xf/themes/XFire3/images/tour/tour_image_4.jpg

I believe it is possible to overlay to DX games without needing to use
directx since I don't see any calls to d3d or dd libraries in Xfire. I
am able to get a basic overlay using GetDesktopWindow but I have it on
a timer/thread with sleeps and it always flickers in-game. Putting it
on a constant loop thread by itself only slowed down the game
dramatically which is not useful. I was wondering if anyone could
provide me with a better sample of accomplishing this. My code is
below:


Font font = new Font("Verdana", 15);
PointF pointf = new PointF(5, 5);
IntPtr hwnd = GetDesktopWindow();
IntPtr hdc = GetWindowDC(hwnd);
RECT rect = new RECT();
GetClientRect(hwnd, ref rect);
DrawTextA(hdc, "test", -1, ref rect, 0);
ReleaseDC(hwnd, hdc);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top