[英]How do I resize xna window without GraphicsDevice?
Ok I have a Scene
class which basically looks like this: 好的,我有一个
Scene
类,基本上是这样的:
public class Scene : DrawableGameComponent
{
public List<GameComponent> SceneComponents { get; set; }
public Scene(Game game)
: base(game)
{
SceneComponents = new List<GameComponent>();
}
Then got my Scene1
class which looks like this: 然后得到我的
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));
}
}
And I got the Game1
class which looks like this: 我得到了
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";
}
}
Now obviously they are much larger than that but I just wanted the signatures and extensions. 现在显然它们比这大得多,但是我只想要签名和扩展名。
All the game does is running scenes....the scene class doesn't matter. 游戏所要做的只是运行场景...。场景类无关紧要。
I am working on Scene1
and would like to change the screen resolution to 500x500 any idea how I do that? 我正在
Scene1
工作,想将屏幕分辨率更改为500x500,我该怎么做?
您已经拥有GraphicsDevice
组件,因为您的类继承自DrawableGameComponent
,因此,如果需要它,您只需使用Game.GraphicsDevice
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.