/// <summary> /// Paint a control /// </summary> /// <param name="control">Control to paint</param> /// <param name="tileid">Id of the tile to draw</param> private void DrawTiles(OpenTK.GLControl control, int tileid) { control.MakeCurrent(); Display.ClearBuffers(); SpriteBatch.Begin(); // Background texture Rectangle dst = new Rectangle(Point.Empty, control.Size); SpriteBatch.Draw(CheckerBoard, dst, dst, Color.White); // Tile to draw if (TileSet != null) { Tile tile = TileSet.GetTile(tileid); if (tile != null) { Point location = new Point((control.Width - tile.Size.Width) / 2, (control.Height - tile.Size.Height) / 2); location.Offset(tile.Pivot); SpriteBatch.DrawTile(TileSet, tileid, location); } } SpriteBatch.End(); control.SwapBuffers(); }