SFML community forums

Bindings - other languages => DotNet => Topic started by: joeparrilla on May 10, 2012, 05:59:30 am

Title: CircleShape Drawing issues (C#)
Post by: joeparrilla 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();
            }
        }
    }
}
Title: Re: CircleShape Drawing issues (C#)
Post by: Laurent 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).
Title: Re: CircleShape Drawing issues (C#)
Post by: Gonzilla 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
 
Title: Re: CircleShape Drawing issues (C#)
Post by: Laurent on May 10, 2012, 09:21:54 am
Sorry, I meant Radius, not SetPointCount :-[
Title: Re: CircleShape Drawing issues (C#)
Post by: joeparrilla on May 10, 2012, 03:00:24 pm
Thanks Laurent :)