SFML.Graphics.ConvexShape.SetPoint C# (CSharp) Method

SetPoint() public method

Set the position of a point. Don't forget that the polygon must remain convex, and the points need to stay ordered! PointCount must be set first in order to set the total number of points. The result is undefined if index is out of the valid range.
public SetPoint ( uint index, Vector2f point ) : void
index uint Index of the point to change, in range [0 .. PointCount - 1]
point Vector2f New position of the point
return void
        public void SetPoint(uint index, Vector2f point)
        {
            myPoints[index] = point;
            Update();
        }

Usage Example

コード例 #1
0
        public void DrawQuad(int x, int y, int width, int height, Color color, Color color2, int thickness)
        {
            var zoom = GetZoom();

            int real_x      = (int)(x * zoom);
            int real_y      = (int)(y * zoom);
            int real_width  = (int)(width * zoom);
            int real_height = (int)(height * zoom);

            SFML.System.Vector2f position = new SFML.System.Vector2f(real_x, real_y);
            SFML.System.Vector2f size     = new SFML.System.Vector2f(real_width, real_height);

            float offset_x = 0;
            float offset_y = 0;

            SFML.Graphics.ConvexShape rect = new SFML.Graphics.ConvexShape(4);
            rect.OutlineThickness = thickness;
            rect.OutlineColor     = new SFML.Graphics.Color(color2.R, color2.G, color2.B, color2.A);
            rect.FillColor        = new SFML.Graphics.Color(color.R, color.G, color.B, color.A);
            rect.Position         = position;
            rect.SetPoint(0, new SFML.System.Vector2f(offset_x, offset_y));
            rect.SetPoint(1, new SFML.System.Vector2f(offset_x + size.X, offset_y));
            rect.SetPoint(2, new SFML.System.Vector2f(offset_x + size.X - size.Y, offset_y + size.Y));
            rect.SetPoint(3, new SFML.System.Vector2f(offset_x - size.Y, offset_y + size.Y));
            RenderWindow.Draw(rect);
        }
All Usage Examples Of SFML.Graphics.ConvexShape::SetPoint