/// <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() { // reset mouse, so we don't suddenly pan off to the sides Form.GotFocus += (sender, args) => RecenterMouse(); IsMouseVisible = true; _graphics.PreferredBackBufferWidth = 1024; _graphics.PreferredBackBufferHeight = 768; _graphics.IsFullScreen = false; _graphics.GraphicsDevice.RasterizerState = solidRasterizerState; _graphics.GraphicsDevice.DepthStencilState = defaultStencilState; _graphics.GraphicsDevice.BlendState = BlendState.Opaque; _graphics.ApplyChanges(); effect = new BasicEffect(_graphics.GraphicsDevice); InitializeEffect(); Components.Add(AxisRenderer = new AxisRenderer(this)); Components.Add(TriangleSelectionRenderer = new GenericRenderer(this)); Components.Add(LineSelectionRenderer = new GenericRenderer(this)); // Add Active tile to display DisplayTile(InitialTile); // Add a whole bunch more tiles to display var tile = InitialTile; LoadAndDisplayNeighbors(tile); InitGUI(); base.Initialize(); }
/// <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() { // reset mouse, so we don't suddenly pan off to the sides Form.Activated += (sender, args) => RecenterMouse(); IsMouseVisible = true; _graphics.PreferredBackBufferWidth = 1024; _graphics.PreferredBackBufferHeight = 768; _graphics.IsFullScreen = false; _graphics.GraphicsDevice.RasterizerState = solidRasterizerState; _graphics.GraphicsDevice.DepthStencilState = defaultStencilState; _graphics.GraphicsDevice.BlendState = BlendState.Opaque; _graphics.ApplyChanges(); effect = new BasicEffect(_graphics.GraphicsDevice); InitializeEffect(); Components.Add(AxisRenderer = new AxisRenderer(this)); Components.Add(TriangleSelectionRenderer = new GenericRenderer(this)); Components.Add(LineSelectionRenderer = new GenericRenderer(this)); var tileRenderer = new TileRenderer(this, ActiveTile); TileRenderers.Add(ActiveTile.TileId, tileRenderer); Components.Add(tileRenderer); InitGUI(); base.Initialize(); }