/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); // TODO: Add your drawing code here timeElapsed += (int)gameTime.ElapsedGameTime.TotalMilliseconds; if (timeElapsed > config.TickTime) { gameOfLife.Tick(); timeElapsed = 0; } spriteBatch.Begin(); for (int x = 0; x < graphics.PreferredBackBufferWidth / config.PixelSize; x++) { for (int y = 0; y < graphics.PreferredBackBufferHeight / config.PixelSize; y++) { Rectangle rectangle = new Rectangle(x * config.PixelSize, y * config.PixelSize, config.PixelSize, config.PixelSize); spriteBatch.Draw(cell, rectangle, gameOfLife.GetColor(x, y)); } } spriteBatch.End(); base.Draw(gameTime); }