Hi, i'm trying to move a sf::RectangleShape :
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
{
m_Rectangle.move(15 * -1, 0);
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
{
m_Rectangle.move(15, 0);
}
but it's very jerky.
Plus when I press a Key there is a little latency.
Can you help me pls :)
The problem is that my loop is :
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
window.clear();
mapManager.drawAll(window);
mapManager.updateAll(); // updateAll update all my object in mapManager (move, etc.)
window.display();
}
}
I can't put the code outside, no ?