Im trying to make a program were theres one point at 150, 150 and another point being the cursors location.
And a line is drawn from one point to the second and it keeps updating.
However when I attempted to do this with the following code:
while (true)
{
while (window.pollEvent(mapEvent))
{
if (mapEvent.type == sf::Event::MouseMoved)
{
sf::Vertex line[] =
{
sf::Vertex(sf::Vector2f(mapEvent.mouseButton.x, mapEvent.mouseButton.y)),
sf::Vertex(sf::Vector2f(150, 150))
};
window.clear(sf::Color::Black);
window.draw(line, 2, sf::Lines);
window.display();
}
}
When I do this tho It doesnt work and the line is drawn from the first point to a completely different region.
Why is this happening could anyone shed any light on the cause of this problem?
Gif:
http://imgur.com/DNxQErHEDIt: Oops it didnt show my cursor.