Input gets queued/buffered and causes the player to not stop when analog stick is released
Created by: xethm55
After upgrading to the new solarus 1.2, I noticed that when playing the character moves after releasing the analog stick on my gamepad - it worked fine in 1.1.
After some digging I found that only one event is handled per game cycle. Per the integration guide of SDL 2, you need to handle all events every cycle. I modifed the following function in MainLoop.cpp
/**
* \brief Detects whether there was an input event and if yes, handles it.
*/
void MainLoop::check_input() {
InputEvent* event = InputEvent::get_event();
while(event != NULL){
notify_input(*event);
delete event;
event = InputEvent::get_event();
}
}
This resolved the issue for me and I can again continue my ZSDX adventures.