Embed Godot Application into WPF window

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By adrios

I’ m considering to use Godot as Engine to develop basic games for a project. I would be very happy if I could use it since I like the ease of use and the idea behind (instead of using a well known competitor) but before starting I must be sure it has a certain functionality.

Since the games need to run inside an already existing WPF Application I made, is it possible to embed a Godot App inside a Window or something?

Thank you

:bust_in_silhouette: Reply From: DarrionOakenbow

As far as I can tell from my own searching around, you can’t directly embed it into another window without messing with the source code yourself.

What you could try doing though is export the game for HTML5, then embed that inside a webpage in your WPF app.

I’m not much of a .NET guy, so I’ll have to defer to StackOverflow on how to do it.

That sounds even worse than messing up code.

Reason he asks embed it on WPF is that he wants to access the game client with WPF items.

javawoo | 2020-12-09 13:37

:bust_in_silhouette: Reply From: xingzhenlu

First, in the Godot project settings, set “borderless” to on.

Then, Export your Godot program. For example, ming is called “Gmae1. exe”

Then, create methods using the win32 api in the WinForms project, “SetParent”, “ShowWindow”, “MoveWindow”, and embed the handle of the third-party exe program into UserControl.

See the source code for specific implementation:

Finally, if you use it in wpf, you only need to use WindowsFormsHost to host UserControl. However, there is an airspace problem, and we need to consider how to deal with it.

I don’t see any other solution better than this one. This is also a good approach too…

thebluetropics | 2023-01-30 07:11