public StarterGame() { // Default XNA setup. graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; // Required for lighting system. graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8; // Frame rate is 30 fps by default for Windows Phone. TargetElapsedTime = TimeSpan.FromTicks(333333); // Create the screen factory and add it to the Services screenFactory = new ScreenFactory(); Services.AddService(typeof(IScreenFactory), screenFactory); //Create a new instance of the Screen Manager screenManager = new ScreenManager(this); Components.Add(screenManager); Instance = this; #if WINDOWS_PHONE graphics.IsFullScreen = true; // Choose whether you want a landscape or portait game by using one of the two helper functions. InitializeLandscapeGraphics(); // InitializePortraitGraphics(); #else graphics.IsFullScreen = false; #endif #if WINDOWS_PHONE // Hook events on the PhoneApplicationService so we're notified of the application's life cycle Microsoft.Phone.Shell.PhoneApplicationService.Current.Launching += new EventHandler<Microsoft.Phone.Shell.LaunchingEventArgs>(GameLaunching); Microsoft.Phone.Shell.PhoneApplicationService.Current.Activated += new EventHandler<Microsoft.Phone.Shell.ActivatedEventArgs>(GameActivated); Microsoft.Phone.Shell.PhoneApplicationService.Current.Deactivated += new EventHandler<Microsoft.Phone.Shell.DeactivatedEventArgs>(GameDeactivated); #else // On Windows and Xbox we just add the initial screens AddInitialScreens(); #endif // AudioManager.Initialize(this); // Required for lighting system. screenManager.splashScreenGameComponent = new SplashScreenGameComponent(this); Components.Add(screenManager.splashScreenGameComponent); }
static void Main(string[] args) { #if WINDOWS // Improved ui. System.Windows.Forms.Application.EnableVisualStyles(); #endif using (StarterGame game = new StarterGame()) game.Run(); }