I have been a code in full convertion mods for the source engine, but now im mostly coding C# applications. That provide utilties for games, during this proccess i have often wanted the ability to do a overlay that shows ingame.

During my research i found out it seems i would need one "hook" for eatch version of major version of the DirectX API. When i was coding for mods, i never got down renderer so i have no experience with that.

My question boils down to.
1) Is making a DirectX API overlay something that can be maintained in a 1 developer freeware project?
2) Anyone got any pointers on where to start ( With code samples, since this is freeware i dont have infinite time to spend learning DirectX).
3) My internet research has pointed me towards basicly feeding the overlay a bitmap that overlay will draw, is this the correct direction?


1] It depends on the developer, the time they can dedicate to the project, and on the scope of the project but yet it's certainly possible.

2] You could use Microsoft Detours: http://research.microsoft.com/en-us/projects/detours/, but this pretty good blog post that describes how it could be done in c#: http://spazzarama.wordpress.com/2010/03/29/screen-capture-with-direct3d-api-hooks/. More resources can be found by googling "fraps detours".

3] Correct. Typically, the overlay is implemented by intercepting the DX "present" call, and injecting code to blit your bitmap to the surface that is being presented. The concept is trivial, but the implementation could be replete with corner cases.

Good luck!

| improve this answer | |
  • 2
    \$\begingroup\$ An alternative is to hook EndScene and you can use the full gamut of Direct3D drawing calls (i.e. create your own models and draw them) before calling through to the original EndScene. \$\endgroup\$ – jeffora Oct 20 '10 at 3:57

Take a look at PLAYXPERT. It's a tool that takes care of the overlay using the driver sub-system and lets you build widgets in C# .NET.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.