WPF and DirectX - Game Overlay

2020-02-08 20:23发布

问题:

Greetings

I've read WPF utilizes DirectX so I'm wondering if it is possible to create a Game Overlay with WPF. I have tried with Winforms or WPF by itself and the transparent forms or windows always cause problems for streaming software thus I'm wondering is it possible to do the following:

Create a WPF application which shows a Window on the desktop with all the options needed for the overlay. Once all the options is filled in you can press Update and the Overlay is created in the game with all the information on it. The WPF app itself won't be visible on the stream. This means all the viewers will not have any trouble with it when the broadcaster changes settings.

More about the overlay
The overlay will be a scoreboard so it will need a set amount of info. For example:

So to sum up my question(s)

  • Can I make a WPF application which dynamically creates a DirectX overlay ingame?

  • Since it needs to work in DirectX9, is this project possible to make by a single dev (me) which has little to no exp with DirectX?

  • If it is possible, where should I start?

Thanks in advance for all your possible insights and replies!

回答1:

What you want would be possible using D3DImage. It allows you to host any Direct3D content within WPF and also allows you to have overlay with transparency. Here is a simple example.



回答2:

From your comment above, it sounds like your really trying to inject your overlay (at least from the user's perspective) into Starcraft II. You would almost have to host a copy of the directx buffer. Also, besides WPF, you might want to look at XNA.