/// <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); spriteBatch.Begin(); Texture2D rect = new Texture2D(graphics.GraphicsDevice, camera.sizeOfTile, camera.sizeOfTile); Texture2D rect2 = new Texture2D(graphics.GraphicsDevice, camera.sizeOfTile, camera.sizeOfTile); Color[] data = new Color[camera.sizeOfTile * camera.sizeOfTile]; int j = 0; for (int x = 0; x < 8; x++) { for (int y = 0; y < 8; y++) { if (j % 2 == 0) { for (int i = 0; i < data.Length; i++) { data[i] = Color.White; } rect.SetData(data); spriteBatch.Draw(rect, camera.LogicToVisualCoordinatesFlipped(x, y), null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } else { for (int i = 0; i < data.Length; i++) { data[i] = Color.Black; } rect2.SetData(data); spriteBatch.Draw(rect2, camera.LogicToVisualCoordinatesFlipped(x, y), null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } j++; } j++; } float scale = camera.ScaleImageToTileSize(chesspiece.Bounds.Height, chesspiece.Bounds.Width); spriteBatch.Draw(chesspiece, camera.LogicToVisualCoordinatesFlipped(2, 3), null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); spriteBatch.End(); // TODO: Add your drawing code here base.Draw(gameTime); }