event.mouseWheel.delta is the number of click the mouse wheel has scrolled. It's expressed in delta because the wheel has no state. It's basically "the mouse wheel has scrolled 2 times in the positive direction" if you get 2 or "the mouse wheel has scrolled 1 time in the negative position" if you get -1.
It is supposed to be used inside the event loop, only when the current event type is a
MouseWheelMoved event. If you're reading these values outside of this, it's wrong.
It is in no way related to the mouse position or mouse movement. However there are x and y in MouseWheelMoved event, to know where the mouse was when this mouse wheel event was triggered.
The code you posted is not real code and is weird, what's the point?
#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "...");
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
window.close();
}
if (event.type == sf::Event::MouseWheelMoved) {
std::cout << "wheel movement: " << event.mouseWheel.delta << std::endl;
std::cout << "mouse x: " << event.mouseWheel.x << std::endl;
std::cout << "mouse y: " << event.mouseWheel.y << std::endl;
}
}
window.clear();
window.display();
}
return 0;
}
It's hard to believe that with more than 80 posts and 2 years here you don't know how to properly use events, are you trolling?