Solved

Showing forms/messages/text over game screens.

Posted on 2003-11-09
7
511 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Syntax Check Delphi Seattle IOS app without MAC ? 1 105
Delphi component that can load a DLL in design time? 8 75
oracle global variables 4 76
Magic Software info 18 139
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 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