好的我有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,不知道我该怎么做?
答案 0 :(得分:1)
您已拥有GraphicsDevice
个组件,因为您的类继承自DrawableGameComponent
,因此如果您需要,只需使用Game.GraphicsDevice
。