4

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.

TT.
  • 15,774
  • 6
  • 47
  • 88
WarNaX
  • 83
  • 7

1 Answers1

2

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.