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