繁体   English   中英

没有GraphicsDevice的情况下如何调整xna窗口的大小?

[英]How do I resize xna window without GraphicsDevice?

好的,我有一个Scene类,基本上是这样的:

public class Scene : DrawableGameComponent
{
  public List<GameComponent> SceneComponents { get; set; }
    public Scene(Game game)
        : base(game)
    {
        SceneComponents = new List<GameComponent>();
}

然后得到我的Scene1类,看起来像这样:

public class Scene1 : Scene
{
    private SpriteBatch spriteBatch;        
    private Game game;

    public Scene1(Game game) : base(game)
    {
        this.game = game;
        spriteBatch = (SpriteBatch)game.Services.GetService(typeof(SpriteBatch));
   }
}

我得到了Game1类,看起来像这样:

public class Game1 : Microsoft.Xna.Framework.Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    Scene1 scene1;
    //Scene2 scene2;

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
    }
}

现在显然它们比这大得多,但是我只想要签名和扩展名。

游戏所要做的只是运行场景...。场景类无关紧要。

我正在Scene1工作,想将屏幕分辨率更改为500x500,我该怎么做?

您已经拥有GraphicsDevice组件,因为您的类继承自DrawableGameComponent ,因此,如果需要它,您只需使用Game.GraphicsDevice

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM