在 WPF 中使用 MonoGame

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12478511/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 05:23:53  来源:igfitidea点击:

Use MonoGame in WPF

wpfxamlxnawindows-runtimemonogame

提问by AndreyAkinshin

Can I mix MonoGame with XAML in WPF appliaction? For example: core of game written in MonoGame, but UI written in XAML and placed on top of MonoGame-Canvas. I know that I can use XAML on MonoGame in WinRT. Can I do same things in WPF?

我可以在 WPF 应用程序中将 MonoGame 与 XAML 混合使用吗?例如:游戏核心用 MonoGame 编写,但 UI 用 XAML 编写并放置在 MonoGame-Canvas 之上。我知道我可以在 WinRT 中的 MonoGame 上使用XAML。我可以在 WPF 中做同样的事情吗?

采纳答案by AndreyAkinshin

You should read Nick Gravelyn's blog post: http://blogs.msdn.com/b/nicgrave/archive/2010/07/25/rendering-with-xna-framework-4-0-inside-of-a-wpf-application.aspx

您应该阅读 Nick Gravelyn 的博客文章:http: //blogs.msdn.com/b/nicgrave/archive/2010/07/25/rendering-with-xna-framework-4-0-inside-of-a-wpf-应用程序.aspx

That should work for MonoGame as well, except for the last part that uses the content build pipeline as MonoGame does not yet have its own content build pipeline implementation.

这也适用于 MonoGame,除了最后一部分使用内容构建管道,因为 MonoGame 还没有自己的内容构建管道实现。

You can find some samples here: https://github.com/CartBlanche/MonoGame-Samples

您可以在这里找到一些示例:https: //github.com/CartBlanche/MonoGame-Samples

回答by kbo4sho88

MonoGame 3.2 supports WPF/DirectX interop now. http://www.monogame.net/2014/04/07/monogame-3-2/

MonoGame 3.2 现在支持 WPF/DirectX 互操作。http://www.monogame.net/2014/04/07/monogame-3-2/