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

时间:2013-11-23 13:09:35

标签: c# xna resize

好的我有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,不知道我该怎么做?

1 个答案:

答案 0 :(得分:1)

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