# How can I fix user input for this pong paddle?

I have been having trouble with my pong paddle - It responds to user input as if it was typing.

Sometimes, people try to react to KeyPressed events directly to implement smooth movement. Doing so will not produce the expected effect, because when you hold a key you only get a few events (remember, the repeat delay). To achieve smooth movement with events, you must use a boolean that you set on KeyPressed and clear on KeyReleased; you can then move (independently of events) as long as the boolean is set. The other (easier) solution to produce smooth movement is to use real-time keyboard input with sf::Keyboard (see the dedicated tutorial). - http://sfml-dev.org/tutorials/2.1/window-events.php

I would like to figure out the 2nd option to keep my code neat. What should I be doing differently to achieve this? I already visited the tutorial, dug around in the docs for a while, and Googled it, but such things seem to be futile (am I missing something obvious?).

My Ball Move code (in the event loop):

float deltaTime = deltaTimer.restart().asMilliseconds();
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
{
}


My full code:

#include <SFML/Graphics.hpp>

int main()
{
sf::RenderWindow window(sf::VideoMode(600, 400), "Pong");

bool isPlaying = true; //set to true only for debugging
int spacing = 3; // the distance from edge of board to paddle.

sf::Clock deltaTimer;
sf::Texture backgroundTexture;
sf::Sprite background;
background.setTexture(backgroundTexture);

sf::RectangleShape pongBall(sf::Vector2f(10,10));
pongBall.setFillColor(sf::Color(200,200,200));
pongBall.setPosition(20,20);

while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
{
window.close();
}

if (isPlaying)
{
float deltaTime = deltaTimer.restart().asMilliseconds();
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up)) //sf::Keyboard::isKeyPressed(sf::Keyboard::Up)
{
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
{
}

{
}
{
}
}
else
{

}
}

window.clear(sf::Color::Black);
//window.draw();
window.draw(background);
window.draw(pongBall);
window.display();
}

return 0;


}