Today I decided to make the jump to the SFML 2.0RC from 1.6, but since I have I've noticed a serious problem with MouseMove events causing my event loop to stall until I stop moving the mouse. Here are some code samples to demonstrate what I mean:
#include <SFML/Window.hpp>
#include <iostream>
int main() {
sf::Window win(sf::VideoMode(1024, 600), "SFML 1.6");
sf::Clock clock;
while (win.IsOpened()) {
sf::Event e;
float elapsed = clock.GetElapsedTime();
clock.Reset();
std::cout << elapsed << std::endl;
while (win.GetEvent(e)) {
if(e.Type == sf::Event::Closed) win.Close();
}
win.Display();
}
return 0;
}
Simple program using SFML 1.6. The 'elapsed' variable is assigned a consistent value (about 0.016) every iteration even when I move the mouse around the window, so this works as expected.
#include <SFML/Window.hpp>
#include <iostream>
int main() {
sf::Window win(sf::VideoMode(1024, 600), "SFML 2.0");
sf::Clock clock;
while (win.isOpen()) {
sf::Event e;
sf::Time elapsed = clock.getElapsedTime();
clock.restart();
std::cout << elapsed.asMilliseconds() << std::endl;
while (win.pollEvent(e)) {
if(e.type == sf::Event::Closed) win.close();
}
win.display();
}
return 0;
}
The same program's SFML 2.0RC 'equivalent'. If I leave the window alone, the program prints out a consistent 16 ms every iteration, as I expect. If I start moving the mouse around the window, though, it gets stuck in the event loop until the mouse pointer either leaves the window or stays completely still. The result is that the next printout of the elapsed time is much longer (2000 ms if I move the mouse around continuously for 2 seconds, etc).
Any thoughts? I'm using Windows 7 x64, the most recent SFML 2.0RC from the downloads page, dynamically linking to the SFML libraries, and this happens in both debug and release modes.
edit: Oh yes, I'm also using the GCC DW2 version of the SFML libs. My compiler is GCC 4.4.0.