Embed button control into existing Direct3D application

天大地大妈咪最大 提交于 2019-12-10 22:04:25

问题


I would like to overlay own content above a Direct3D v9 game (made by a third party).

Overlay Interactive Button

Specifically, I would like to overlay a clickable button control, like Steam does, for instance, though I'm attempting a much simpler interface.

Ideally, I would be able to overlay a WPF button or a Windows Form button or whole UserControl, but if that is not possible then creating a functioning button from primitives would suffice as well.

Text Overlay Working with SharpDX

  • I have a working sample of overlaying text based on the work of Justin Stenning
  • Namely with the help of SharpDX.Direct3D9.Font DrawText method

How to Overlay a Button or UserControl with SharpDX

I looked through relevant samples in https://github.com/sharpdx/SharpDX-Samples but was not able to find a way to include or draw native controls with SharpDX

  • Is it possible?
  • If not, are there any samples of drawing a clickable button from scratch?
  • Please bear in mind I'm a novice in the DirectX world :)

回答1:


Your biggest problem isn't going to be getting the controls to render on top of a DX scene; it's going to be getting them to respond to input afterwards. You can probably rig up a way to get the visuals copied to a DX surface, but I have no idea how you would capture input, translate it, and deliver it back to the WPF components. If it's even possible, it's almost certainly more trouble than it's worth.

There are a couple game-oriented Xaml solutions out there that you may want to check out. WPF for Games is a partial C++ implementation of WPF based on Direct3D, and there's also the proprietary Noesis GUI.



来源:https://stackoverflow.com/questions/26611170/embed-button-control-into-existing-direct3d-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!