/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here viewport = GraphicsDevice.Viewport; displayPort = viewport; displayPort.Width -= 320; displayPort.X = 160; MainPlayer = new Player(displayPort, viewport); Tree = new Tree(this.Content, displayPort); playerHealth = new Health(viewport, this.Content); this.IsMouseVisible = true; base.Initialize(); }
protected override void Initialize() { graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft; graphics.IsFullScreen = true; graphics.ApplyChanges(); viewport = GraphicsDevice.Viewport; int width = viewport.Width; int height = viewport.Height; if (width > height) { int temp = width; width = height; height = temp; } graphics.PreferredBackBufferHeight = height; graphics.PreferredBackBufferWidth = width; graphics.SupportedOrientations = DisplayOrientation.Portrait; graphics.IsFullScreen = true; graphics.ApplyChanges(); viewport = GraphicsDevice.Viewport; MainPlayer = new Player(viewport); Tree = new Tree(this.Content); playerHealth = new Health(viewport, this.Content); AdGameComponent.Initialize(this, appID); Components.Add(AdGameComponent.Current); // Create an actual ad for display. CreateAd(); base.Initialize(); }