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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - chhenning

Pages: [1]
1
Graphics / Re: Rotate a shape around a point
« on: February 15, 2015, 08:25:13 pm »
Thanks, that's exactly what I was looking for!

2
Graphics / Rotate a shape around a point
« on: February 15, 2015, 06:57:51 pm »
Hi all,

In SFML how would I rotate a shape around some point which is outside the shape's boundary, using transformations? I know how to use cos and sin but like to understand how to use transformation.

Here is one example:

    // Draw circle at center
    sf::CircleShape c;
    c.setFillColor(sf::Color::Red);
    c.setPosition(width / 2, height / 2 - 100);
    c.setRadius(50);
    c.setOrigin({50, 50});


    while(true)
    {
        window.clear(sf::Color::Black);

       
        // rotate around center of screen

        window.draw(c);

        window.display();
    }
 

Thanks all!

Christian


Pages: [1]