Hi. I have a problem with sf::Event::MouseMoveEvent
#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
sf::RenderWindow window(sf::VideoMode(1280, 720, 32), "LIKE A PONG TEST", sf::Style::Fullscreen);
window.setFramerateLimit(60);
sf::Mouse::setPosition(sf::Vector2i(100, 200), window);
sf::Event::MouseMoveEvent mouse;
sf::Event event;
sf::Text paletka("|");
while (window.isOpen())
{
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
if ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Escape))
window.close();
if (event.type == sf::Event::MouseMoved) {
int x = mouse.x;
paletka.setPosition(x, 5);
std::cout << x << std::endl;
}
}
window.clear();
window.draw(paletka);
window.display();
}
}
I'm trying to get text x equal to mouse x, but when I am moving the mouse it writes (in cmd) the same x always!
I don't know what to do...
Thanks in advance for help.