Solved

Showing forms/messages/text over game screens.

Posted on 2003-11-09
7
501 Views
Last Modified: 2010-04-05
How can I show of form or message or text (or do something else like this) over/in a fullscreen DirectX or OpenGL game (for example 'Counter Strike/Half Life', 'Unreal Tournament', Warcraft)? If an application needs to show an information to a user even if he's playing games.

Thanks,

Sergio
0
Comment
Question by:sergiogn
  • 2
  • 2
7 Comments
 
LVL 6

Accepted Solution

by:
DaFox earned 250 total points
Comment Utility
Hi Sergio,

I couldn't say it better than it is described in this faq answer: http://www.fraps.com/faq.htm#coders

-
"Unfortunately there is no simple way to draw graphics on screen. [...] Fraps works by patching directly into the underlying graphics API. Doing things this way allows Fraps to issue graphics commands as if it were the game itself, avoiding having to do a large amount of setup beforehand. [...] The first method is referred to as “API hooking”. [...] The other method is to write a “DLL wrapper”."
-

BTW: fraps is an application that shows you your framerate in the upper left corner of any fullscreen OpenGL or DirectX game.

Regards,
Markus
0
 

Author Comment

by:sergiogn
Comment Utility
So if I have to write a DLL wrapper where should I search for reference/tutorial for my case?
0
 

Assisted Solution

by:delphifreak
delphifreak earned 250 total points
Comment Utility
Hi Sergio!

I know that the answers marked in my question are not the right ones, but i had to close the question, and because of this i shared the points ...

It can be done with GDI (i think it's called like this), but with this method the things you draw on the screen have to be updated with every frame. So the text 'blinks'.
But this is not the best method ...

by delphifreak
0
 
LVL 6

Expert Comment

by:DaFox
Comment Utility
Sergio, do you really think writing a DLL wrapper is a good choice? You have to replace the original DirectX/OpenGL DLL with your own one and pass all "information" you get to the original one (that you renamed before).
That means a lot of work and your wrapper doesn't work with newer versions of DX/OpenGL for shure!
Personally, I'd rather use API hooking. The chance that your code works with a newer version of the dll is better than using the wrapper technique!

Markus
0
 

Expert Comment

by:delphifreak
Comment Utility
I found another, better solution for the problem:
What you need for drawing text, for example in a DX game, is a handle to the IDirect3DDevice of the game (for the D3DXCreateFont-function or whatever). It is not easy to obtain this, but it is possible, by hooking the API-Functions of the DirectX Libs.
The best way to get the handle is hooking the Present-Function, which is called every time a new frame is drawn. And that's the point where you have to draw your text.

OpenGL is a little bit easier, but the biggest problem there is drawing the text. There is a nearly similar function called when drawing a new frame, often named SwapBuffers.

API Hooking is very easy, if you have the right lib. I am using Madshis MadCodeHook-Lib, which is available at http://www.madshi.net/ . Some helpful examples are provided too.

ciao, df
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now