2013-11-23 89 views
1

好吧,我有一個Scene類基本上是這樣的:如何在沒有GraphicsDevice的情況下調整xna窗口大小?

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"; 
    } 
} 

現在顯然他們比這大得多,但我只想要signa圖和擴展。

所有的遊戲都在運行場景....場景類別無關緊要。

我在Scene1上工作,並希望將屏幕分辨率更改爲500x500任何想法我怎麼做?

回答

1

您已擁有GraphicsDevice組件,因爲您的班級繼承了DrawableGameComponent,所以如果您需要它,只需使用Game.GraphicsDevice

相關問題