1
Graphics / How do I make a circle rotate in a bigger circumference
« on: May 26, 2021, 08:18:06 am »#include <SFML/Graphics.hpp>
// done -- orbitting circle
int main()
{
sf::RenderWindow window(sf::VideoMode(1000, 1000), "SFML works!");
window.setFramerateLimit(10);
sf::CircleShape shape(50.f);
shape.setFillColor(sf::Color::Black);
//orbit
sf::CircleShape shapeTwo(50.f);
shapeTwo.setFillColor(sf::Color::Red);
//base
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
shape.setPosition(500.f, 500.f);
shape.rotate(10.f);
shape.setOutlineThickness(10);
shape.setOutlineColor(sf::Color(255, 255,255));
//orbit
window.draw(shapeTwo);
shapeTwo.setPosition(450.f, 450.f);
shapeTwo.setOutlineColor(sf::Color::White);
//base
window.display();
}
return 0;
}
// done -- orbitting circle
int main()
{
sf::RenderWindow window(sf::VideoMode(1000, 1000), "SFML works!");
window.setFramerateLimit(10);
sf::CircleShape shape(50.f);
shape.setFillColor(sf::Color::Black);
//orbit
sf::CircleShape shapeTwo(50.f);
shapeTwo.setFillColor(sf::Color::Red);
//base
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
shape.setPosition(500.f, 500.f);
shape.rotate(10.f);
shape.setOutlineThickness(10);
shape.setOutlineColor(sf::Color(255, 255,255));
//orbit
window.draw(shapeTwo);
shapeTwo.setPosition(450.f, 450.f);
shapeTwo.setOutlineColor(sf::Color::White);
//base
window.display();
}
return 0;
}
This is my code. I want the circles to be able to rotate in a bigger range instead of just around it's origin/center/whatever.
Is this possible?