Ok I have a Scene
class which basically looks like this:
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:
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:
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?
您已经拥有GraphicsDevice
组件,因为您的类继承自DrawableGameComponent
,因此,如果需要它,您只需使用Game.GraphicsDevice
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.