如何在 Mac 上的 VirtualBox 中运行 XNA? [英] How can I run XNA in VirtualBox on a Mac?

查看:24
本文介绍了如何在 Mac 上的 VirtualBox 中运行 XNA?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这很奇怪.XNA 版本为 3.1,VirtualBox 版本为 4.0.2.

I know it's weird. XNA Version is 3.1 and VirtualBox version is 4.0.2.

推荐答案

安装软件 参考设备,带有 DirectX SDK.对我来说,这使得在 Hyper-V 虚拟机上运行 XNA 相关单元测试成为可能.它应该适用于任何虚拟环境,因为它在软件中实现了完整的 DirectX 设备,并且不依赖于可用的硬件或虚拟化驱动程序.它不会很快,但它应该可以工作.

Install the software reference device that comes with DirectX SDK. For me, that enabled running XNA related unit tests on a Hyper-V virtual machine. It should do the trick for any virtual environment since it implements a full DirectX device in software and does not rely on available hardware or virtualized drivers. It will not be blazingly fast but it should work.

安装 DirectX SDK 的核心部分就足够了,无需进一步安装或配置.

Installing the core parts of the DirectX SDK is enough, no further installation or configuration is required.

(差点忘了)在设置设备的代码中,您必须指定要使用的设备类型:

(Almost forgot) In the code that sets up the device you must specify the device type to use:

var deviceType = (hardwareDevice ? DeviceType.Hardware : DeviceType.Reference);
var graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter,
                                            deviceType,
                                            ...);

附带说明:在 XNA 4.0 中,使用 UseReferenceDevice 属性.

As a side note: in XNA 4.0, choosing reference or hardware device is moved to the GraphicsAdapter using the UseReferenceDevice property.

这篇关于如何在 Mac 上的 VirtualBox 中运行 XNA?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆