This is the code I have written, and after pressing R I want it to rotate around itself but it takes center outside the shape and revolves in a weird way.
#include <SFML/Graphics.hpp>
//#include <cstdlib>
//#include <ctime>
//#include<iostream>
using namespace std;
int main()
{
sf::RenderWindow window(sf::VideoMode(1366, 768), "First render");
sf::CircleShape Circle(50,6);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
if(sf::Keyboard::isKeyPressed(sf::Keyboard::G))
{
Circle.setFillColor(sf::Color(100,100,100));
}
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
Circle.move(0,-1);
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
Circle.move(0,1);
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
Circle.move(-1,0);
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
Circle.move(1,0);
}
if(sf::Keyboard::isKeyPressed((sf::Keyboard::LShift))&&sf::Keyboard::isKeyPressed((sf::Keyboard::Right)))
Circle.move(5,0);
if(sf::Keyboard::isKeyPressed((sf::Keyboard::LShift))&&sf::Keyboard::isKeyPressed((sf::Keyboard::Left)))
Circle.move(-5,0);
if(sf::Keyboard::isKeyPressed((sf::Keyboard::LShift))&&sf::Keyboard::isKeyPressed((sf::Keyboard::Up)))
Circle.move(0,-5);
if(sf::Keyboard::isKeyPressed((sf::Keyboard::LShift))&&sf::Keyboard::isKeyPressed((sf::Keyboard::Down)))
Circle.move(0,5);
if(sf::Keyboard::isKeyPressed(sf::Keyboard::R))
Circle.rotate(3);
window.clear();
window.draw(Circle);
// window.draw(shape2);
window.display();
}
return 0;
}