コード例 #1
0
        private void DrawBorder(SpriteBatch spriteBatch, Point size)
        {
            // edges

            const int EDGE_SIZE = 5;

            spriteBatch.Draw(_uiContentStorage.GetContextualMenuBorderTexture(),
                             new Rectangle(_position, new Point(EDGE_SIZE, EDGE_SIZE)),
                             new Rectangle(0, 0, EDGE_SIZE, EDGE_SIZE),
                             Color.White);

            spriteBatch.Draw(_uiContentStorage.GetContextualMenuBorderTexture(),
                             new Rectangle(new Point(_position.X + size.X - EDGE_SIZE, _position.Y),
                                           new Point(EDGE_SIZE, EDGE_SIZE)),
                             new Rectangle(7, 0, EDGE_SIZE, EDGE_SIZE),
                             Color.White);

            spriteBatch.Draw(_uiContentStorage.GetContextualMenuBorderTexture(),
                             new Rectangle(new Point(_position.X, _position.Y + size.Y - EDGE_SIZE),
                                           new Point(EDGE_SIZE, EDGE_SIZE)),
                             new Rectangle(0, 7, EDGE_SIZE, EDGE_SIZE),
                             Color.White);

            spriteBatch.Draw(_uiContentStorage.GetContextualMenuBorderTexture(),
                             new Rectangle(new Point(_position.X + size.X - EDGE_SIZE, _position.Y + size.Y - EDGE_SIZE),
                                           new Point(EDGE_SIZE, EDGE_SIZE)),
                             new Rectangle(7, 7, EDGE_SIZE, EDGE_SIZE),
                             Color.White);

            // sides

            spriteBatch.Draw(_uiContentStorage.GetContextualMenuBorderTexture(),
                             new Rectangle(new Point(_position.X + EDGE_SIZE, _position.Y), new Point(size.X - (EDGE_SIZE * 2), 6)),
                             new Rectangle(EDGE_SIZE, 0, 2, 6),
                             Color.White);

            spriteBatch.Draw(_uiContentStorage.GetContextualMenuBorderTexture(),
                             new Rectangle(new Point(_position.X + EDGE_SIZE, _position.Y + size.Y - EDGE_SIZE),
                                           new Point(size.X - (EDGE_SIZE * 2), 6)),
                             new Rectangle(EDGE_SIZE, 7, 2, 6),
                             Color.White);
        }