![]() ![]() New Rectangle(destinationRectangle.Location + new Point(destinationRectangle.Width - border, 0), new Point(border)), New Rectangle(border, 0, texture.Width - border * 2, border), New Point(destinationRectangle.Width - border * 2, border)), New Rectangle(destinationRectangle.Location + new Point(border, 0), New Rectangle(destinationRectangle.Location, new Point(border)), Texture2D texture, int border, Color color) Public static void DrawRoundedRect(this SpriteBatch spriteBatch, Rectangle destinationRectangle, Here is the code for the "nine-patch" approach: public static class SpriteBatchExtensions If you look at the button you will see that it doesn't matter if (2), (5) and (7) get scaled horizontally (because it is essentially a straight line) in the same manner (4), (5) and (6) can be scaled vertically without affecting the quality of the image. Draw unscaled at the bottom right of the destination rectangle. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |