如何设置GraphicsDevice.GraphicsProfile

时间:2012-08-10 13:46:21

标签: windows xna xamarin.android monogame

在经典的XNA应用程序中,此值通过应用程序属性设置。

默认情况下,此值设置为HiDef,至少在我当前使用的计算机上。但必须将其设置为Reach才能运行。

我的问题是我没有找到任何方法来使用monogame有效地改变这个值。属性窗口显然与XNA不同,我没有找到任何配置值。

Game构造函数或LoadContent方法中更改代码中的值并不能解决我的问题。


PS:我认为我原来的问题是由GraphicsDevice.GraphicsProfile导致的https://stackoverflow.com/questions/11900957/monogame-draw2d-sample-accessviolation-exception

1 个答案:

答案 0 :(得分:1)

在构造函数metod中,为GraphicsDeviceManager创建新的事件处理程序:

graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs (graphics_PreparingDeviceSettings);

(默认处理程序是通过在+ =之后双击Tab创建的)

然后在事件处理程序中添加以下代码

void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
{
e.GraphicsDeviceInformation.GraphicsProfile = GraphicsProfile.Reach;
}