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

Author Topic: CircleShape Drawing issues (C#)  (Read 4548 times)

0 Members and 1 Guest are viewing this topic.

joeparrilla

  • Newbie
  • *
  • Posts: 14
    • View Profile
CircleShape Drawing issues (C#)
« on: May 10, 2012, 05:59:30 am »
Hey guys, Im probably missing something simple, but I cannot get this circle to display. Should I be calling the windows draw method like I am here, or do I call the circles draw and pass the window? Not sure whats going on...

namespace SFMLTEST
{
    class Program
    {
        static void OnClose(object sender, EventArgs e)
        {
            // Close the window when OnClose event is received
            RenderWindow window = (RenderWindow)sender;
            window.Close();
        }

        static void Main(string[] args)
        {
            // Create the main window
            RenderWindow window = new RenderWindow(new VideoMode(800, 600), "SFML window");
            window.Closed += new EventHandler(OnClose);

            // Create a graphical string to display
            Text text = new Text("Hello SFML.Net");

            //Circle
            CircleShape ball = new CircleShape(200.0f);

            ball.FillColor = new Color(Color.Magenta);
            ball.Position = new Vector2f(100.0f, 100.0f);


            // Start the game loop
            while (window.IsOpen())
            {
                // Process events
                window.DispatchEvents();

                // Clear screen
                window.Clear();

                // Draw the string
                window.Draw(text);

                // Draw Ball
                window.Draw(ball);

                // Update the window
                window.Display();
            }
        }
    }
}
« Last Edit: May 10, 2012, 08:08:28 am by Laurent »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: CircleShape Drawing issues (C#)
« Reply #1 on: May 10, 2012, 08:12:45 am »
There was a bug, it's now fixed. Thanks for your feedback.

If you want to make it work without recompiling SFML, just avoid the CircleShape(radius) constructor (so either use CircleShape(radius, pointCount) or SetPointCount).
Laurent Gomila - SFML developer

Gonzilla

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: CircleShape Drawing issues (C#)
« Reply #2 on: May 10, 2012, 09:03:07 am »
...use CircleShape(radius, pointCount) or SetPointCount).

I have not recompile SFML and use the RC version.

CircleShape s = new CircleShape();
s.SetPointCount(60); //Doesn't work

CircleShape s = new CircleShape();
s.Radius = 60; //Work
 
« Last Edit: May 10, 2012, 09:22:07 am by Laurent »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: CircleShape Drawing issues (C#)
« Reply #3 on: May 10, 2012, 09:21:54 am »
Sorry, I meant Radius, not SetPointCount :-[
Laurent Gomila - SFML developer

joeparrilla

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: CircleShape Drawing issues (C#)
« Reply #4 on: May 10, 2012, 03:00:24 pm »
Thanks Laurent :)

 

anything