Skip to main content
GameDev.net gamedev.net
🔒 Locked

DirectX overlay

Started by khalysta Apr 9, 2005 at 11:50 PM 2 replies 550+ views
Original Post
khalysta
khalysta
I am looking for some info on how I can do something like fraps does where it posts the fps in the game window. I don't want to do that specifically but from my own program create a small window or just write text that gives you game log file data. If anyone can perhaps point me in the right direction that would be appreciated :)
_Flecko
_Flecko
The first step is to figure out the time between frames. I don't know how you're handling your timesteps...I generally let the display framerate float while locking the simulation timestep, but if you aren't currently measuring the time between frames, DX provides a very accurate timer. I don't know about unmanged DX, but if you're using MDX the SDK comes with a file named DXUtil.cs (don't know where it is, just do a search). Add it to your project, and DXUtil.Timer(DirectXTimer.GetElapsedTime) will give you the time in seconds since you last made that same call.

As for displaying it...in MDX, there's a class, Direct3D.Font, which can draw text to the screen. It's pretty easy to use, the docs should be clear. Don't know about the unmanaged equivalent though.

Hope that helps,
Max
--------------Trans2D - 2D library for C# / Managed DirectX
khalysta
khalysta
No I'm not really looking for a framerate I said kinda like fraps. I have a seperate program that monitors a log file. Then after a battle is done I want the program to display in game some of the fight stats which is why I said its kinda like fraps in that respect since they are two different programs. So I have the secondary program running and I need to somehow access the main game and display there which is what I am looking for :)
Evil Steve
Evil Steve
Look into D3DSpy, it comes with the SDK. It monitors D3D calls in another application, by inserting a proxy D3D DLL, which logs calls and then calls the real D3D9.dll
This is pretty much exactly what you want I think. Except when you provide your own IDirect3DDevice9::EndScene() implementation, you'd draw your FPS (or whatever you want to draw), and then call the real EndScene().
The key is getting the app to load your DLL instead of DLL, and making your DLL look and behave exactly like D3D for the other app.

EDIT: The info for D3DSpy is in the DX9 docs at DirectX Graphics -> Tools -> D3DSpy.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.