jsfml, poolEvents() method

57 views Asked by At

I recently started project in java using the JSFML library. My code fragment looks like this:

Iterable<Event> events;
events = mRenderWindow.pollEvents();
mKeyboardListener.handleEvents(events);
mMouseListener.handleEvents(events);

My problem is, when I firstly use KeyboardListener, then MouseListener is not working and vice versa. Can someone explain this behaviour? I searched for some info and there is not enough explanation.

1

There are 1 answers

0
AudioBubble On BEST ANSWER

You should make a copy of the events if you hope to iterate through them multiple times, this is because jsfml specifies a custom iterator.