SFML community forums

Bindings - other languages => DotNet => Topic started by: Dolfik on November 11, 2013, 03:54:54 pm

Title: Shape
Post by: Dolfik on November 11, 2013, 03:54:54 pm
I'm trying to draw a shape, but nothing is displayed on the screen. The circle is drawn normally.
Code:
public static void ShapeDraw(RenderWindow window)//(float x, float y, float width, float height, RenderWindow window)
        {
            SShape shape = new SShape();
            shape.Origin = new Vector2f(40, 40);
            shape.Position = new Vector2f(5, 5);
            shape.FillColor = new SFML.Graphics.Color(255, 0, 0);
            window.Draw(shape);
        }

SShape
class SShape : SFML.Graphics.Shape
    {
        //protected Shape();
        //public Shape(SFML.Graphics.Shape copy);

       
        public override Vector2f GetPoint(uint index)
        {
            return new Vector2f();
        }
        public override uint GetPointCount()
        {
            return (uint)0;
        }
       
    }
Title: Re: Shape
Post by: zsbzsb on November 11, 2013, 03:58:15 pm
class SShape : SFML.Graphics.Shape
    {
        //protected Shape();
        //public Shape(SFML.Graphics.Shape copy);

       
        public override Vector2f GetPoint(uint index)
        {
            return new Vector2f();
        }
        public override uint GetPointCount()
        {
            return (uint)0;
        }
       
    }

Well if your custom shape has 0 points what do you expect to see? Maybe add at minimum 1 point and see if you get something.
Title: Re: Shape
Post by: Dolfik on November 11, 2013, 04:05:20 pm
Ok, thx just i thought it works differently.
Title: Re: Shape
Post by: Jebbs on November 11, 2013, 06:09:43 pm
It might be a good idea to look at the source for some of the classes that inherit from shape. You can use them as examples for how to properly implement things.