?
Solved

Showing forms/messages/text over game screens.

Posted on 2003-11-09
7
Medium Priority
?
523 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
7 Comments
 
LVL 6

Accepted Solution

by:
DaFox earned 1000 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 1000 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

762 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