/// <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() { fullScreenSettings = new ResolutionSettings(320, 240, this.GraphicsDevice.DisplayMode.Width, this.GraphicsDevice.DisplayMode.Height, true); //Initialization Logic // Set our XNA content directory Content.RootDirectory = "Content"; // create our services CreateServices(); #if !XBOX // create our screens Screen editorScreen = new EditorScreen(this, EditorScreen.ScreenName); this.screenList.Add(editorScreen); #endif Screen gameScreen = new GameScreen(this, GameScreen.ScreenName); this.screenList.Add(gameScreen); Screen titleScreen = new StoryboardScreen("TitleScreen", "Introduction", @"StoryboardXML\TitleScreenStoryboard"); this.screenList.Add(titleScreen); Screen introScreen = new StoryboardScreen("Introduction", "Game", @"StoryboardXML\IntroductionStoryboard"); this.screenList.Add(introScreen); Screen midpoint = new StoryboardScreen("MidPoint", "Game", @"StoryboardXML\MidPointStoryboard"); this.screenList.Add(midpoint); Screen endScreen = new StoryboardScreen("Ending", "Game", @"StoryboardXML\EndingStoryboard"); this.screenList.Add(endScreen); this.AddScreenToDisplay(titleScreen); resolutionService = new ScreenResolutionService(graphics, ScreenManager.WindowedSettings); this.Services.AddService(typeof(IScreenResolutionService), resolutionService); sb = new SpriteBatch(GraphicsDevice); //For profiling: /* this.IsFixedTimeStep = false; graphics.SynchronizeWithVerticalRetrace = false; graphics.ApplyChanges(); */ // Initialize all components base.Initialize(); }
/// <summary> /// Updates the visible area rectangle of the camera /// </summary> public void UpdateVisibleArea(ScreenResolutionService resolutionService) { visibleArea = new RectangleF2(position.X, position.Y, resolutionService.StartTextureWidth, resolutionService.StartTextureHeight); }