Hello! I am having this strange problem that I can't seem to solve. I'm running SFML 2.5.1 on Windows 10
Whenever I move my mouse continuously, smoothly, and at a fast-ish speed inside my SFML window, I get what is essentially an infinite loop of MouseMoved events within my event polling loop. Here is code that replicates the problem. If you move the mouse fast and smoothly without stopping within the window, it will print out multiple mousemove events on the same 'frame'
I would suspect there would be only one MoseMoved event per frame, no? This is seriously impacting the performance of my game and I don't know how to fix it. I
Here is a video of what's happening for me:
https://streamable.com/ugl3hoedit1: I am using a 144hz monitor, might that be a possible source for this behavior?
My Mouse:
https://www.razer.com/gaming-mice/razer-deathadder-v2/RZ01-03210100-R3U1edit2: I tried setFrameLimit(60) and 144 and neither affected the issue
edit3: I just found this thread from 8 years ago which I think is describing the same issue:
https://en.sfml-dev.org/forums/index.php?topic=5560.0#include <SFML/Window.hpp>
#include <iostream>
int main()
{
sf::Window win(sf::VideoMode(1024, 600), "SFML Window");
int frame = 0;
while (win.isOpen())
{
sf::Event e;
while (win.pollEvent(e))
{
if (e.type == sf::Event::Closed) win.close();
if (e.type == sf::Event::MouseMoved)
{
std::cout << "Mouse Move Event on Frame " << frame << "\n";
}
}
win.display();
frame++;
}
return 0;
}
Final Edit: SOLVED!
Razer Deathadder v2 mouse default Polling Rate was set to 1000hz, which was causing issues with SFML
I installed the Razer Gaming software, turned this down to 125hz, and now it's behaving 'as expected'.