Solved

Showing forms/messages/text over game screens.

Posted on 2003-11-09
7
507 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
ID: 9711751
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
ID: 9711792
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
ID: 9714447
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
ID: 9739836
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
ID: 12706086
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi XE10, MySQL Query 4 126
Delphi Form ownership 4 73
can't find the executable in Simulator 1 80
Firemonkey DbLookupComboBox equivalent ? 2 36
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

12 Experts available now in Live!

Get 1:1 Help Now