如何从winforms运行hidef XNA?

时间:2014-03-05 11:27:14

标签: winforms xna

我有winforms应用程序,我的纹理SimpleTexture.xnb编译为HiDef。我需要在单独的窗口中从我的winforms应用程序运行XNA 3D可视化。我试试这个:

    private void button1_Click(object sender, EventArgs e)
    {
        System.Threading.Thread thStartGame = new System.Threading.Thread(StartGame);
        thStartGame.Start();
    }

    private void StartGame()
    {
        using (Game1 game = new Game1())
        {
            game.Run();
        }
    }

但我得到错误: 加载“SimpleTexture”时出错。此文件是为HiDef配置文件编译的,无法加载到Reach GraphicsDevice。

我该怎么办?

1 个答案:

答案 0 :(得分:0)

将覆盖面更改为hidef:

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

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