如何更改DirectX项目游戏';s显示模式从4:3到16:9?

如何更改DirectX项目游戏';s显示模式从4:3到16:9?,directx,directx-9,Directx,Directx 9,如何将项目游戏的显示模式从4:3更改为16:9?您可以创建一个类并更改LoadContent方法以查看此组件的运行情况。您只需加载相关内容,创建HelpScene实例,并执行HelpScene对象的Show方法: public class HelpScene : GameScene { public HelpScene(Game game, Texture2D textureBack, Texture2D textureFront) : base(

如何将项目游戏的显示模式从4:3更改为16:9?

您可以创建一个类并更改LoadContent方法以查看此组件的运行情况。您只需加载相关内容,创建HelpScene实例,并执行HelpScene对象的Show方法:

public class HelpScene : GameScene
    {
        public HelpScene(Game game, Texture2D textureBack, Texture2D textureFront)
            : base(game)
        {
            Components.Add(new ImageComponent(game, textureBack,
            ImageComponent.DrawMode.Stretch));
            Components.Add(new ImageComponent(game, textureFront,
            ImageComponent.DrawMode.Center));
        }
    }
    protected override void LoadContent()
    {
        // Create a new SpriteBatch, which can be used to draw textures
        spriteBatch = new SpriteBatch(graphics.GraphicsDevice);
        Services.AddService(typeof(SpriteBatch), spriteBatch);
        // Create the Credits / Instruction scene
        helpBackgroundTexture = Content.Load<Texture2D>("helpbackground");
        helpForegroundTexture = Content.Load<Texture2D>("helpForeground");
        helpScene = new HelpScene(this, helpBackgroundTexture,
        helpForegroundTexture);
        Components.Add(helpScene);
        helpScene.Show();
        activeScene = helpScene;
    }
公共类帮助场景:游戏场景
{
公共帮助场景(游戏游戏、Texture2D textureBack、Texture2D textureFront)
:基地(游戏)
{
组件。添加(新的图像组件(游戏、纹理回退、,
ImageComponent.DrawMode.Stretch);
组件。添加(新的图像组件(游戏、textureFront、,
ImageComponent.DrawMode.Center);
}
}
受保护的覆盖void LoadContent()
{
//创建一个新的SpriteBatch,可用于绘制纹理
spriteBatch=新spriteBatch(graphics.GraphicsDevice);
服务。添加服务(类型(SpriteBatch),SpriteBatch);
//创建学分/教学场景
helpBackgroundTexture=Content.Load(“helpbackground”);
helpForegroundTexture=Content.Load(“helpForeground”);
helpScene=新的helpScene(此,helpBackgroundTexture,
(地面纹理);
添加(帮助场景);
helpScene.Show();
activeScene=helpScene;
}