Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Shape  (Read 2940 times)

0 Members and 1 Guest are viewing this topic.

Dolfik

  • Newbie
  • *
  • Posts: 5
    • View Profile
Shape
« 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;
        }
       
    }

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Shape
« Reply #1 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.
« Last Edit: November 11, 2013, 04:01:37 pm by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Dolfik

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Shape
« Reply #2 on: November 11, 2013, 04:05:20 pm »
Ok, thx just i thought it works differently.

Jebbs

  • Sr. Member
  • ****
  • Posts: 358
  • DSFML Developer
    • View Profile
    • Email
Re: Shape
« Reply #3 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.
DSFML - SFML for the D Programming Language.