public Game1() { graphics = new GraphicsDeviceManager(this); graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8; Content.RootDirectory = "Content"; sm = new ScreenManager(); go = new GameOptions(); entities = new List<Entity>(110); }
private void cancelButton_Click(object sender, RoutedEventArgs e) { _gameOptions = null; Close(); }
/// <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() { Screen.SetGraphics(GraphicsDevice); mouseHandler = new MouseHandler(); mouseHandler.leftMouseDown += new MouseHandler.LeftMouseDown(sm.HandleMouseClick); mouseHandler.moveEvent += new MouseHandler.MouseMove(sm.HandleMouseMove); spriteBatch = new SpriteBatch(GraphicsDevice); sm.AddScreen(new MapView("Map", GraphicsDevice)); sm.AddScreen(new SplashScreen("SplashScreen")); sm.AddScreen(new TutorialScreen("Tutorial")); if (File.Exists("Content/GameOptions.xml")) { XmlSerializer serializer = new XmlSerializer(typeof(GameOptions)); Stream options = File.Open("Content/GameOptions.xml", FileMode.Open); go = (GameOptions)serializer.Deserialize(options); options.Close(); } sm.InitAll(); Random rand = new Random(); Vector2 loc = new Vector2((float)(GraphicsDevice.Viewport.Width / 2.0f), (float)(GraphicsDevice.Viewport.Height / 2.0f)); for (int i = 0; i < entities.Capacity; i++) { entities.Add(new CloudEntity(loc)); } base.Initialize(); }