Hi guys, I would like to create a simulator of our machine and to do so I need to embed the xenko application inside our already existent wpf application. Is there a wpf container able to wrap xenko app?
Thanks in advance.
Paolo
1 Like
It is definitely possible since that’s how the Game Studio works: it is a WPF application.
You could take a look at the sources and see how it is done. There are a few tricks and the integration is not without quirks.m but it “works”.
I am commuting to work without access to the sources (except briefly through GitHub). The following classes should get you started but you will need to do your own investigation:
Once you succeed, would be great to turn it into a sample or tutorial!
It is very easy.
For example, You can see how I hosted the game in a windows forms control.
namespace Xenko.CodeOnlySample.Windows
{
class Xenko_CodeOnlySampleApp
{
static void Main(string[] args)
{
using (var game = new CodeOnlyGame())
{
var form = new GameForm();
var splitContainer = new SplitContainer();
splitContainer.Dock = DockStyle.Fill;
form.Controls.Add(splitContainer);
splitContainer.SplitterDistance = 100;
splitContainer.Panel1.BackColor = Color.White;
var context = new GameContextWinforms(splitContainer.Panel2, 500, 500, false);
form.Show();
game.Run(context);
}
}
}
}
2 Likes