Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如果没有GraphicsDevice,如何调整xna窗口的大小?_C#_Xna_Resize - Fatal编程技术网

C# 如果没有GraphicsDevice,如何调整xna窗口的大小?

C# 如果没有GraphicsDevice,如何调整xna窗口的大小?,c#,xna,resize,C#,Xna,Resize,好的,我有一个场景类,基本上看起来像这样: public class Scene : DrawableGameComponent { public List<GameComponent> SceneComponents { get; set; } public Scene(Game game) : base(game) { SceneComponents = new List<GameComponent>(); } p

好的,我有一个
场景
类,基本上看起来像这样:

public class Scene : DrawableGameComponent
{
  public List<GameComponent> SceneComponents { get; set; }
    public Scene(Game game)
        : base(game)
    {
        SceneComponents = new List<GameComponent>();
}
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));
   }
}
public class Game1 : Microsoft.Xna.Framework.Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    Scene1 scene1;
    //Scene2 scene2;

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
    }
}
我得到了
Game1
类,看起来像这样:

public class Scene : DrawableGameComponent
{
  public List<GameComponent> SceneComponents { get; set; }
    public Scene(Game game)
        : base(game)
    {
        SceneComponents = new List<GameComponent>();
}
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));
   }
}
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知道我该怎么做吗?

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

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