【问题标题】:How can i run hidef XNA from winforms?如何从 winforms 运行 hidef XNA?
【发布时间】:2014-03-05 11:27:14
【问题描述】:

我有 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。

我该怎么做才能运行它??

【问题讨论】:

    标签: winforms xna


    【解决方案1】:

    将范围更改为 hidef:

    YourGraphicsDeviceManager.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs (graphics_PreparingDeviceSettings);
    
    void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
    {
       e.GraphicsDeviceInformation.GraphicsProfile = GraphicsProfile.HiDef;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-03
      • 1970-01-01
      • 2011-09-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多